21.03.2016, 16:49
Say a player enters a vehicle, and his tag should not be shown to all others (and re-shown on exitting the veh.) you have to do this:
You could add some optimization to the loops above, like checking if the players are streamed in for each other or something, but it's not doing much anyways.
However, if I remember correctly, this gets reset if a player streams out and in again, so you have to repeat this in OnPlayerStreamIn (if the first of the 2 players is in a vehicle). But test it first.
Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) for(new i = 0; i < MAX_PLAYERS; i ++) if(IsPlayerConnected(i) && playerid != i) ShowPlayerNameTagForPlayer(playerid, i, 0); if(newstate != PLAYER_STATE_DRIVER && newstate != PLAYER_STATE_PASSENGER) for(new i = 0; i < MAX_PLAYERS; i ++) if(IsPlayerConnected(i) && playerid != i) ShowPlayerNameTagForPlayer(playerid, i, 1); }
However, if I remember correctly, this gets reset if a player streams out and in again, so you have to repeat this in OnPlayerStreamIn (if the first of the 2 players is in a vehicle). But test it first.