error 001: expected token: "-string end-", but found "-identifier-"
#1

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)" : "") );
Reply
#2

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

PHP код:
new str[128]; 
Reply
#4

Hm, can u post the whole command then?
Reply
#5

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!");

Reply
#6

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

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
Reply
#8

And thank u!
Reply
#9

@Wesley221 read this post about the ternary operator.
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)