17.03.2012, 12:56
Hello,i have race system,it works fine,but one problem is then i want to finish.All checkpoints work fine (disable),but finish checkpoint not disable and i can't to finish.Maybe someone knows what can be wrong?
Код:
public OnPlayerEnterRaceCheckpoint(playerid) { if(Racer[playerid] == RACER_PLAYING) { if((PlayerRaceCPs[playerid] != 0) && (PlayerRaceCPs[playerid] != TotalRaceCps[CurrentRace]-2) && (PlayerRaceCPs[playerid] != TotalRaceCps[CurrentRace]-1)) { SetPlayerRaceCheckpoint(playerid, 0, RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+1][0], RaceCheckpoint[CurrentRace][PlayerRaceCPs [playerid]+1][1], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+1][2], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+2][0], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+2][1], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+2][2], 15.0); PlayerRaceCPs[playerid]++; } else if(PlayerRaceCPs[playerid] == TotalRaceCps[CurrentRace]-2) { SetPlayerRaceCheckpoint(playerid, 1, RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+1][0], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+1][1], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+1][2], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+2][0], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+2][1], RaceCheckpoint[CurrentRace][PlayerRaceCPs[playerid]+2][2], 15.0); PlayerRaceCPs[playerid]++; } else if (IsPlayerInAnyVehicle(playerid)) { new VehicleID = GetPlayerVehicleID(playerid); SetVehicleHealth(VehicleID,1250.0); } else if(PlayerRaceCPs[playerid] == TotalRaceCps[CurrentRace]-1) { SendClientMessage(playerid, COLOR_GREEN, "Tu pasiekei finisa"); Racer[playerid] = RACER_NONE; PlayerRaceCPs[playerid] = 0; if(RaceCar == -1) { SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0); } else { RemovePlayerFromVehicle(playerid); DestroyVehicle(PlayerRaceCar[playerid]); SpawnPlayer(playerid); } SetPlayerVirtualWorld(playerid, 0); DisablePlayerRaceCheckpoint(playerid); new string[128], name[24]; GetPlayerName(playerid, name, 24); Finished++; format(string, 128, "~n~~n~~n~~n~~n~~n~~n~~n~~r~%s ~g~lenktynлse uюлme: ~r~%d ~g~vietа", name, Finished); GameTextForAll(string, 2000, 3); if(Finished == 1) { GivePlayerMoney(playerid, RaceFond); } new players = GetPlayersPLAYING(); if(players == 0) EndRace(); } return 1; } return 1; }