problem with format
#1

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;

Reply
#2

new String[128];
Reply
#3

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;
}
Reply
#4

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.
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)