How to actoully get a players name?
#1

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..
Reply
#2

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

Код:
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.
Reply
#4

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.
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)