SA-MP Forums Archive
problem with format - 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: problem with format (/showthread.php?tid=507487)



problem with format - Lirbo - 17.04.2014

This in the public
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
Text[144];
    
format(String,sizeof(String),"%s says: %s",NickName,Text);
    
SendClientMessage(playerid,-1,String);
    return 
1;

This is the error line
PHP код:
format(String,sizeof(String),"%s says: %s",NickName,Text); 
This is the error:
PHP код:
error 076syntax error in the expression, or invalid function call 
This is the stock of 'NickName':
PHP код:
stock NickName(playerid)
{
new 
nick[MAX_STRING];
GetPlayerName(playeridnicksizeof(nick));
nick strreplace("_"" "nick);
return 
nick;




Re: problem with format - mrkiller90 - 17.04.2014

new String[128];


Re: problem with format - Brandon_More - 17.04.2014

pawn Код:
format(String,sizeof(String),"%s says: %s",NickName(playerid),text);
pawn Код:
public OnPlayerText(playerid, text[])
{
    new String[144];
    format(String,sizeof(String),"%s says: %s",NickName(playerid),text);
    SendClientMessage(playerid,-1,String);
    return 1;
}



Re: problem with format - Firewire - 17.04.2014

pawn Код:
public OnPlayerText(playerid, text[])
{
    new Text[144]; // Also make a new string if that's not been defined elsewhere in the script.
 
    format(String,sizeof(String),"%s says: %s",NickName(playerid),Text);
    SendClientMessage(playerid,-1,String);
    return 1;
}
That will fix it, you forgot to add (Playerid) onto the end of your NickName function.

All the best,
Firewire.

EDIT: Wow, we all posted at the same time.


Re: problem with format - Lirbo - 17.04.2014

Thanks guys resolved... i had to add (playerid) after NickName