[HELP] Error - 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: [HELP] Error (
/showthread.php?tid=510951)
[HELP] Error -
monster010 - 03.05.2014
Код:
C:\gf.pwn(33002) : warning 209: function "ReturnTime" should return a value
C:\gf.pwn(33003) : error 010: invalid function or declaration
C:\gf.pwn(33005) : error 054: unmatched closing brace ("}")
The Script
pawn Код:
CMD:joinrace(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000, "Please enter a race id to join or type /races");
new raceid = strval(params);
if(raceid > currentraceslot-1) return SendClientMessage(playerid, 0xFF0000, "The race ID you have entered is invalid");
if(RaceInfo[raceid][racejoinable] == false && RaceInfo[raceid][racerunning] == false && InRace[playerid] == -1) OpenRace(raceid);
JoinRace(playerid, raceid);
return 1;
}
The lines of error
Re: [HELP] Error -
Konstantinos - 03.05.2014
It's from the tutorial by [HiC]TheKiller, isn't it? In ReturnTime function, you should return the time in string. Since I can't see anything wrong above, I'll assume there is an extra bracket after ReturnTime function. Re-check the tutorial in case you wrote something wrong by accident.
Re: [HELP] Error -
monster010 - 03.05.2014
Код:
C:\gf.pwn(33347) : warning 209: function "ReturnTime" should return a value
C:\gf.pwn(33348) : error 010: invalid function or declaration
LINES: 33347-33348
pawn Код:
stock ReturnTime(timevariable)
{
new milliseconds = timevariable, seconds, minutes, string[20];
while(milliseconds > 9)
{
seconds ++;
milliseconds = milliseconds - 10;
}
while(seconds > 59)
{
minutes ++;
seconds = seconds - 60;
}
format(string, sizeof(string), "%d:%02d.%03d", minutes, seconds, milliseconds);
}//line 33338
return string;//line 33339
}
Re: [HELP] Error -
Konstantinos - 03.05.2014
There is an extra bracket. Change to:
pawn Код:
stock ReturnTime(timevariable)
{
new milliseconds = timevariable, seconds, minutes, string[20];
while(milliseconds > 9)
{
seconds ++;
milliseconds = milliseconds - 10;
}
while(seconds > 59)
{
minutes ++;
seconds = seconds - 60;
}
format(string, sizeof(string), "%d:%02d.%03d", minutes, seconds, milliseconds);
return string;
}
And I'd suggest you to use unix timestamps for the player's time and then you can easily convert the player's time.
Re: [HELP] Error -
monster010 - 03.05.2014
SOLVED!