SA-MP Forums Archive
Help me with this bit of script please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me with this bit of script please (/showthread.php?tid=90530)



Help me with this bit of script please - ThePS3Guy - 08.08.2009

#include <a_samp>

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("SSnS::Cars by skyturnred");
print("--------------------------------------\n");
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if vehicleid =
{
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
};
do nothing
else;
AddVehicleComponent(vehicleid, 1010);
return 1;
}


im trying to make it so that when someone enters a car they get nos, but not if its a car that cant have nos, like a plane or nrg


Re: Help me with this bit of script please - coole210 - 08.08.2009

If they cant have nos they dont add nos so just add veh component and it will add

BTW im not sure if OnPlayerEnterVehicle will work ! Try OnPlayerStateChange

pawn Код:
//Under OnPlayerStateChange
if(GetPlayerState(playerid)) == PLAYER_STATE_DRIVER)
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}



Re: Help me with this bit of script please - Chrham_2 - 08.08.2009

Quote:
Originally Posted by coole210
If they cant have nos they dont add nos so just add veh component and it will add

BTW im not sure if OnPlayerEnterVehicle will work ! Try OnPlayerStateChange

pawn Код:
//Under OnPlayerStateChange
if(GetPlayerState(playerid)) == PLAYER_STATE_DRIVER)
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
Its not possible to do it on OnPlayerEnterVehicle,
because then it tries to add nos before he actually are inside the car..


Re: Help me with this bit of script please - ThePS3Guy - 08.08.2009

Thanks to both of you, I got it working. It was actually very simple, all i did was replace onplayerentervehicle with onplayerstatechange