How to add vehicle nitro on vehicle spawn? -
ThePS3Guy - 06.08.2009
OK, so I was able to make unlimited nitro using timers (thankyou Bert), but the problem is, when the player enters the car he has to wait for the timer to complete before the car has nitro. Is there anyway I can make the vehicle automatically have nitro when it spawns, accept for vehicles that cannot have nitro? Maybe using something like OnVehicleSpawn (i dunno, im kind of new to pawno).
heres what I have so far:
#include <a_samp>
/*------------------------------[ Infinitife Nitro ]-----------------------------------
This filterscript is made by bert aka boemeles
Vehicle with nos check made by [Fackin']Luke.
How does it work: simply press and hold the left mousebutton (or any other key you
defined for start nos and keep the fun going
---------------------------------------------------------------------------------------*/
public OnFilterScriptInit()
{
print("\n-----------------------------------");
print("Infinite nitro by Bert aka boemeles"); //me!
print("-----------------------------------\n");
SetTimer("NitroReset", 10000, 1);
return 1;
}
forward NitroReset();
public NitroReset()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerInInvalidNosVehicle(i,GetPlayerVehicle ID(i))) //ty @ [fackin'] luke //notice the "!"
{
new vehicle = GetPlayerVehicleID(i);
AddVehicleComponent(vehicle, 1010);
}
}
}
//-------------------------[ IsPlayerInValidNosVehicle ]-------------------------------
IsPlayerInInvalidNosVehicle(playerid,vehicleid)
{
#define MAX_INVALID_NOS_VEHICLES 29
new InvalidNosVehicles[MAX_INVALID_NOS_VEHICLES] =
{
581,523,462,521,463,522,461,448,468,586,
509,481,510,472,473,493,595,484,430,453,
452,446,454,590,569,537,538,570,449
};
vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid,vehicleid))
{
for(new i = 0; i < MAX_INVALID_NOS_VEHICLES; i++)
{
if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
{
return true;
}
}
}
return false;
}
// end of it!
Re: How to add vehicle nitro on vehicle spawn? -
kaisersouse - 06.08.2009
ummm onplayerstatechange when newstate = PLAYER_STATE_DRIVER
no timer needed
Re: How to add vehicle nitro on vehicle spawn? -
ThePS3Guy - 06.08.2009
ya but if i take the timer away then its not infinite nitro...