Name Tag??
#1

I am looking for some code can hide or show name of the player if they enter vehicles. Sorry about bad English!!! (If it's bad )
Reply
#2

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:

Код:
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);
}
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.
Reply
#3

Thanks for help me!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)