Easiest way to implement car godmode and unlimmited nitro?
#3

Add a variable to your vehicles info enum. ( If you got one )

pawn Код:
enum vInfo
{
        // ....
        vGodMode,

        // ...
}
new VehicleInfo[MAX_VEHICLES][vInfo];
You need to reset godmode variable. Under the function you load vehicles:

pawn Код:
VehicleInfo[vehicleid][vGodmode] = 0;
If you don't load vehicles after player login but you load all of them at Gamemode Init then do this:

pawn Код:
for(new i = 0; i<MAX_VEHICLES; i++)
{
      VehicleInfo[i][vGodMode] = 0;
}
Command to activate godmode, I guess you use ZCMD, if you don't then use it.
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;
}
Under OnVehicleDamageStatusUpdate:

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
Reply


Messages In This Thread
Easiest way to implement car godmode and unlimmited nitro? - by Piooo - 09.11.2017, 11:03
Re: Easiest way to implement car godmode and unlimmited nitro? - by Sithis - 09.11.2017, 12:24
Re: Easiest way to implement car godmode and unlimmited nitro? - by Lucases - 09.11.2017, 12:59

Forum Jump:


Users browsing this thread: 1 Guest(s)