Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PlayerRaceCPs[playerid] = 0; (always set to 0 when starting a race)
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- if(Racer[playerid] == RACER_PLAYING)
- {
- PlayerRaceCPs[playerid]++;
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- SetVehicleHealth(GetPlayerVehicleID(playerid), 1250.0);
- }
- new progress = PlayerRaceCPs[playerid];
- if(progress == TotalRaceCps[CurrentRace])
- {
- DisablePlayerRaceCheckpoint(playerid);
- 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 true;
- }
- else if(progress == TotalRaceCps[CurrentRace] - 1)
- {
- SetPlayerRaceCheckpoint(playerid, 0,
- RaceCheckpoint[CurrentRace][progress][0],
- RaceCheckpoint[CurrentRace][progress][1],
- RaceCheckpoint[CurrentRace][progress][2],
- RaceCheckpoint[CurrentRace][progress + 1][0],
- RaceCheckpoint[CurrentRace][progress + 1][1],
- RaceCheckpoint[CurrentRace][progress + 1][2],
- 15.0);
- return true;
- }
- else
- {
- SetPlayerRaceCheckpoint(playerid, 1,
- RaceCheckpoint[CurrentRace][progress][0],
- RaceCheckpoint[CurrentRace][progress][1],
- RaceCheckpoint[CurrentRace][progress][2],
- RaceCheckpoint[CurrentRace][progress + 1][0],
- RaceCheckpoint[CurrentRace][progress + 1][1],
- RaceCheckpoint[CurrentRace][progress + 1][2],
- return true
- }
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement