12.11.2014, 10:17
Quote:
Would this work also in OnPlayerExitVehicle.
Код:
for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(IsPlayerInVehicle(i, vehicleid)) { if(GetPlayerState(i) != PLAYER_STATE_DRIVER) { return 1; } } } } |
Quote:
You don't have to loop for the playerid... You already have it in the callback as a parameter.
And it may work, yes... But the one that @Ballu Miaa stated is more efficient |
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInVehicle(playerid, vehicleid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
//Your code.
return 1;
}
}
}
return 1;
}