PDA

View Full Version : newstate == Foot can't respawn vehicle?


Metharon
05/07/2015, 11:55 PM
i can't use SetVehicleToRespawn(GetplayerVehicleid(playerid); on onplayerstate :( how can i make it works

MattTucker
06/07/2015, 12:13 AM
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;