GetPlayerName error - 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: GetPlayerName error (
/showthread.php?tid=456537)
GetPlayerName error -
sarab_singh - 06.08.2013
Код:
new pname[MAX_PLAYER_NAME];
CMD:credits(playerid, params[])
{
ShowPlayerDialog(playerid, creditdialog, DIALOG_STYLE_MSGBOX, "Credits", ""cgreen">"cred"Elvis"cblue" server main scripter\n"cgreen">"cred"RaiN_HawK"cblue" server founder", "Ok", "");
SendAdminCMD(playerid, "credits");
return 1;
}
stock SendAdminCMD(playerid, command[])
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && pdata[i][admin] > 0)
format(String, sizeof(String), "%s has used command %s", GetPlayerName(playerid, pname, sizeof(pname)), command);
SendClientMessage(i, blue, String);
}
}
Can anyone tell what is error in this it shows only has used command credits and it happens everywhere except in dialog register and login
Re: GetPlayerName error -
Konstantinos - 06.08.2013
You store the name in a variable and use the variable to print it.
pawn Код:
new
pname[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
// blablabla..
format(String, sizeof(String), "%s has used command %s", pname, command);
SendClientMessage(i, blue, String);
Re: GetPlayerName error -
sarab_singh - 06.08.2013
Woow konstantinous thank u it worked but can you tell me why was it not working as i have done
Re: GetPlayerName error -
Konstantinos - 06.08.2013
What you did returns the length of the player's name - you can only store the name somewhere and then use it.
Re: GetPlayerName error -
sarab_singh - 06.08.2013
Ok i got it this cause my whole script to be bugged now i will be warned about it