How to get a player's name?
#3

So. 1st you make a variable like new pName[MAX_PLAYER_NAME];

Max Player Name is how long the name can be (You can also put 24 or less but if the player name is longer than the value you put it will not show the whole name.

Now make a new variable. new string[256];

There's 256 because we do not need a longer string than a one with 256 cells.

Okay, so we give the pName variable a function: GetPlayerName(playerid,pName,sizeof(pName);

That means that pName will now show the player's name.

Now let us format the string: format(string,sizeof(string),"%s(%i) has joined the server",pName,playerid);

%s means that's a string, %i that's an integer(number).

Now let us send a message to the whole server someone joined:

SendClientMessageToAll(0xFFCC00,string);

That's all.
Reply


Messages In This Thread
How to get a player's name? - by Ehab1911 - 19.06.2011, 20:07
Re: How to get a player's name? - by Vince - 19.06.2011, 20:10
Re: How to get a player's name? - by sleepysnowflake - 19.06.2011, 20:17
Re: How to get a player's name? - by sim_sima - 19.06.2011, 20:19
Re: How to get a player's name? - by sim_sima - 19.06.2011, 20:34
Re: How to get a player's name? - by Scenario - 19.06.2011, 20:35
Re: How to get a player's name? - by Ehab1911 - 19.06.2011, 20:37
Re: How to get a player's name? - by sim_sima - 19.06.2011, 20:39
Re: How to get a player's name? - by sleepysnowflake - 19.06.2011, 20:45
Re: How to get a player's name? - by Ehab1911 - 19.06.2011, 20:48

Forum Jump:


Users browsing this thread: 1 Guest(s)