SA-MP Forums Archive
String problem - 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 problem (/showthread.php?tid=636614)



String problem - Mijata - 30.06.2017

Why i can't see full player name who type command

Код:
new string[128], name[75];
GetPlayerName(playerid, name, 75);
format(string,sizeof(string),"{B5B5B5}%s(%d): has used command %s",name[playerid],playerid,cmdtext);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(pInfo[i][pLevel] > 1)
SendClientMessage(i,-1,string);
}
return 1;
}



Re: String problem - oMa37 - 30.06.2017

MAX_PLAYER_NAME = 24.
You're defining the player's name size as 75, Make it 24 and to show it just use 'name', without '[playerid]'.


Re: String problem - Eoussama - 30.06.2017

Why are you using a 75 long string? Player names are not longer than 24 characters, so you should just use name[24] or name[MAX_PLAYER_NAME] MAX_PLAYER_NAME = 24 by default
Код:
format(string,sizeof(string),"{B5B5B5}%s(%d): has used command %s",name[playerid],playerid,cmdtext);
you declared the variable as name[75] and you use name[playerid]? It doesn't make any sense,
use this instead
PHP код:
format(string,sizeof(string),"{B5B5B5}%s(%d): has used command %s",name,playerid,cmdtext); 
EDIT: sorry oMa37, didn't refresh the page