13.01.2013, 07:10
That would work... if he wanted the doors to unlock for passengers as well...
You would need to save the vehicle id to a player variable so when they exit, you can check the last vehicle they were in, and change its parameters.
Something like:
You would need to save the vehicle id to a player variable so when they exit, you can check the last vehicle they were in, and change its parameters.
Something like:
pawn Код:
new lastvehicle[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
lastvehicle[playerid] = -1; //They do not have a last vehicle so -1 / invalid
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
{
if(lastvehicle[playerid] != -1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(lastvehicle[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(lastvehicle[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
}
}
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
lastvehicle[playerid] = GetPlayerVehicleID(playerid);
}
return 1;
}