Advertisement
Guest User

xD

a guest
Sep 5th, 2010
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.10 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define winner_money 10000
  4.  
  5. new CheckPoints[10][3] =
  6. {
  7.     {x,y,z},
  8.     {x,y,z},
  9.     {x,y,z},
  10.     {x,y,z},
  11.     {x,y,z},
  12.     {x,y,z},
  13.     {x,y,z},
  14.     {x,y,z},
  15.     {x,y,z},
  16.     {x,y,z}
  17. };
  18.  
  19. new Player_CheckPoint[MAX_PLAYERS];
  20.  
  21. new bool:IsRaceRunning = false;
  22.  
  23. new WinnerName[MAX_PLAYER_NAME];
  24.  
  25. new stringwin[64];
  26.  
  27. public OnGameModeInit()
  28. {
  29.     for(new i = 0; i < MAX_PLAYERS; i++)
  30.     {
  31.         if(IsPlayerConnected(i))
  32.         {
  33.             Player_CheckPoint[i] = 0;
  34.             SetPlayerRaceCheckpoint(i,0,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);
  35.             IsRaceRunning = true;
  36.         }
  37.     }
  38.     return 1;
  39. }
  40.  
  41. public OnPlayerEnterRaceCheckpoint(playerid)
  42. {
  43.     if(IsRaceRunning == true) { Player_CheckPoint[playerid]++; }
  44.     if(Player_CheckPoint[playerid] < 9 && IsRaceRunning == true)
  45.     {
  46.         DisablePlayerRaceCheckpoint(playerid);
  47.         SetPlayerRaceCheckpoint(playerid,0,CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],CheckPoints[Player_CheckPoint[playerid]+1][0],CheckPoints[Player_CheckPoint[playerid]+1][1],CheckPoints[Player_CheckPoint[playerid]+1][2],9.7);
  48.         return 1;
  49.     }
  50.     if(Player_CheckPoint[playerid] == 9 && IsRaceRunning == true)
  51.     {
  52.         DisablePlayerRaceCheckpoint(playerid);
  53.         SetPlayerRaceCheckpoint(playerid,0,CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],CheckPoints[Player_CheckPoint[playerid]+1][0],CheckPoints[Player_CheckPoint[playerid]+1][1],CheckPoints[Player_CheckPoint[playerid]+1][2],9.7);
  54.         return 1;
  55.     }
  56.     if(Player_CheckPoint[playerid] == 10 && IsRaceRunning == true)
  57.     {
  58.         for(new i = 0; i < MAX_PLAYERS; i++)
  59.         {
  60.             DisablePlayerRaceCheckpoint(i);
  61.         }
  62.         GetPlayerName(playerid,WinnerName,sizeof(WinnerName));
  63.         format(stringwin,sizeof(stringwin),"[RACE] The race is over, %s has won and achieved $%d!",WinnerName,winner_money);
  64.         SendClientMessageToAll(0xFF0000FF,stringwin);
  65.         GivePlayerMoney(playerid,winner_money);
  66.         IsRaceRunning = false;
  67.         return 1;
  68.     }
  69.     return 1;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement