Can't convert time normally..
#1

I'm trying to get ex: 1:28.587 , min: sec.ms

pawn Код:
TimeNX = timestamp - RaceTick;
                ConvertTime(var,TimeNX, rTime[0], rTime[1], rTime[2]);
                if (rTime[1] < 10)format(sSeconds, sizeof(sSeconds), "0%d", rTime[1]);
                else format(sSeconds, sizeof(sSeconds), "%d", rTime[1]);
                if (rTime[2] < 100)format(sMSeconds, sizeof(sMSeconds), "0%d", rTime[2]);
                else format(sMSeconds, sizeof(sMSeconds), "%d", rTime[2]);
                format(string,sizeof(string),"%d:%d.%d",rTime[0],sSeconds,sMSeconds);
SendClientMessage(playerid,COLOR_WHITE,string);
thats the code im trying to use. i Put up a RaceTick=GetTickCount(); when the race starts. on race stop its 0. But it displays not correct time. I putted up additional timer which calculates only seconds and like i get 0:21 with timer, with this it wrote: 0:50:981, i don't even know why ir wrote like that. Can anyone explain to me what do i need to do more?
Reply
#2

I fking give up >,<

pawn Код:
new RTime,timestamp;
    timestamp = GetTickCount();
    if (RaceTick != 0)
        RTime = timestamp - RaceTick;
    else
        RTime=0;

    new Min,Sec,MS;
    ConvertTime2(RTime, Min, Sec, MS);
    gindex=0;
    while (Sec > 9)
    {
    Sec-=10;
    gindex++;
    }
    new str[64];
    if(RaceStarted == 1)
    {
        format(str,sizeof(str),"%02d:%d%d",Min,gindex,Sec);
        for(new i=0; i<MAX_SLOTS; i++)
        {
            if(PlayerI[i][InRace] == 1)
            {
                SendClientMessage(i,COLOR_WHITE,str);
            }
        }
    }
We tried over 30 different solutions the code is from ADRENALINE it self and now all it does it Jumps mostly at 6sec, its like: 1..2...3...4...5...7...8...9...10...11...13 and I DONT KNOW WTF IS WRONG? The code is the same for 30times only with different styles neither any of my friends can understand this, i mean come ooon what the heck could be wrong with this, with adrenaline gamemode it works FINE, i double triple x100000 checked it and copied the code but it DOESN'T WORK!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)