Guest User

Untitled

a guest
Feb 9th, 2012
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.57 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. main() {}
  4.  
  5. new curCP[MAX_PLAYERS];
  6.  
  7. /* ===[CONFIG]=== */
  8. #define CP_TYPE 0 // The type of checkpoint
  9. #define CP_TYPE_FINISH 1 // The type of checkpoint for the finishline
  10. #define CP_SIZE 5.0 // Float - The radius of the checkpoints
  11.  
  12. enum E_CP_DATA
  13. {
  14.     Float:cp_x,
  15.     Float:cp_y,
  16.     Float:cp_z
  17. }
  18.  
  19. new cpData[][E_CP_DATA] = {
  20. {0.0, 0.0, 3.0}, // CP 1
  21. {10.0, 0.0, 3.0}, // CP 2
  22. {20.0, 0.0, 3.0}, // CP 3
  23. {30.0, 0.0, 3.0}, // CP 4
  24. {40.0, 0.0, 3.0} // CP 5 [FINISH]
  25. };
  26.  
  27. stock StartRace(playerid)
  28. {
  29.     // To start the 'race'
  30.     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);
  31.     return 1;
  32. }
  33.  
  34. public OnPlayerEnterRaceCheckpoint(playerid)
  35. {
  36.     curCP[playerid]++;
  37.     if(curCP[playerid] == sizeof(cpData)) // Entered last CP
  38.     {
  39.         SendClientMessage(playerid, -1, "FINISHED RACE");
  40.         DisablePlayerRaceCheckpoint(playerid);
  41.     }
  42.     else // Show next CP
  43.     {
  44.         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);
  45.         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);
  46.     }
  47. }
  48.  
  49. public OnGameModeInit()
  50. {
  51.     AddPlayerClass(0, 55, 55, 10, 0, 0, 0, 0, 0, 0, 0);
  52. }
  53.  
  54. public OnPlayerSpawn(playerid) StartRace(playerid);
Advertisement
Add Comment
Please, Sign In to add comment