[HELP] LoL?
#1

I fail at "GetPlayerName" =/

How to "Get my name" and get the "Other Player name"?

pawn Код:
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s(%d) has been banned by %s(%d).",name(playerid), playerid, name(targetid), playerid);
SendClientMessageToAll(0xFFFF00AA, string);
Name1 has been banned by Name2

Name1 = The player who get banned
Name2 = The player who ban him
Reply
#2

Where are you using the command at? I'm assuming inside of the command?

In that case, use GetPlayerName two times (storing the names in different variables) and use it on the different IDs. 'playerid' for the player who typed the command (the person who banned) and 'targetid' or whatever variable you created to hold the players ID (the person who got banned).
Reply
#3

pawn Код:
stock GetName(playerid)
 {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
I think its like that...

pawn Код:
format(string, sizeof(string), "%s(%d) has been banned by %s(%d).",GetName(playerid), playerid, GetName(targetid), playerid);
Reply
#4

You should seriously learn instead of just calling others to do it for you.

pawn Код:
new
    pName [ MAX_PLAYER_NAME ] ,
    tName [ MAX_PLAYER_NAME ],
    string [ 44 ]
;

GetPlayerName ( playerid, pName, MAX_PLAYER_NAME );
GetPlayerName ( targetid, tName, MAX_PLAYER_NAME );
format ( string, sizeof ( string ), "%s ( %d ) has been banned by %s ( %d ).", pName, playerid, tName, targetid );
SendClientMessageToAll ( 0xFFFF00AA, string );
Reply
#5

if you're using the name once in the command you could create a stock
pawn Код:
stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
}
then in a format
pawn Код:
format(string,sizeof(string),"name: %s",PlayerName(playerid));
GetPlayerName(playerid, string to store it, size of the string);
Reply
#6

Quote:
Originally Posted by cessil
Посмотреть сообщение
if you're using the name once in the command you could create a stock
pawn Код:
stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
}
then in a format
pawn Код:
format(string,sizeof(string),"name: %s",PlayerName(playerid));
GetPlayerName(playerid, string to store it, size of the string);
I just said that -.- ...
Reply
#7

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
I just said that -.- ...
yeah look at the time, I didn't see yours before I posted mine
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)