public function lacks forward declaration (symbol "settime") -
Sliceofdeath - 16.09.2013
What does this mean ? - E:\games\server\EF Server\gamemodes\EFSERVER.pwn(8817) : warning 235: public function lacks forward declaration (symbol "settime")
Line from 8817 -
pawn Код:
public settime(playerid)
{
new string[256],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
TextDrawSetString(Time, string);
}
Re: public function lacks forward declaration (symbol "settime") -
Dragonsaurus - 16.09.2013
Have you declared:
pawn Код:
forward settime(playerid);
Also you should return 1 at the end of the public function.
Re: public function lacks forward declaration (symbol "settime") -
Sliceofdeath - 16.09.2013
I don't think this is any cmd , This is textdraw of time of RL
Re: public function lacks forward declaration (symbol "settime") -
Konstantinos - 16.09.2013
If it's not used by SetTimer/SetTimerEx or CallRemoteFunction/CallLocalFunction, then use it as a stock. Also few improvements:
pawn Код:
stock settime(playerid)
{
new string[32],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(string, sizeof string, "%02d/%02d/%d", day, month, year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%02d:%02d:%02d", hours, minutes, seconds);
TextDrawSetString(Time, string);
}
Else if it's used by them (those which mentioned before), forward it like Dragonsaurus said.
@Dragonsaurus: It's not necessary to return a value in a callback/function unless it should return something.
Re: public function lacks forward declaration (symbol "settime") -
Sliceofdeath - 16.09.2013
Ty Konstantinos.Now no warnings/no errors
Re: public function lacks forward declaration (symbol "settime") -
Dragonsaurus - 16.09.2013
@Konstantinos: As far as I know, "Public functions should return a value".
Since he used "public settime", he must forward it. But as you said, if not used by timer, stock is ideal for that.
Re: public function lacks forward declaration (symbol "settime") -
Konstantinos - 16.09.2013
Have you noticed in some of the callbacks Wiki shows:
Quote:
This callback does not handle returns.
|
That's because they do not return a value. Like I said, it's not necessary.