SA-MP Forums Archive
How To get The name of The Player? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How To get The name of The Player? (/showthread.php?tid=400208)



How To get The name of The Player? - Windrush - 17.12.2012

Example
My name Is Windrush
i Want To Add This
" 's House "
And it Will Be
" Windrush's House"


Re: How To get The name of The Player? - Konstantinos - 17.12.2012

Save the owner of the house and when you load the houses, load owner's name and show it with a formatted message.

PS: I think this is what you meant, not the function for player's name.


Re: How To get The name of The Player? - Windrush - 17.12.2012

i See but i dont how how to do it


Re: How To get The name of The Player? - Konstantinos - 17.12.2012

If you're refering to ******' post: GetPlayerName
Otherwise, what do you use for saving the house data?


Re: How To get The name of The Player? - Windrush - 17.12.2012

pawn Код:
GetPlayerName(playerid,+"'s House")
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD


Re: How To get The name of The Player? - Lordzy - 17.12.2012

You mean this?
pawn Код:
"%s's house"
Well, here's an example:
Usually for getting the player name, we use the function 'GetPlayerName'. You must create a name variable first and execute it to get player name function to use it well.
pawn Код:
public OnPlayerConnect(playerid) //When a player connects, this callback is called.
{
 new name[MAX_PLAYER_NAME]; //We created a name variable 'name'.
 GetPlayerName(playerid, name, sizeof(name)); //We're getting player's name and also executing the name variable.
 new string[128]; //The normal send client message just don't support floats directly, so we must format to show a message with player name.
 format(string, sizeof(string), "%s has joined the server.", name); //We are formatting it. '%s'  stands for a text format and here we've executed our name variable at last. So '%s' will be considered as player's name.
 SendClientMessageToAll(0xFF0000, string); //Sends all the message - formatted string message.
 return 1;
}
https://sampwiki.blast.hk/wiki/GetPlayerName
https://sampwiki.blast.hk/wiki/format