Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define winner_money 10000
- new CheckPoints[10][3] =
- {
- {x,y,z},
- {x,y,z},
- {x,y,z},
- {x,y,z},
- {x,y,z},
- {x,y,z},
- {x,y,z},
- {x,y,z},
- {x,y,z},
- {x,y,z}
- };
- new Player_CheckPoint[MAX_PLAYERS];
- new bool:IsRaceRunning = false;
- new WinnerName[MAX_PLAYER_NAME];
- new stringwin[64];
- public OnGameModeInit()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- Player_CheckPoint[i] = 0;
- SetPlayerRaceCheckpoint(i,0,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);
- IsRaceRunning = true;
- }
- }
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- if(IsRaceRunning == true) { Player_CheckPoint[playerid]++; }
- if(Player_CheckPoint[playerid] < 9 && IsRaceRunning == true)
- {
- DisablePlayerRaceCheckpoint(playerid);
- 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);
- return 1;
- }
- if(Player_CheckPoint[playerid] == 9 && IsRaceRunning == true)
- {
- DisablePlayerRaceCheckpoint(playerid);
- 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);
- return 1;
- }
- if(Player_CheckPoint[playerid] == 10 && IsRaceRunning == true)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- DisablePlayerRaceCheckpoint(i);
- }
- GetPlayerName(playerid,WinnerName,sizeof(WinnerName));
- format(stringwin,sizeof(stringwin),"[RACE] The race is over, %s has won and achieved $%d!",WinnerName,winner_money);
- SendClientMessageToAll(0xFF0000FF,stringwin);
- GivePlayerMoney(playerid,winner_money);
- IsRaceRunning = false;
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement