SA-MP Forums Archive
error 001: expected token: "-string end-", but found "-identifier-" - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 001: expected token: "-string end-", but found "-identifier-" (/showthread.php?tid=274057)



error 001: expected token: "-string end-", but found "-identifier-" - samtey - 04.08.2011

How to fix this??

pawn Код:
format(str,128,"System: %s [ID %d] has set %s [ID %d] gangsterlevel to %i%s",adminname, playerid, gangstername, id, gangsterlevel,((gangsterlevel >= 100) ? "(GODFATHER)" : "") );



Re: error 001: expected token: "-string end-", but found "-identifier-" - Wesley221 - 04.08.2011

Look at the line above, most likely you forgot a ';' there.
If that didnt solve your problem, post the line above


AW: error 001: expected token: "-string end-", but found "-identifier-" - samtey - 04.08.2011

PHP код:
new str[128]; 



Re: error 001: expected token: "-string end-", but found "-identifier-" - Wesley221 - 04.08.2011

Hm, can u post the whole command then?


AW: Re: error 001: expected token: "-string end-", but found "-identifier-" - samtey - 04.08.2011

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Hm, can u post the whole command then?
PHP код:
CMD:og(playeridparams[])
{
    new 
gangstername[MAX_PLAYER_NAME],adminname[MAX_PLAYER_NAME];
    new 
gangsterlevelid;
    if(
PlayerInfo[playerid][pAdmin] >= 3)
    {
        if (
sscanf(params"ui"idgangsterlevel)) return SendClientMessage(playeridCOLOR_RED"USAGE: /set_glevel [id] [gangsterlevel]");
        if (
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"System: Invalid ID");
        
GetPlayerName(idgangsternamesizeof(gangstername));
        
GetPlayerName(playeridadminnamesizeof(adminname));
        new 
str[128];
        
format(str,128,"System: %s [ID %d] has set %s [ID %d] gangsterlevel to %i%s",adminnameplayeridgangsternameidgangsterlevel,((gangsterlevel >= 100) ? "(GODFATHER)" "") );
        
SendClientMessageToAll(COLOR_YELLOW,str);
        return 
1;
    }
    else return 
SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");




Re: error 001: expected token: "-string end-", but found "-identifier-" - Stylock - 04.08.2011

pawn Код:
format(str, 128, "System: %s [ID %d] has set %s [ID %d] gangsterlevel to %i%s.", adminname, playerid, gangstername, id, gangsterlevel, (gangsterlevel >= 100 ? ("(GODFATHER)") : ("")));
and problem solved.


Re: error 001: expected token: "-string end-", but found "-identifier-" - Wesley221 - 04.08.2011

pawn Код:
((gangsterlevel >= 100) ? "(GODFATHER)" : "")
I think its from this part.
I dont really know what all the ? ": do, but if you want to have a " in your clientmessage, you need to have a '\'before it.
Example:
pawn Код:
SendClientMessage(playerid, -1, "Im gonna use a \"Doctoroctoganupusblargh\" for this. ");
Edit: Late


AW: error 001: expected token: "-string end-", but found "-identifier-" - samtey - 04.08.2011

And thank u!


Re: error 001: expected token: "-string end-", but found "-identifier-" - Stylock - 04.08.2011

@Wesley221 read this post about the ternary operator.


Re: error 001: expected token: "-string end-", but found "-identifier-" - Wesley221 - 04.08.2011

Quote:
Originally Posted by YJIET
Посмотреть сообщение
@Wesley221 read this post about the ternary operator.
Thanks Just what i was looking for