SA-MP Forums Archive
string doesn't display 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: string doesn't display name (/showthread.php?tid=465712)



string doesn't display name - CesarLT - 23.09.2013

Hello everyone, title says it all..

Here's the string:

pawn Код:
new log[128];
    new pName[25];
    GetPlayerName(playerid, log, sizeof(log));
    format(log, sizeof(log), "**[SERVER]** {FFFFFF}- You're currently logged in as: {FF8921}%s{FFFFFF}.", pName);
    SendClientMessageToAll(COLOR_ORANGE, log);
When I log in, I can see only You're currently logged in as: .

Thanks in advance for the help.


Re: string doesn't display name - knackworst - 23.09.2013

Quote:
Originally Posted by CesarLT
Посмотреть сообщение
Hello everyone, title says it all..

Here's the string:

pawn Код:
new log[128];
    new pName[25];
    GetPlayerName(playerid, log, sizeof(log));
    format(log, sizeof(log), "**[SERVER]** {FFFFFF}- You're currently logged in as: {FF8921}%s{FFFFFF}.", pName);
    SendClientMessageToAll(COLOR_ORANGE, log);
When I log in, I can see only You're currently logged in as: .

Thanks in advance for the help.
You're formatting the playername in the log string, not in the pName string
Thus pName is never formatted and will be left empty


Re: string doesn't display name - Konstantinos - 23.09.2013

pawn Код:
GetPlayerName(playerid, pName, sizeof(pName));



Re: string doesn't display name - Areax - 23.09.2013

pawn Код:
new log[128];
new pName[25];
GetPlayerName(playerid, pName, sizeof(pName));
format(log, sizeof(log), "**[SERVER]** {FFFFFF}- You're currently logged in as: {FF8921}%s{FFFFFF}.", pName);
SendClientMessageToAll(COLOR_ORANGE, log);



Re: string doesn't display name - CesarLT - 23.09.2013

Quote:
Originally Posted by knackworst
Посмотреть сообщение
You're formatting the playername in the log string, not in the pName string
Thus pName is never formatted and will be left empty
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
GetPlayerName(playerid, pName, sizeof(pName));
Quote:
Originally Posted by Areax
Посмотреть сообщение
pawn Код:
new log[128];
new pName[25];
GetPlayerName(playerid, pName, sizeof(pName));
format(log, sizeof(log), "**[SERVER]** {FFFFFF}- You're currently logged in as: {FF8921}%s{FFFFFF}.", pName);
SendClientMessageToAll(COLOR_ORANGE, log);
My bad lol, thank you everyone..
Sorry for the trouble :P