OnPlayerEnterVehicle problem - 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: OnPlayerEnterVehicle problem (
/showthread.php?tid=186536)
OnPlayerEnterVehicle problem -
Rocky Balboa - 29.10.2010
I was trying to make something like , when a player enters a ambulance, he gets full health .. but it wasnt working..
can anyone just give me a sample, it doesnt have to be an ambulance.. i can hcange that myself .. but just give me the structure..
Respuesta: OnPlayerEnterVehicle problem -
admantis - 29.10.2010
Dont use OnPlayerEnterVehicle - that will check when you press the ENTER key to enter the vehicle, not when your in it yet. So use OnPlayerStateChange
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new veh = GetVehicleModel(GetPlayerVehicleID(playerid));
if (veh == ambulanceid) // Change ambulanceid to any vehicle id you want
{
return SetPlayerHealth(playerid,100.00);
}
}
return 1;
}