[HELP] Error
#1

Код:
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
pawn Код:
return 1;
}
Reply
#2

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.
Reply
#3

Код:
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
}
Reply
#4

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.
Reply
#5

SOLVED!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)