SA-MP Forums Archive
error 076: syntax error in the expression, or invalid function call - 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: error 076: syntax error in the expression, or invalid function call (/showthread.php?tid=476234)



error 076: syntax error in the expression, or invalid function call - Mey6155 - 17.11.2013

pawn Код:
CMD:newb(playerid, params[])
{
    if(PlayerInfo[playerid][pNewb] ==0) return SendClientMessage(playerid,0xffffffaa,"You are not a newbie"); //checking if a player is not a noob, change it to your variable if any
    if(NewbieChat == false) return SendClientMessage(playerid, COLOR_GREY, "Newbie chat is disabled!");
    new string[256], text[256];

    for(new i=0; i< MAX_PLAYERS;i++)
    {
        if(PlayerInfo[i][pNewb] ==1)
        {
            format(string,sizeof(string),"[NewbieChat] %s: %s",GetName,text);
            SendClientMessage(i,0xffffffaa,string);
        }
    }
    return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    format(string, sizeof(string), "%s:  %s", GetName, text); //here
    nearByMessage(playerid, COLOR_GREY, string);
    return 1;
}
Errors at:
format(string, sizeof(string), "%s: %s", GetName, text);
format(string,sizeof(string),"[NewbieChat] %s: %s",GetName,text);

What did i do wrong?
How can i solve it?

My NearByMessage
pawn Код:
stock nearByMessage(playerid, color, string[], Float: Distance = 12.0) {
    new
        Float: nbCoords[3];

    GetPlayerPos(playerid, nbCoords[0], nbCoords[1], nbCoords[2]);

    foreach(Player, i) {
        if(IsPlayerInRangeOfPoint(i, Distance, nbCoords[0], nbCoords[1], nbCoords[2]) && (GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))) {
            SendClientMessage(i, color, string);
        }
    }

    return 1;
}
ERRORS:
Код:
C:\Users\LG\Desktop\Mustafa\LV RP\gamemodes\RPLV.pwn(188) : error 076: syntax error in the expression, or invalid function call
C:\Users\LG\Desktop\Mustafa\LV RP\gamemodes\RPLV.pwn(639) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: error 076: syntax error in the expression, or invalid function call - JeaSon - 17.11.2013

maybe this

pawn Код:
format(string, sizeof(string), "%s: %s", GetName(playerid), text);
format(string,sizeof(string),"[NewbieChat] %s: %s",GetName(playerid),text);



Re: error 076: syntax error in the expression, or invalid function call - Mey6155 - 17.11.2013

Thx but i have a problem...
If i type something like T > Hi it says it twise 1 GRAY and the OTHER ONE WHITE..