Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- main() {}
- new curCP[MAX_PLAYERS];
- /* ===[CONFIG]=== */
- #define CP_TYPE 0 // The type of checkpoint
- #define CP_TYPE_FINISH 1 // The type of checkpoint for the finishline
- #define CP_SIZE 5.0 // Float - The radius of the checkpoints
- enum E_CP_DATA
- {
- Float:cp_x,
- Float:cp_y,
- Float:cp_z
- }
- new cpData[][E_CP_DATA] = {
- {0.0, 0.0, 3.0}, // CP 1
- {10.0, 0.0, 3.0}, // CP 2
- {20.0, 0.0, 3.0}, // CP 3
- {30.0, 0.0, 3.0}, // CP 4
- {40.0, 0.0, 3.0} // CP 5 [FINISH]
- };
- stock StartRace(playerid)
- {
- // To start the 'race'
- SetPlayerRaceCheckpoint(playerid, CP_TYPE, cpData[0][cp_x], cpData[0][cp_y], cpData[0][cp_z], cpData[1][cp_x], cpData[1][cp_y], cpData[1][cp_z], CP_SIZE);
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- curCP[playerid]++;
- if(curCP[playerid] == sizeof(cpData)) // Entered last CP
- {
- SendClientMessage(playerid, -1, "FINISHED RACE");
- DisablePlayerRaceCheckpoint(playerid);
- }
- else // Show next CP
- {
- if(curCP[playerid] == sizeof(cpData)-1) SetPlayerRaceCheckpoint(playerid, CP_TYPE_FINISH, cpData[curCP[playerid]][cp_x], cpData[curCP[playerid]][cp_y], cpData[curCP[playerid]][cp_z], 0, 0, 0, CP_SIZE);
- else SetPlayerRaceCheckpoint(playerid, CP_TYPE, cpData[curCP[playerid]][cp_x], cpData[curCP[playerid]][cp_y], cpData[curCP[playerid]][cp_z], cpData[curCP[playerid]+1][cp_x], cpData[curCP[playerid]+1][cp_y], cpData[curCP[playerid]+1][cp_z], CP_SIZE);
- }
- }
- public OnGameModeInit()
- {
- AddPlayerClass(0, 55, 55, 10, 0, 0, 0, 0, 0, 0, 0);
- }
- public OnPlayerSpawn(playerid) StartRace(playerid);
Advertisement
Add Comment
Please, Sign In to add comment