newstate == Foot can't respawn vehicle? - 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)
+--- Thread: newstate == Foot can't respawn vehicle? (
/showthread.php?tid=580512)
newstate == Foot can't respawn vehicle? -
Metharon - 05.07.2015
i can't use SetVehicleToRespawn(GetplayerVehicleid(playerid); on onplayerstate

how can i make it works
Re: newstate == Foot can't respawn vehicle? -
MattTucker - 06.07.2015
Create a new global variable, something like
Код:
new gCarID[MAX_PLAYERS];
And check
Код:
if(newstate == PLAYER_STATE_DRIVER) gCarID[playerid] = GetPlayerVehicleID(playerid);
And then
Код:
if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER) SetVehicleToRespawn(gCarID[playerid]);
gCarID[playerid] = INVALID_VEHICLE_ID;