SA-MP Forums Archive
warning 235: public function lacks forward declaration (symbol "settime") - 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: warning 235: public function lacks forward declaration (symbol "settime") (/showthread.php?tid=663568)



warning 235: public function lacks forward declaration (symbol "settime") - Jaua10 - 05.02.2019

solved


Re: warning 235: public function lacks forward declaration (symbol "settime") - Macronix - 05.02.2019

Public functions need to be forwarded, so

pawn Код:
forward settime();
public settime()
{
    new hour,minute,second;
    new string[256];
    gettime(hour,minute,second);
    if (minute <= 9){format(string,25,"%d:0%d:%d",hour,minute,second);}
    else {format(string,25,"%d:%d:%d",hour,minute,second);}
    TextDrawSetString(Clock,string);
    SetWorldTime(hour);
    return 1;
}



Re: warning 235: public function lacks forward declaration (symbol "settime") - Jaua10 - 05.02.2019

thanks alot bro


Re: warning 235: public function lacks forward declaration (symbol "settime") - Kaliber - 05.02.2019

You should write it like this:

PHP код:
forward settime();
public 
settime()
{
    new 
hour,minute,second,string[16];
    
gettime(hour,minute,second),
    
format(string,sizeof(string),"%d:%02d:%02d",hour,minute,second),
    
TextDrawSetString(Clock,string),
    
SetWorldTime(hour);
    return 
1;

Much cleaner Code and there is always a 0 before


Re: warning 235: public function lacks forward declaration (symbol "settime") - Jaua10 - 06.02.2019

Thank you


Re: warning 235: public function lacks forward declaration (symbol "settime") - TheToretto - 06.02.2019

Don't be selfish.