Race problem
#6

pawn Код:
function CountDownForAll(times)
{
    new raceid;
    if(times)
    {
        foreach(new i : Player)
        {
            raceid = GetPVarInt(i,"raceID"); // should be global variable not per player
            if(IsPlayerInRaceCheckpoint(i) && (GetVehicleModel(GetPlayerVehicleID(i)) == RaceInfo[raceid][racevehicle]))
            {
                GameTextForPlayer(i, CDTxt[times], 1500, 3);
                PlayerPlaySound(i, 1056, 0, 0, 0);
            }
        }
        SetTimerEx("CountDownForAll",1000,false,"i",times-1);
    }
    else
    {
        new string[512];
        foreach(new i : Player)
        {
            raceid = GetPVarInt(i,"raceID"); // should be global variable not per player
            if(IsPlayerInRaceCheckpoint(i) && (GetVehicleModel(GetPlayerVehicleID(i)) == RaceInfo[raceid][racevehicle]))
            {
                GameTextForPlayer(i, CDTxt[0], 1000, 3);
                PlayerPlaySound(i, 1057, 0, 0, 0);
                SetPlayerRaceCheckpoint(i, 0, RaceInfo[raceid][checkpointx][1], RaceInfo[raceid][checkpointy][1], RaceInfo[raceid][checkpointz][1], RaceInfo[raceid][checkpointx][2], RaceInfo[raceid][checkpointy][2], RaceInfo[raceid][checkpointz][2], CP_SIZE);
                RaceCheckpoint[i] = 2;
                RaceInfo[raceid][originalcount] ++;
                RaceInfo[raceid][racecount] ++;
                //if(RaceInfo[raceid][originalcount] == 0) return 1;
                KillTimer(RaceInfo[raceid][racetimer]);
                RaceInfo[raceid][racetimer] = SetTimerEx("RaceTime", 250, true, "dd", raceid,i); // wrong timer & variable RaceInfo[raceid][racetimer], all racers have 'raceid' the same
                RaceInfo[raceid][racerunning] = true;
                format(string, sizeof(string),"%s~n~Time:%s~n~Checkpoints:%d/%d",RaceInfo[raceid][racename],ReturnTime(RaceInfo[raceid][racetime]),RaceCheckpoint[i]-2,RaceInfo[raceid][cpnum] - 1);
                PlayerTextDrawSetString(i,RaceTextDraw[i][0],string);
                PlayerTextDrawShow(i, RaceTextDraw[i][0]);
                RaceInfo[raceid][raceticktime] = GetTickCount();
            }
            else
            {
                LeaveRace(i, raceid);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Race problem kinda wierd - by kalanerik99 - 06.06.2017, 14:09
Re: Race problem - by Loinal - 06.06.2017, 15:11
Re: Race problem - by JasonRiggs - 06.06.2017, 15:14
Re: Race problem - by kalanerik99 - 06.06.2017, 16:16
Re: Race problem - by kalanerik99 - 07.06.2017, 09:36
Re: Race problem - by Jefff - 07.06.2017, 20:28
Re: Race problem - by kalanerik99 - 07.06.2017, 22:18
Re: Race problem - by Jefff - 07.06.2017, 22:35
Re: Race problem - by kalanerik99 - 07.06.2017, 22:35
Re: Race problem - by Jefff - 07.06.2017, 22:42

Forum Jump:


Users browsing this thread: 1 Guest(s)