09.11.2017, 12:59
Add a variable to your vehicles info enum. ( If you got one )
You need to reset godmode variable. Under the function you load vehicles:
If you don't load vehicles after player login but you load all of them at Gamemode Init then do this:
Command to activate godmode, I guess you use ZCMD, if you don't then use it.
Under OnVehicleDamageStatusUpdate:
The vehicle won't get repaired when a player shoots your vehicle. You need a global timer to reset vehicles health
pawn Код:
enum vInfo
{
// ....
vGodMode,
// ...
}
new VehicleInfo[MAX_VEHICLES][vInfo];
pawn Код:
VehicleInfo[vehicleid][vGodmode] = 0;
pawn Код:
for(new i = 0; i<MAX_VEHICLES; i++)
{
VehicleInfo[i][vGodMode] = 0;
}
pawn Код:
CMD:vgod(playerid)
{
if(!IsPlayerInAnyVehicle(playerid) return SendClientMessage(playerid, ANY_COLOR, "You aren't driving a vehicle");
if(GetPlayerVehicleSeat != 0) return SendClientMessage(playerid, ANY_COLOR, "You aren't the driver");
new vehicleid = GetPlayerVehicleID(playerid);
VehicleInfo[vehicleid][vGodmode] = 1;
SetVehicleHealth(vehicleid, 100000);
RepairVehicle(vehicleid);
SendClientMessage(playerid, ANY_COLOR, "You have toggled god mode on your vehicle");
return 1;
}
pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
if(VehicleInfo[vehicleid][vGodmode] == 1)
{
SetVehicleHealth(vehicleid, 100000);
RepairVehicle(vehicleid);
}
return 1;
}
The vehicle won't get repaired when a player shoots your vehicle. You need a global timer to reset vehicles health

