Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*========================================
- Event Filterscript
- By Richie©
- Contains Cage fight and
- Last man standing event.
- Here i am supposed to tell
- you to keep the credits, but everyone
- will probably remove so, use it
- however you want, use parts, all of it,
- whatever..
- ==========================================*/
- //=== Includes ===
- #include <a_samp>
- #include <zcmd>
- //=== Defines ===
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define EVENTMENU 6378
- #define EVENTCURR 6379
- #define EVENTCAGE 6380
- //=== Locations ===
- new CageFight, CageFightOn;
- new CurrentPos, CurrentPosOn;
- new EventGoingOn;
- //=== Counters ===
- new NumCageFighters;
- new NumCurrentFighters;
- //=== Weapons ===
- new Normal, Deagle, M4, Grenades, Chainsaw, SawnOff, Bats, Tec9,
- Sniper, Fists, Molotov, RocketL, FlameThrower, MiniGun, FireExt;
- //=== Other ===
- new string[128];
- new Float:EventLocation[3];
- new PlayerAtEvent[MAX_PLAYERS];
- new EventInterior;
- //=== Forwards ===
- forward StartEvent();
- forward PrepareEvent();
- forward EndEventCheck();
- forward GiveEventWeapons(playerid);
- forward SendEventMessage(color, Zstring[]);
- forward ResetEventSelectedWeps();
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Event Filterscript by Richie© ");
- print("--------------------------------------\n");
- NumCageFighters = 0;
- NumCurrentFighters = 0;
- CageFight = 0;
- CurrentPos = 0;
- CageFightOn = 0;
- CurrentPosOn = 0;
- EventGoingOn = 0;
- ResetEventSelectedWeps();
- for(new i = 0; i < GetMaxPlayers(); i++) PlayerAtEvent[i] = 0;
- CreateObject(18759, 2736.0537109375, -1765.4870605469, 78.151954650879, 0, 0, 0);// The cage
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerAtEvent[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(PlayerAtEvent[playerid] != 0)
- {
- SetTimer("EndEventCheck", 3000, 0);
- if(CageFightOn == 1) NumCageFighters--;
- else if (CurrentPosOn == 1) NumCurrentFighters--;
- format(string,sizeof(string),"[EVENT] Player %s has been eliminated! (Left Server)", pName(playerid));
- SendEventMessage(COLOR_YELLOW, string);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new distance = GetDistanceBetweenPlayers(playerid, killerid);
- if(PlayerAtEvent[playerid] != 0)
- {
- SetTimer("EndEventCheck", 3000, 0);
- if(CageFightOn == 1) NumCageFighters--;
- else if (CurrentPosOn == 1) NumCurrentFighters--;
- PlayerAtEvent[playerid] = 0;
- new gunname[32];
- GetWeaponName(reason,gunname,sizeof(gunname));
- format(string,sizeof(string),"[EVENT] Player %s has been eliminated by %s (%s), distance: %dm.",pName(playerid), pName(killerid) , gunname, distance);
- SendEventMessage(COLOR_YELLOW, string);
- }
- return 1;
- }
- stock GetDistanceBetweenPlayers(playerid, giveplayerid)// for distance in event texts + average killing distance.
- {
- new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
- GetPlayerPos(playerid, x1, y1, z1);
- GetPlayerPos(giveplayerid, x2, y2, z2);
- return floatround(floatsqroot(floatpower(floatabs(floatsub(x2,x1)), 2) + floatpower(floatabs(floatsub(y2,y1)),2) + floatpower(floatabs(floatsub(z2,z1)) ,2)));
- }
- public SendEventMessage(color, Zstring[])
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerAtEvent[i] != 0)
- {
- SendClientMessage(i, color, string);
- }
- }
- }
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case EVENTMENU:
- {
- if(!response)
- {
- SendClientMessage(playerid, COLOR_RED, "Cancelled.");
- return 1;
- }
- switch(listitem) // Event Menu
- {
- case 0: // Cage Fight
- {
- ShowPlayerDialog(playerid, EVENTCAGE, DIALOG_STYLE_LIST, "Cage Fight - Weapons", "{42C92D}Normal \n{42C92D}Deagle \n{42C92D}M4 \n{42C92D}Grenades \n{42C92D}Chainsaws \n{42C92D}Sawn Off Shotgun \n{42C92D}Bats \n{42C92D}Tec9 \n{42C92D}Sniper \n{42C92D}Fists \n{42C92D}Molotovs \n{42C92D}Rocket Launcher \n{42C92D}Flame Thrower \n{42C92D}Minigun \n{42C92D}Fire Extinguer", "Start", "Cancel");
- }
- case 1: // Current Position
- {
- ShowPlayerDialog(playerid, EVENTCURR, DIALOG_STYLE_LIST, "Current Pos - Weapons", "{42C92D}Normal \n{42C92D}Deagle \n{42C92D}M4 \n{42C92D}Grenades \n{42C92D}Chainsaws \n{42C92D}Sawn Off Shotgun \n{42C92D}Bats \n{42C92D}Tec9 \n{42C92D}Sniper \n{42C92D}Fists\n{42C92D}Molotovs \n{42C92D}Rocket Launcher \n{42C92D}Flame Thrower \n{42C92D}Minigun \n{42C92D}Fire Extinguer", "Start", "Cancel");
- }
- }
- return 1;
- }
- case EVENTCAGE: // Cage Fight Weps
- {
- if(!response)
- {
- SendClientMessage(playerid, COLOR_RED, "Cancelled.");
- return 1;
- }
- switch(listitem) // Event Menu
- {
- case 0:
- {
- EventGoingOn = 1;
- Normal = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 1:
- {
- EventGoingOn = 1;
- Deagle = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Deagle) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 2:
- {
- EventGoingOn = 1;
- M4 = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (M4) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 3:
- {
- EventGoingOn = 1;
- Grenades = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Grenades) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 4:
- {
- EventGoingOn = 1;
- Chainsaw = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Chainsaw) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 5:
- {
- EventGoingOn = 1;
- SawnOff = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Sawn Off Shotgun) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1);
- }
- case 6:
- {
- EventGoingOn = 1;
- Bats = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Bats) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 7:
- {
- EventGoingOn = 1;
- Tec9 = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Tec9) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 8:
- {
- EventGoingOn = 1;
- Sniper = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Sniper Rifle) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 9:
- {
- EventGoingOn = 1;
- Fists = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Fists) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 10:
- {
- EventGoingOn = 1;
- Molotov = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Molotovs) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 11:
- {
- EventGoingOn = 1;
- RocketL = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Rocket Launcher) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 12:
- {
- EventGoingOn = 1;
- FlameThrower = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Flame Thrower) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 13:
- {
- EventGoingOn = 1;
- MiniGun = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (MiniGun) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 14:
- {
- EventGoingOn = 1;
- FireExt = 1;
- CageFight = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (FireExt) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- }
- return 1;
- }
- case EVENTCURR: // Current Pos weps
- {
- if(!response)
- {
- SendClientMessage(playerid, COLOR_RED, "Cancelled.");
- return 1;
- }
- switch(listitem) // Event Menu
- {
- case 0:
- {
- EventGoingOn = 1;
- Normal = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 1:
- {
- EventGoingOn = 1;
- Deagle = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Deagle) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 2:
- {
- EventGoingOn = 1;
- M4 = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (M4) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 3:
- {
- EventGoingOn = 1;
- Grenades = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Grenades) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 4:
- {
- EventGoingOn = 1;
- Chainsaw = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Chainsaw) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 5:
- {
- EventGoingOn = 1;
- SawnOff = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Sawn Off Shotgun) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 6:
- {
- EventGoingOn = 1;
- Bats = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Bats) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 7:
- {
- EventGoingOn = 1;
- Tec9 = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Tec9) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 8:
- {
- EventGoingOn = 1;
- Sniper = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Sniper Rifle) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 9:
- {
- EventGoingOn = 1;
- Fists = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Fists) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 10:
- {
- EventGoingOn = 1;
- Molotov = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Molotovs) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 11:
- {
- EventGoingOn = 1;
- RocketL = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Rocket Launcher) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 12:
- {
- EventGoingOn = 1;
- FlameThrower = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Flame Thrower) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 13:
- {
- EventGoingOn = 1;
- MiniGun = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Minigun) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- case 14:
- {
- EventGoingOn = 1;
- FireExt = 1;
- GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
- EventInterior = GetPlayerInterior(playerid);
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing (Fire Extinguer) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
- SendClientMessageToAll(COLOR_RED,string);
- GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
- }
- }
- return 1;
- }
- }
- return 0;
- }
- public PrepareEvent()
- {
- SetTimer("StartEvent", 20000, 0);
- return 1;
- }
- public StartEvent()
- {
- if(NumCageFighters > 1 || NumCurrentFighters > 1)
- {
- SendClientMessageToAll(COLOR_RED,"{E8D04C}[EVENT]{FFFFFF} Event Signups are over.");
- if(CageFight == 1) CageFightOn = 1; // To let the server know which event a player is eliminated from
- if(CurrentPos == 1) CurrentPosOn = 1;
- CageFight = 0; // TO avoid signups after event is started
- CurrentPos = 0;
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(PlayerAtEvent[i] == 1)
- {
- TogglePlayerControllable(i,true);
- GameTextForPlayer(i, "~r~FIGHT!", 6000, 0);
- PlayerPlaySound(i, 3200, 0, 0, 0);
- }
- }
- }
- else
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(PlayerAtEvent[i] != 0)
- {
- ResetPlayerWeapons(i);
- SendClientMessage(i,COLOR_RED,"{E8D04C}[EVENT]{FFFFFF} Event ended due to lack of contenders.");
- SpawnPlayer(i);
- PlayerAtEvent[i] = 0;
- EventGoingOn = 0;
- CageFight = 0;
- CurrentPos = 0;
- }
- }
- }
- return 1;
- }
- public EndEventCheck()
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(PlayerAtEvent[i] == 1)
- {
- if(NumCageFighters == 1)
- {
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} %s has won the Cage Fight.{E8D04C} Price: $10,000!", pName(i));
- SendClientMessageToAll(COLOR_RED,string);
- GivePlayerMoney(i, 10000);
- SpawnPlayer(i);
- PlayerAtEvent[i] = 0;
- NumCageFighters = 0;
- ResetEventSelectedWeps();
- return 1;
- }
- else if(NumCurrentFighters == 1)
- {
- format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} %s has won the Last Man Standing.{E8D04C} Price: $10,000!",pName(i));
- SendClientMessageToAll(COLOR_RED,string);
- GivePlayerMoney(i, 10000);
- SpawnPlayer(i);
- PlayerAtEvent[i] = 0;
- NumCurrentFighters = 0;
- ResetEventSelectedWeps();
- return 1;
- }
- }
- }
- return 1;
- }
- public ResetEventSelectedWeps()
- {
- Normal=0;
- Deagle=0;
- M4=0;
- Grenades=0;
- Chainsaw=0;
- SawnOff=0;
- Bats=0;
- Tec9=0;
- Sniper=0;
- Fists=0;
- Molotov=0;
- RocketL=0;
- FlameThrower=0;
- MiniGun=0;
- FireExt=0;
- CageFight = 0;
- CurrentPos = 0;
- CurrentPosOn = 0;
- CageFightOn = 0;
- EventGoingOn = 0;
- for(new i = 0; i < GetMaxPlayers(); i++) PlayerAtEvent[i] = 0;
- }
- public GiveEventWeapons(playerid)
- {
- if(Normal == 1)
- {
- GivePlayerWeapon(playerid, 24, 500);
- GivePlayerWeapon(playerid, 27, 1500);
- GivePlayerWeapon(playerid, 31, 1500);
- GivePlayerWeapon(playerid, 32, 1500);
- GivePlayerWeapon(playerid, 34, 500);
- }
- if(Deagle == 1)
- {
- GivePlayerWeapon(playerid, 24, 500);
- }
- if(M4 == 1)
- {
- GivePlayerWeapon(playerid, 31, 5000);
- }
- if(Grenades == 1)
- {
- GivePlayerWeapon(playerid, 16, 150);
- }
- if(Chainsaw == 1)
- {
- GivePlayerWeapon(playerid, 9, 1);
- }
- if(SawnOff == 1)
- {
- GivePlayerWeapon(playerid, 26, 2000);
- }
- if(Bats == 1)
- {
- GivePlayerWeapon(playerid, 5, 1);
- }
- if(Tec9 == 1)
- {
- GivePlayerWeapon(playerid, 32, 2000);
- }
- if(Sniper == 1)
- {
- GivePlayerWeapon(playerid, 34, 500);
- }
- if(Fists == 1)
- {
- GivePlayerWeapon(playerid, 0, 0);
- }
- if(Molotov == 1)
- {
- GivePlayerWeapon(playerid, 18, 500);
- }
- if(RocketL == 1)
- {
- GivePlayerWeapon(playerid, 35, 5000);
- }
- if(FlameThrower == 1)
- {
- GivePlayerWeapon(playerid, 37, 9999);
- }
- if(MiniGun == 1)
- {
- GivePlayerWeapon(playerid, 38, 9999);
- }
- if(FireExt == 1)
- {
- GivePlayerWeapon(playerid, 42, 9999);
- }
- return 1;
- }
- //============================ Commands ========================================
- CMD:event(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- if(EventGoingOn == 1) return SendClientMessage(playerid, COLOR_RED, "Error: There is an event going on now, if you want to force end it, use: /endevent.");
- ShowPlayerDialog(playerid, EVENTMENU, DIALOG_STYLE_LIST, "Select Event type", "{42C92D}Cage Fight \n{42C92D}At Your Position", "Select", "Cancel");
- }
- return 1;
- }
- CMD:join(playerid, params[])
- {
- if(PlayerAtEvent[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} You are at an event now.");
- {
- //------------------------- Cage Fight----------------------------------
- if(CageFight == 1)
- {
- TogglePlayerControllable(playerid,false);// Freezing the player until Event start
- SetPlayerPos(playerid,2736.0537109375 + (random(3) - random(3)), -1765.4870605469 + (random(3) - random(3)), 79.151954650879);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerInterior(playerid, 0);
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 98.0);
- NumCageFighters++;//counter
- ResetPlayerWeapons(playerid);//Reset player weps for preset weps
- GiveEventWeapons(playerid);
- SetCameraBehindPlayer(playerid);
- PlayerAtEvent[playerid] = 1;
- SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} You have joined the Cage Fight.");
- return 1;
- }
- //------------------------- Current Pos --------------------------------
- if(CurrentPos == 1)
- {
- TogglePlayerControllable(playerid,false);// Freezing the player until Event start
- SetPlayerPos(playerid, EventLocation[0] + (random(3) - random(3)),EventLocation[1] + (random(3) - random(3)),EventLocation[2]);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerInterior(playerid, EventInterior);
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 98.0);
- NumCurrentFighters++;
- PlayerAtEvent[playerid] = 1;
- ResetPlayerWeapons(playerid);//Reset player weps for preset weps
- GiveEventWeapons(playerid);
- SetCameraBehindPlayer(playerid);
- SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} You have joined the LMS Event.");
- return 1;
- }
- //----------------------------------------------------------------------
- else
- {
- SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} There are no events at the moment.");
- return 1;
- }
- }
- }
- CMD:endevent(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- CageFight = 0;
- CurrentPos = 0;
- CurrentPosOn = 0;
- CageFightOn = 0;
- NumCageFighters = 0;
- NumCurrentFighters = 0;
- ResetEventSelectedWeps();
- format(string, sizeof(string), "{E8D04C}[Event]{FFFFFF} %s has ended the event.",pName(playerid));
- SendClientMessageToAll(COLOR_RED, string);
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- PlayerAtEvent[i] = 0;
- }
- }
- return 1;
- }
- stock pName(playerid)
- {
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- return Name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement