SA-MP Forums Archive
error 001: expected token: ",", but found ";" - 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 001: expected token: ",", but found ";" (/showthread.php?tid=490128)



error 001: expected token: ",", but found ";" - Acres - 25.01.2014

hey guys i got 1 error any ideas how to fix this?

Код:
error 001: expected token: ",", but found ";"
Line:
Код:
format(TimeStr,20,"%02d:%02d",(Hour,Min);



Re: error 001: expected token: ",", but found ";" - Dignity - 25.01.2014

Can you give me your full code please?


Re: error 001: expected token: ",", but found ";" - ProjectMan - 25.01.2014

Quote:
Originally Posted by Acres
Посмотреть сообщение
hey guys i got 1 error any ideas how to fix this?

Код:
error 001: expected token: ",", but found ";"
Line:
Код:
format(TimeStr,20,"%02d:%02d",(Hour,Min);
pawn Код:
format(TimeStr,20,"%02d:%02d",Hour,Min);
Btw, why is there "02"?


Re: error 001: expected token: ",", but found ";" - Acres - 25.01.2014

Код:
public UpdateTime()
{
     new Hour,Min,Sec;
     gettime(Hour,Min,Sec);
     new TimeStr[20];
     format(TimeStr,20,"%02d:%02d",(Hour,Min);
     TextDrawSetString(TimeTD,TimeStr);
     return 1;
}



Re: error 001: expected token: ",", but found ";" - Dignity - 25.01.2014

pawn Код:
public UpdateTime()
{
     new Hour,Min,Sec;
     gettime(Hour,Min,Sec);
     new TimeStr[20];
     format(TimeStr,20,"%02d:%02d",Hour,Min);
     TextDrawSetString(TimeTD,TimeStr);
     return 1;
}
You opened your format, but it was never closed. (Because you missed a brace - you needed to add two, see quote). I'm not sure if this is a necessity or not, but I removed the opening brace of Hour,Min, I doubt it is though.

Quote:

format(TimeStr,20,"%02d:%02d",(Hour,Min));




Re: error 001: expected token: ",", but found ";" - $Marco$ - 25.01.2014

I think this will solve it.
format(TimeStr,20,"%02d:%02d",(Hour,Min));


Re: error 001: expected token: ",", but found ";" - FUNExtreme - 25.01.2014

Quote:
Originally Posted by ProjectMan
Посмотреть сообщение
pawn Код:
format(TimeStr,20,"%02d:%02d",Hour,Min);
Btw, why is there "02"?
If you have a number that's less than 2 characters, it'll show up as "01" to "09".
%03d would give "001" and so on.

As for the answer to this thread, it's posted above. Your brackets aren't matching.


Re: error 001: expected token: ",", but found ";" - McBan - 25.01.2014

Код:
public UpdateTime()
{
     new Hour,Min,Sec;
     gettime(Hour,Min,Sec);
     new TimeStr[20];
     format(TimeStr,20,"%02d:%02d",Hour,Min);
     TextDrawSetString(TimeTD,TimeStr);
     return 1;
}