Saving race time not working.
#7

Quote:
Originally Posted by Schneider
Посмотреть сообщение
Ok,
can you show us the piece of code where RaceMinutes/RaceSeconds/RaceMiliSeconds are set when the race is finished?
This is the timer:
pawn Код:
public RaceTimer(playerid)
{
    RaceMiliSeconds[playerid] += 100;
    if(RaceMiliSeconds[playerid] == 1000)
    {
        RaceSeconds[playerid]++;
        RaceMiliSeconds[playerid] = 0;
    }
    if(RaceSeconds[playerid] == 60)
    {
        RaceMinutes[playerid]++;
        RaceSeconds[playerid] = 0;
    }
    new string[16];
    format(string, 16, "%d:%d:%d", RaceMinutes[playerid], RaceSeconds[playerid], RaceMiliSeconds[playerid]);
    TextDrawSetString(Race[playerid], string);
}
And whole code when race ends:
pawn Код:
else if (CP[playerid] == 11)
    {
        new string[70];
        DisablePlayerCheckpoint(playerid);
        SendClientMessage(playerid, -1, "[Mission]: Sultan mission is completed! You get +$1200 ja +2 score!");
        GivePlayerCash(playerid, 1200);
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
        Missioonil[playerid] = 0;
        KillTimer(RaceT[playerid]);
        format(string, sizeof(string),"[Mission]: You ended Sultan missioni. Time:  %d:%d:%d.",RaceMinutes[playerid], RaceSeconds[playerid], RaceMiliSeconds[playerid]);
        SendClientMessage(playerid, -1, string);
        TextDrawHideForPlayer(playerid, Race[playerid]);
        if(RaceMinutes[playerid] >= 1)
        {
            if(RaceSeconds[playerid] < pInfo[playerid][SultanSeconds])
            {
                pInfo[playerid][SultanMiliSeconds] = RaceMiliSeconds[playerid];
                pInfo[playerid][SultanSeconds] = RaceSeconds[playerid];
                pInfo[playerid][SultanMinutes] = RaceMinutes[playerid];
                SavePlayer(playerid);
                format(string, sizeof(string),"[Mission]: This is your new record: %d:%d:%d.",RaceMinutes[playerid], RaceSeconds[playerid], RaceMiliSeconds[playerid]);
                SendClientMessage(playerid, -1, string);
                RaceMinutes[playerid] = 0;
                RaceSeconds[playerid] = 0;
                RaceMiliSeconds[playerid] = 0;
            }
            else
            {
                format(string, sizeof(string),"[Mission]: Your best time is: %d:%d:%d.",pInfo[playerid][SultanMinutes], pInfo[playerid][SultanSeconds], pInfo[playerid][SultanMiliSeconds]);
                SendClientMessage(playerid, -1, string);
                RaceMinutes[playerid] = 0;
                RaceSeconds[playerid] = 0;
                RaceMiliSeconds[playerid] = 0;
            }
        }
        else
        {
            if(RaceSeconds[playerid] < pInfo[playerid][SultanSeconds])
            {
                pInfo[playerid][SultanMiliSeconds] = RaceMiliSeconds[playerid];
                pInfo[playerid][SultanSeconds] = RaceSeconds[playerid];
                pInfo[playerid][SultanMinutes] = RaceMinutes[playerid];
                SavePlayer(playerid);
                format(string, sizeof(string),"[Mission]: This is your new record: %d:%d:%d.",RaceMinutes[playerid], RaceSeconds[playerid], RaceMiliSeconds[playerid]);
                SendClientMessage(playerid, -1, string);
                RaceMinutes[playerid] = 0;
                RaceSeconds[playerid] = 0;
                RaceMiliSeconds[playerid] = 0;
            }
            else
            {
                format(string, sizeof(string),"[Mission]: Your best time is: %d:%d:%d.",pInfo[playerid][SultanMinutes], pInfo[playerid][SultanSeconds], pInfo[playerid][SultanMiliSeconds]);
                SendClientMessage(playerid, -1, string);
                RaceMinutes[playerid] = 0;
                RaceSeconds[playerid] = 0;
                RaceMiliSeconds[playerid] = 0;
            }
        }
    }
Reply


Messages In This Thread
Saving race time not working. - by finelaq - 19.01.2015, 18:54
Re: Saving race time not working. - by Schneider - 19.01.2015, 19:00
Re: Saving race time not working. - by finelaq - 19.01.2015, 19:03
Re: Saving race time not working. - by Schneider - 19.01.2015, 19:05
Re: Saving race time not working. - by finelaq - 19.01.2015, 19:12
Re: Saving race time not working. - by Schneider - 19.01.2015, 19:22
Re: Saving race time not working. - by finelaq - 19.01.2015, 19:27
Re: Saving race time not working. - by Schneider - 19.01.2015, 19:34
Re: Saving race time not working. - by finelaq - 19.01.2015, 19:37
Re: Saving race time not working. - by Schneider - 19.01.2015, 19:39

Forum Jump:


Users browsing this thread: 4 Guest(s)