Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Commands
- CMD:derby(playerid, params[]) {
- if(DerbyStatus == 1) return SCM(playeri, -1, "Derby Inceput!");
- TogglePlayerControllable(playerid, 0);
- SetPlayerVirtualWorld(playerid, 1337);
- SetVehicleVirtualWorld(DerbyEvent[DerbyPlayers], 1337);
- PutPlayerInVehicle(playerid, DerbyEvent[DerbyPlayers], 0);
- DerbyVehicle[playerid] = DerbyEvent[DerbyPlayers];
- DerbyPlayers++;
- InDerby[playerid] = 1;
- new string[128];
- format(string, sizeof(string), "%s a intrat in arena derby!", GetName(playerid));
- SendDerby(COLOR_YELLOW, string);
- return 1;
- }
- SendDerby(color, text[]) {
- foreach(Player, i) {
- if(InDerby[i] == 1) {
- SCM(i, color, text);
- }
- }
- return 1;
- }
- function leave_derby(playerid) {
- SetVehicleVirtualWorld(DerbyVehicle[playerid], 1337);
- SetVehicleToRespawn(DerbyVehicle[playerid]);
- SetPlayerVirtualWorld(playerid, 0);
- SpawnPlayer(playerid);
- InDerby[playereid] = 0;
- DerbyPlayers --;
- DerbyVehicle[playerid] = 0;
- SCM(playerid, -1, "debug");
- return 1;
- }
- if(DerbyStatus == 0) {
- if(DerbyTime > 0) {
- DerbyTime--;
- if(DerbyTime == 0) {
- if(DerbyPlayers < 1) { // < 2
- foreach(Player, i) {
- if(Derby[i] == 1) leave_derby(i), SCM(i, COLOR_YELLOW "Prea putini playeri!");
- }
- DerbyStatus = 0;
- DerbyTime = 30;
- }
- else {
- DerbyStatus = 1;
- DerbyTime = 60;
- SendDerby(COLOR_YELLOW, "Runda a inceput !");
- foreach(Player, i) {
- if(InDerby[i] == 1) TogglePlayerControllable(i, 1);
- }
- }
- }
- }
- }
- if(DerbyStatus == 1) {
- if(DerbyTime > 0) {
- DerbyTime--;
- if(DerbyTime == 0) {
- foreach(Player, i) {
- if(InDerby[i] ==1) leave_derby(i);
- }
- DerbyStatus = 0;
- DerbyTime = 30;
- SendDerby(COLOR_YELLOW, "Nimeni nu a castigat!");
- }
- else {
- if(DerbyPlayers == 0) { // == 1
- foreach(Player, i) {
- if(Derby[i] == 1) leave_derby(i), SCM(i, COLOR_YELLOW "Felicitari! Ai castigat!");
- }
- DerbyStatus = 0;
- DerbyTime = 30;
- }
- }
- }
- }
- if(InDerby[i] == 1) {
- if(DerbyStatus == 1) {
- new Float: Pos[3];
- GetPlayerPos(i, Pos[0], Pos[1], Pos[2]);
- if(Pos[2] < 329.9276) leave_derby(i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement