[HELP] expected token
#1

PHP код:
format(stringsizeof string"Wine Time Left: %d."TimeConvert(GetPVarInt(playerid"pPrisonWineTime")); 
PHP код:
./includes/updates/prison_system.pwn(2231) : error 001expected token","but found ";" 
Whole 'function'

PHP код:
if(PlayerInfo[playerid][pPrisonMWine] >= 1)
    {
        if(
gettime() >> GetPVarInt(playerid"pPrisonWineTime"))
        {
            
SendClientMessageEx(playeridCOLOR_GREY"Wine Time Left: 0:00:00.");
        }
        else
        {
            
format(stringsizeof string"Wine Time Left: %d."TimeConvert(GetPVarInt(playerid"pPrisonWineTime"));
            
SendClientMessageEx(playeridCOLOR_GREYstring);
        }
    } 
halp
Reply
#2

PHP код:
string,sizeof (string) 
Reply
#3

Quote:
Originally Posted by vassilis
Посмотреть сообщение
PHP код:
string,sizeof (string) 
Can you explain why that needs () when this doesn't? Just curious.

PHP код:
format(stringsizeof string"Prison Materials: %d."PlayerInfo[playerid][pPrisonMaterials]);
        
SendClientMessageEx(playeridCOLOR_WHITEstring); 
Edit: that didn't compile, same error

PHP код:
./includes/updates/prison_system.pwn(2231) : error 001expected token","but found ";" 
Reply
#4

Quote:
Originally Posted by BornHuman
Посмотреть сообщение
Can you explain why that needs () when this doesn't? Just curious.

PHP код:
format(stringsizeof string"Prison Materials: %d."PlayerInfo[playerid][pPrisonMaterials]);
        
SendClientMessageEx(playeridCOLOR_WHITEstring); 
Format
I don't really think thats the problem just typical of identation. I guess the problem could be at your function named TimeConvert
Reply
#5

Quote:
Originally Posted by vassilis
Посмотреть сообщение
Format
I don't really think thats the problem just typical of identation problem with the function you use named TimeConvert i guess!
I'll use an enum var and see if it compiles, one second.
Reply
#6

So
Reply
#7

Quote:
Originally Posted by BornHuman
Посмотреть сообщение
Can you explain why that needs () when this doesn't? Just curious.
Sizeof is an operator, not a function. Both ways of writing (with and without brackets) are correct and it is just a matter of personal preference. I tend to always use the brackets, except when sizeof appears in a function header, because I'm weird like that.

Anyway, in your original code I count three opening brackets and only two closing brackets. The compiler is expecting another parameter (hence, expected comma) because the statement isn't properly closed.
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
Sizeof is an operator, not a function. Both ways of writing (with and without brackets) are correct and it is just a matter of personal preference. I tend to always use the brackets, except when sizeof appears in a function header, because I'm weird like that.

Anyway, in your original code I count three opening brackets and only two closing brackets. The compiler is expecting another parameter (hence, expected comma) because the statement isn't properly closed.
You're a genius. I'm suuuper tired and really mad at myself for not catching that.

Thank you both so much.
Reply
#9

PHP код:
format(stringsizeof string"Wine Time Left: %d."TimeConvert(GetPVarInt(playerid"pPrisonWineTime"))); 
You need 3 ) at the end, not 2.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)