SA-MP Forums Archive
How to actoully get a players name? - 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 actoully get a players name? (/showthread.php?tid=290085)



How to actoully get a players name? - Azzeto - 14.10.2011

I am currently using a stock from VXRP, GetName but I want to know how I can just get an actoull name on a command, if you understand..

Heres the stock
PHP код:
stock GetName(playerid)
{
    new 
Name[MAX_PLAYER_NAME];
    if(
IsPlayerConnected(playerid))
    {
        
GetPlayerName(playeridNamesizeof(Name));
    }
    else
    {
        
Name "Disconnected/Nothing";
    }
    return 
Name;

But I want to know how to do that in a command..


Re: How to actoully get a players name? - Wesley221 - 14.10.2011

pawn Код:
format( string, sizeof string, "Your name is: %s", GetName(playerid) )
Like that it works.


Re: How to actoully get a players name? - Tomejus - 14.10.2011

Код:
new pName[ MAX_PLAYER_NAME ], string[ 128 ]; // variables.
GetPlayerName( playerid, pName, MAX_PLAYER_NAME ); // get name.
format( string, sizeof( string ), "Your name is: %s", pName ); // formating.
SendClientMessage( playerid, COLOR, string ); // Sending.



Re: How to actoully get a players name? - Wesley221 - 14.10.2011

Quote:
Originally Posted by Tomejus
Посмотреть сообщение
Код:
new pName[ MAX_PLAYER_NAME ], string[ 128 ]; // variables.
GetPlayerName( playerid, pName, MAX_PLAYER_NAME ); // get name.
format( string, sizeof( string ), "Your name is: %s", pName ); // formating.
SendClientMessage( playerid, COLOR, string ); // Sending.
He wanted to get the name of a player, by using the stock he posted. Not the way like u did. Though, it would work.


Re: How to actoully get a players name? - Azzeto - 14.10.2011

Na sorry if I didnt explain better :P I wanted to write it the way he did, so I would know how incase if I didnt have access to that stock, rep for you both though!