Skip to content

Commit

Permalink
Merge pull request #14 from NexiusTailer/patch-1
Browse files Browse the repository at this point in the history
Vehicle tuning protection
  • Loading branch information
ziggi committed Dec 19, 2017
2 parents db5889e + 205a651 commit 8fe3405
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
6 changes: 6 additions & 0 deletions protection.inc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ enum Protection {
PROTECTION_CAMERA,
PROTECTION_CAMERAMODE,
PROTECTION_FAKEKILL,
PROTECTION_VEHICLETUNING,
}

enum ProtectionParams {
Expand Down Expand Up @@ -134,6 +135,7 @@ enum ProtectionPlayerInfo {
#include "protection/camera"
#include "protection/cameramode"
#include "protection/fakekill"
#include "protection/vehicletuning"

#if PROTECTION_CUSTOM_VENDING
#include "protection/vending"
Expand Down Expand Up @@ -257,6 +259,10 @@ public OnGameModeInit()
Protection_SetParamInt(PROTECTION_FAKEKILL, PROTECTION_ENABLED, 1);
Protection_SetParamString(PROTECTION_FAKEKILL, PROTECTION_NAME, "Fake Kill");

// vehicletuning
Protection_SetParamInt(PROTECTION_VEHICLETUNING, PROTECTION_ENABLED, 1);
Protection_SetParamString(PROTECTION_VEHICLETUNING, PROTECTION_NAME, "Vehicle Tuning");

// timer
SetTimer("Protection_Timer", PROTECTION_TIMER_TIME, 1);

Expand Down
2 changes: 1 addition & 1 deletion protection/fakekill.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
About: fakekill protection
Author: NexiusTailer
Author: Nexius
Contributor: ziggi
*/
Expand Down
49 changes: 49 additions & 0 deletions protection/vehicletuning.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
About: vehicle tuning protection
Author: Nexius
Contributor: ziggi
*/

#if !defined _protection_included
#error "Please include protection before vehicletuning"
#endif

#if defined _protection_vehicletun_included
#endinput
#endif

#define _protection_vehicletun_included

/*
OnVehicleMod
*/

public OnVehicleMod(playerid, vehicleid, componentid)
{
new bool:is_enabled = Protection_GetParamInt(PROTECTION_VEHICLETUNING, PROTECTION_ENABLED) != 0;

if (is_enabled) {
if (GetPlayerInterior(playerid) == 0) {
Protection_GivePlayerWarning(playerid, PROTECTION_VEHICLETUNING, "tuning");
return 0;
}
}

#if defined PVeTuning_OnVehicleMod
return PVeTuning_OnVehicleMod(playerid, vehicleid, componentid);
#else
return 1;
#endif
}
#if defined _ALS_OnVehicleMod
#undef OnVehicleMod
#else
#define _ALS_OnVehicleMod
#endif

#define OnVehicleMod PVeTuning_OnVehicleMod
#if defined PVeTuning_OnVehicleMod
forward PVeTuning_OnVehicleMod(playerid, vehicleid, componentid);
#endif

0 comments on commit 8fe3405

Please sign in to comment.