Advertisement
Guest User

Event FS by Richie©

a guest
Apr 22nd, 2012
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 27.44 KB | None | 0 0
  1. /*========================================
  2.         Event Filterscript
  3.             By Richie©
  4.  
  5.     Contains Cage fight and
  6.     Last man standing event.
  7.    
  8.     Here i am supposed to tell
  9.     you to keep the credits, but everyone
  10.     will probably remove so, use it
  11.     however you want, use parts, all of it,
  12.     whatever..
  13. ==========================================*/
  14.  
  15. //=== Includes ===
  16. #include <a_samp>
  17. #include <zcmd>
  18. //=== Defines ===
  19. #define COLOR_RED 0xAA3333AA
  20. #define COLOR_YELLOW 0xFFFF00AA
  21. #define EVENTMENU 6378
  22. #define EVENTCURR 6379
  23. #define EVENTCAGE 6380
  24. //=== Locations ===
  25. new CageFight, CageFightOn;
  26. new CurrentPos, CurrentPosOn;
  27. new EventGoingOn;
  28. //=== Counters ===
  29. new NumCageFighters;
  30. new NumCurrentFighters;
  31. //=== Weapons ===
  32. new Normal, Deagle, M4, Grenades, Chainsaw, SawnOff, Bats, Tec9,
  33.     Sniper, Fists, Molotov, RocketL, FlameThrower, MiniGun, FireExt;
  34. //=== Other ===
  35. new string[128];
  36. new Float:EventLocation[3];
  37. new PlayerAtEvent[MAX_PLAYERS];
  38. new EventInterior;
  39. //=== Forwards ===
  40. forward StartEvent();
  41. forward PrepareEvent();
  42. forward EndEventCheck();
  43. forward GiveEventWeapons(playerid);
  44. forward SendEventMessage(color, Zstring[]);
  45. forward ResetEventSelectedWeps();
  46.  
  47. public OnFilterScriptInit()
  48. {
  49.     print("\n--------------------------------------");
  50.     print(" Event Filterscript by Richie© ");
  51.     print("--------------------------------------\n");
  52.     NumCageFighters = 0;
  53.     NumCurrentFighters = 0;
  54.     CageFight = 0;
  55.     CurrentPos = 0;
  56.     CageFightOn = 0;
  57.     CurrentPosOn = 0;
  58.     EventGoingOn = 0;
  59.     ResetEventSelectedWeps();
  60.     for(new i = 0; i < GetMaxPlayers(); i++) PlayerAtEvent[i] = 0;
  61.     CreateObject(18759, 2736.0537109375, -1765.4870605469, 78.151954650879, 0, 0, 0);// The cage
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerConnect(playerid)
  66. {
  67.     PlayerAtEvent[playerid] = 0;
  68.     return 1;
  69. }
  70.  
  71. public OnPlayerDisconnect(playerid, reason)
  72. {
  73.     if(PlayerAtEvent[playerid] != 0)
  74.     {
  75.         SetTimer("EndEventCheck", 3000, 0);
  76.         if(CageFightOn == 1) NumCageFighters--;
  77.         else if (CurrentPosOn == 1) NumCurrentFighters--;
  78.         format(string,sizeof(string),"[EVENT] Player %s has been eliminated! (Left Server)", pName(playerid));
  79.         SendEventMessage(COLOR_YELLOW, string);
  80.     }
  81.     return 1;
  82. }
  83.  
  84. public OnPlayerDeath(playerid, killerid, reason)
  85. {
  86.     new distance = GetDistanceBetweenPlayers(playerid, killerid);
  87.     if(PlayerAtEvent[playerid] != 0)
  88.     {
  89.         SetTimer("EndEventCheck", 3000, 0);
  90.         if(CageFightOn == 1) NumCageFighters--;
  91.         else if (CurrentPosOn == 1) NumCurrentFighters--;
  92.         PlayerAtEvent[playerid] = 0;
  93.         new gunname[32];
  94.         GetWeaponName(reason,gunname,sizeof(gunname));
  95.         format(string,sizeof(string),"[EVENT] Player %s has been eliminated by %s (%s), distance: %dm.",pName(playerid), pName(killerid) , gunname, distance);
  96.         SendEventMessage(COLOR_YELLOW, string);
  97.     }
  98.     return 1;
  99. }
  100.  
  101. stock GetDistanceBetweenPlayers(playerid, giveplayerid)// for distance in event texts + average killing distance.
  102. {
  103.     new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
  104.     GetPlayerPos(playerid, x1, y1, z1);
  105.     GetPlayerPos(giveplayerid, x2, y2, z2);
  106.     return floatround(floatsqroot(floatpower(floatabs(floatsub(x2,x1)), 2) + floatpower(floatabs(floatsub(y2,y1)),2) + floatpower(floatabs(floatsub(z2,z1)) ,2)));
  107. }
  108.  
  109. public SendEventMessage(color, Zstring[])
  110. {
  111.     for(new i = 0; i < GetMaxPlayers(); i++)
  112.     {
  113.         if(IsPlayerConnected(i))
  114.         {
  115.             if(PlayerAtEvent[i] != 0)
  116.             {
  117.                 SendClientMessage(i, color, string);
  118.             }
  119.         }
  120.     }
  121. }
  122.  
  123. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  124. {
  125.     switch(dialogid)
  126.     {
  127.         case EVENTMENU:
  128.         {
  129.             if(!response)
  130.             {
  131.                 SendClientMessage(playerid, COLOR_RED, "Cancelled.");
  132.                 return 1;
  133.             }
  134.             switch(listitem) // Event Menu
  135.             {
  136.                 case 0: // Cage Fight
  137.                 {
  138.                     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");
  139.                 }
  140.                 case 1: // Current Position
  141.                 {
  142.                     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");
  143.                 }
  144.             }
  145.             return 1;
  146.         }
  147.         case EVENTCAGE: // Cage Fight Weps
  148.         {
  149.             if(!response)
  150.             {
  151.                 SendClientMessage(playerid, COLOR_RED, "Cancelled.");
  152.                 return 1;
  153.             }
  154.             switch(listitem) // Event Menu
  155.             {
  156.                 case 0:
  157.                 {
  158.                     EventGoingOn = 1;
  159.                     Normal = 1;
  160.                     CageFight = 1;
  161.                     SetTimer("PrepareEvent", 1000, 0);
  162.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  163.                     SendClientMessageToAll(COLOR_RED,string);
  164.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  165.                 }
  166.                 case 1:
  167.                 {
  168.                     EventGoingOn = 1;
  169.                     Deagle = 1;
  170.                     CageFight = 1;
  171.                     SetTimer("PrepareEvent", 1000, 0);
  172.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Deagle) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  173.                     SendClientMessageToAll(COLOR_RED,string);
  174.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  175.                 }
  176.                 case 2:
  177.                 {
  178.                     EventGoingOn = 1;
  179.                     M4 = 1;
  180.                     CageFight = 1;
  181.                     SetTimer("PrepareEvent", 1000, 0);
  182.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (M4) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  183.                     SendClientMessageToAll(COLOR_RED,string);
  184.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  185.                 }
  186.                 case 3:
  187.                 {
  188.                     EventGoingOn = 1;
  189.                     Grenades = 1;
  190.                     CageFight = 1;
  191.                     SetTimer("PrepareEvent", 1000, 0);
  192.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Grenades) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  193.                     SendClientMessageToAll(COLOR_RED,string);
  194.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  195.                 }
  196.                 case 4:
  197.                 {
  198.                     EventGoingOn = 1;
  199.                     Chainsaw = 1;
  200.                     CageFight = 1;
  201.                     SetTimer("PrepareEvent", 1000, 0);
  202.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Chainsaw) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  203.                     SendClientMessageToAll(COLOR_RED,string);
  204.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  205.                 }
  206.                 case 5:
  207.                 {
  208.                     EventGoingOn = 1;
  209.                     SawnOff = 1;
  210.                     CageFight = 1;
  211.                     SetTimer("PrepareEvent", 1000, 0);
  212.                     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.");
  213.                     SendClientMessageToAll(COLOR_RED,string);
  214.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1);
  215.                 }
  216.                 case 6:
  217.                 {
  218.                     EventGoingOn = 1;
  219.                     Bats = 1;
  220.                     CageFight = 1;
  221.                     SetTimer("PrepareEvent", 1000, 0);
  222.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Bats) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  223.                     SendClientMessageToAll(COLOR_RED,string);
  224.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  225.                 }
  226.                 case 7:
  227.                 {
  228.                     EventGoingOn = 1;
  229.                     Tec9 = 1;
  230.                     CageFight = 1;
  231.                     SetTimer("PrepareEvent", 1000, 0);
  232.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Tec9) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  233.                     SendClientMessageToAll(COLOR_RED,string);
  234.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  235.                 }
  236.                 case 8:
  237.                 {
  238.                     EventGoingOn = 1;
  239.                     Sniper = 1;
  240.                     CageFight = 1;
  241.                     SetTimer("PrepareEvent", 1000, 0);
  242.                     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.");
  243.                     SendClientMessageToAll(COLOR_RED,string);
  244.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  245.                 }
  246.                 case 9:
  247.                 {
  248.                     EventGoingOn = 1;
  249.                     Fists = 1;
  250.                     CageFight = 1;
  251.                     SetTimer("PrepareEvent", 1000, 0);
  252.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Fists) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  253.                     SendClientMessageToAll(COLOR_RED,string);
  254.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  255.                 }
  256.                 case 10:
  257.                 {
  258.                     EventGoingOn = 1;
  259.                     Molotov = 1;
  260.                     CageFight = 1;
  261.                     SetTimer("PrepareEvent", 1000, 0);
  262.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (Molotovs) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  263.                     SendClientMessageToAll(COLOR_RED,string);
  264.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  265.                 }
  266.                 case 11:
  267.                 {
  268.                     EventGoingOn = 1;
  269.                     RocketL = 1;
  270.                     CageFight = 1;
  271.                     SetTimer("PrepareEvent", 1000, 0);
  272.                     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.");
  273.                     SendClientMessageToAll(COLOR_RED,string);
  274.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  275.                 }
  276.                 case 12:
  277.                 {
  278.                     EventGoingOn = 1;
  279.                     FlameThrower = 1;
  280.                     CageFight = 1;
  281.                     SetTimer("PrepareEvent", 1000, 0);
  282.                     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.");
  283.                     SendClientMessageToAll(COLOR_RED,string);
  284.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  285.                 }
  286.                 case 13:
  287.                 {
  288.                     EventGoingOn = 1;
  289.                     MiniGun = 1;
  290.                     CageFight = 1;
  291.                     SetTimer("PrepareEvent", 1000, 0);
  292.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (MiniGun) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  293.                     SendClientMessageToAll(COLOR_RED,string);
  294.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  295.                 }
  296.                 case 14:
  297.                 {
  298.                     EventGoingOn = 1;
  299.                     FireExt = 1;
  300.                     CageFight = 1;
  301.                     SetTimer("PrepareEvent", 1000, 0);
  302.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Cage Fight (FireExt) is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  303.                     SendClientMessageToAll(COLOR_RED,string);
  304.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  305.                 }
  306.             }
  307.             return 1;
  308.         }
  309.         case EVENTCURR: // Current Pos weps
  310.         {
  311.             if(!response)
  312.             {
  313.                 SendClientMessage(playerid, COLOR_RED, "Cancelled.");
  314.                 return 1;
  315.             }
  316.             switch(listitem) // Event Menu
  317.             {
  318.                 case 0:
  319.                 {
  320.                     EventGoingOn = 1;
  321.                     Normal = 1;
  322.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  323.                     EventInterior = GetPlayerInterior(playerid);
  324.                     CurrentPos = 1;
  325.                     SetTimer("PrepareEvent", 1000, 0);
  326.                     format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} A Last Man Standing is starting in 20 seconds! Use {F42626}/join{FFFFFF} to join the event.");
  327.                     SendClientMessageToAll(COLOR_RED,string);
  328.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  329.                 }
  330.                 case 1:
  331.                 {
  332.                     EventGoingOn = 1;
  333.                     Deagle = 1;
  334.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  335.                     EventInterior = GetPlayerInterior(playerid);
  336.                     CurrentPos = 1;
  337.                     SetTimer("PrepareEvent", 1000, 0);
  338.                     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.");
  339.                     SendClientMessageToAll(COLOR_RED,string);
  340.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  341.                 }
  342.                 case 2:
  343.                 {
  344.                     EventGoingOn = 1;
  345.                     M4 = 1;
  346.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  347.                     EventInterior = GetPlayerInterior(playerid);
  348.                     CurrentPos = 1;
  349.                     SetTimer("PrepareEvent", 1000, 0);
  350.                     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.");
  351.                     SendClientMessageToAll(COLOR_RED,string);
  352.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  353.                 }
  354.                 case 3:
  355.                 {
  356.                     EventGoingOn = 1;
  357.                     Grenades = 1;
  358.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  359.                     EventInterior = GetPlayerInterior(playerid);
  360.                     CurrentPos = 1;
  361.                     SetTimer("PrepareEvent", 1000, 0);
  362.                     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.");
  363.                     SendClientMessageToAll(COLOR_RED,string);
  364.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  365.                 }
  366.                 case 4:
  367.                 {
  368.                     EventGoingOn = 1;
  369.                     Chainsaw = 1;
  370.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  371.                     EventInterior = GetPlayerInterior(playerid);
  372.                     CurrentPos = 1;
  373.                     SetTimer("PrepareEvent", 1000, 0);
  374.                     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.");
  375.                     SendClientMessageToAll(COLOR_RED,string);
  376.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  377.                 }
  378.                 case 5:
  379.                 {
  380.                     EventGoingOn = 1;
  381.                     SawnOff = 1;
  382.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  383.                     EventInterior = GetPlayerInterior(playerid);
  384.                     CurrentPos = 1;
  385.                     SetTimer("PrepareEvent", 1000, 0);
  386.                     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.");
  387.                     SendClientMessageToAll(COLOR_RED,string);
  388.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  389.                 }
  390.                 case 6:
  391.                 {
  392.                     EventGoingOn = 1;
  393.                     Bats = 1;
  394.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  395.                     EventInterior = GetPlayerInterior(playerid);
  396.                     CurrentPos = 1;
  397.                     SetTimer("PrepareEvent", 1000, 0);
  398.                     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.");
  399.                     SendClientMessageToAll(COLOR_RED,string);
  400.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  401.                 }
  402.                 case 7:
  403.                 {
  404.                     EventGoingOn = 1;
  405.                     Tec9 = 1;
  406.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  407.                     EventInterior = GetPlayerInterior(playerid);
  408.                     CurrentPos = 1;
  409.                     SetTimer("PrepareEvent", 1000, 0);
  410.                     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.");
  411.                     SendClientMessageToAll(COLOR_RED,string);
  412.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  413.                 }
  414.                 case 8:
  415.                 {
  416.                     EventGoingOn = 1;
  417.                     Sniper = 1;
  418.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  419.                     EventInterior = GetPlayerInterior(playerid);
  420.                     CurrentPos = 1;
  421.                     SetTimer("PrepareEvent", 1000, 0);
  422.                     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.");
  423.                     SendClientMessageToAll(COLOR_RED,string);
  424.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  425.                 }
  426.                 case 9:
  427.                 {
  428.                     EventGoingOn = 1;
  429.                     Fists = 1;
  430.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  431.                     EventInterior = GetPlayerInterior(playerid);
  432.                     CurrentPos = 1;
  433.                     SetTimer("PrepareEvent", 1000, 0);
  434.                     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.");
  435.                     SendClientMessageToAll(COLOR_RED,string);
  436.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  437.                 }
  438.                 case 10:
  439.                 {
  440.                     EventGoingOn = 1;
  441.                     Molotov = 1;
  442.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  443.                     EventInterior = GetPlayerInterior(playerid);
  444.                     CurrentPos = 1;
  445.                     SetTimer("PrepareEvent", 1000, 0);
  446.                     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.");
  447.                     SendClientMessageToAll(COLOR_RED,string);
  448.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  449.                 }
  450.                 case 11:
  451.                 {
  452.                     EventGoingOn = 1;
  453.                     RocketL = 1;
  454.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  455.                     EventInterior = GetPlayerInterior(playerid);
  456.                     CurrentPos = 1;
  457.                     SetTimer("PrepareEvent", 1000, 0);
  458.                     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.");
  459.                     SendClientMessageToAll(COLOR_RED,string);
  460.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  461.                 }
  462.                 case 12:
  463.                 {
  464.                     EventGoingOn = 1;
  465.                     FlameThrower = 1;
  466.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  467.                     EventInterior = GetPlayerInterior(playerid);
  468.                     CurrentPos = 1;
  469.                     SetTimer("PrepareEvent", 1000, 0);
  470.                     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.");
  471.                     SendClientMessageToAll(COLOR_RED,string);
  472.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  473.                 }
  474.                 case 13:
  475.                 {
  476.                     EventGoingOn = 1;
  477.                     MiniGun = 1;
  478.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  479.                     EventInterior = GetPlayerInterior(playerid);
  480.                     CurrentPos = 1;
  481.                     SetTimer("PrepareEvent", 1000, 0);
  482.                     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.");
  483.                     SendClientMessageToAll(COLOR_RED,string);
  484.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  485.                 }
  486.                 case 14:
  487.                 {
  488.                     EventGoingOn = 1;
  489.                     FireExt = 1;
  490.                     GetPlayerPos(playerid, EventLocation[0],EventLocation[1],EventLocation[2]);
  491.                     EventInterior = GetPlayerInterior(playerid);
  492.                     CurrentPos = 1;
  493.                     SetTimer("PrepareEvent", 1000, 0);
  494.                     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.");
  495.                     SendClientMessageToAll(COLOR_RED,string);
  496.                     GameTextForAll("~y~An event has started! To attend, use: ~r~/join", 5000, 1 );
  497.                 }
  498.             }
  499.             return 1;
  500.         }
  501.     }
  502.     return 0;
  503. }
  504.  
  505. public PrepareEvent()
  506. {
  507.     SetTimer("StartEvent", 20000, 0);
  508.     return 1;
  509. }
  510.  
  511. public StartEvent()
  512. {
  513.     if(NumCageFighters > 1 || NumCurrentFighters > 1)
  514.     {
  515.         SendClientMessageToAll(COLOR_RED,"{E8D04C}[EVENT]{FFFFFF} Event Signups are over.");
  516.        
  517.         if(CageFight == 1) CageFightOn = 1; // To let the server know which event a player is eliminated from
  518.         if(CurrentPos == 1) CurrentPosOn = 1;
  519.        
  520.         CageFight = 0; // TO avoid signups after event is started
  521.         CurrentPos = 0;
  522.         for(new i = 0; i < GetMaxPlayers(); i++)
  523.         {
  524.             if(PlayerAtEvent[i] == 1)
  525.             {
  526.                 TogglePlayerControllable(i,true);
  527.                 GameTextForPlayer(i, "~r~FIGHT!", 6000, 0);
  528.                 PlayerPlaySound(i, 3200, 0, 0, 0);
  529.             }
  530.         }
  531.     }
  532.     else
  533.     {
  534.         for(new i = 0; i < GetMaxPlayers(); i++)
  535.         {
  536.             if(PlayerAtEvent[i] != 0)
  537.             {
  538.                 ResetPlayerWeapons(i);
  539.                 SendClientMessage(i,COLOR_RED,"{E8D04C}[EVENT]{FFFFFF} Event ended due to lack of contenders.");
  540.                 SpawnPlayer(i);
  541.                 PlayerAtEvent[i] = 0;
  542.                 EventGoingOn = 0;
  543.                 CageFight = 0;
  544.                 CurrentPos = 0;
  545.             }
  546.         }
  547.        
  548.     }
  549.     return 1;
  550. }
  551.  
  552. public EndEventCheck()
  553. {
  554.     for(new i = 0; i < GetMaxPlayers(); i++)
  555.     {
  556.         if(PlayerAtEvent[i] == 1)
  557.         {
  558.             if(NumCageFighters == 1)
  559.             {
  560.                 format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} %s has won the Cage Fight.{E8D04C} Price: $10,000!", pName(i));
  561.                 SendClientMessageToAll(COLOR_RED,string);
  562.                 GivePlayerMoney(i, 10000);
  563.                 SpawnPlayer(i);
  564.                 PlayerAtEvent[i] = 0;
  565.                 NumCageFighters = 0;
  566.                 ResetEventSelectedWeps();
  567.                 return 1;
  568.             }
  569.             else if(NumCurrentFighters == 1)
  570.             {
  571.                 format(string,sizeof(string),"{E8D04C}[EVENT]{FFFFFF} %s has won the Last Man Standing.{E8D04C} Price: $10,000!",pName(i));
  572.                 SendClientMessageToAll(COLOR_RED,string);
  573.                 GivePlayerMoney(i, 10000);
  574.                 SpawnPlayer(i);
  575.                 PlayerAtEvent[i] = 0;
  576.                 NumCurrentFighters = 0;
  577.                 ResetEventSelectedWeps();
  578.                 return 1;
  579.             }
  580.         }
  581.     }
  582.     return 1;
  583. }
  584.  
  585. public ResetEventSelectedWeps()
  586. {
  587.     Normal=0;
  588.     Deagle=0;
  589.     M4=0;
  590.     Grenades=0;
  591.     Chainsaw=0;
  592.     SawnOff=0;
  593.     Bats=0;
  594.     Tec9=0;
  595.     Sniper=0;
  596.     Fists=0;
  597.     Molotov=0;
  598.     RocketL=0;
  599.     FlameThrower=0;
  600.     MiniGun=0;
  601.     FireExt=0;
  602.    
  603.     CageFight = 0;
  604.     CurrentPos = 0;
  605.    
  606.     CurrentPosOn = 0;
  607.     CageFightOn = 0;
  608.    
  609.     EventGoingOn = 0;
  610.    
  611.     for(new i = 0; i < GetMaxPlayers(); i++) PlayerAtEvent[i] = 0;
  612. }
  613.  
  614. public GiveEventWeapons(playerid)
  615. {
  616.     if(Normal == 1)
  617.     {
  618.         GivePlayerWeapon(playerid, 24, 500);
  619.         GivePlayerWeapon(playerid, 27, 1500);
  620.         GivePlayerWeapon(playerid, 31, 1500);
  621.         GivePlayerWeapon(playerid, 32, 1500);
  622.         GivePlayerWeapon(playerid, 34, 500);
  623.     }
  624.     if(Deagle == 1)
  625.     {
  626.         GivePlayerWeapon(playerid, 24, 500);
  627.     }
  628.     if(M4 == 1)
  629.     {
  630.         GivePlayerWeapon(playerid, 31, 5000);
  631.     }
  632.     if(Grenades == 1)
  633.     {
  634.         GivePlayerWeapon(playerid, 16, 150);
  635.     }
  636.     if(Chainsaw == 1)
  637.     {
  638.         GivePlayerWeapon(playerid, 9, 1);
  639.     }
  640.     if(SawnOff == 1)
  641.     {
  642.         GivePlayerWeapon(playerid, 26, 2000);
  643.     }
  644.     if(Bats == 1)
  645.     {
  646.         GivePlayerWeapon(playerid, 5, 1);
  647.     }
  648.     if(Tec9 == 1)
  649.     {
  650.         GivePlayerWeapon(playerid, 32, 2000);
  651.     }
  652.     if(Sniper == 1)
  653.     {
  654.         GivePlayerWeapon(playerid, 34, 500);
  655.     }
  656.     if(Fists == 1)
  657.     {
  658.         GivePlayerWeapon(playerid, 0, 0);
  659.     }
  660.     if(Molotov == 1)
  661.     {
  662.         GivePlayerWeapon(playerid, 18, 500);
  663.     }
  664.     if(RocketL == 1)
  665.     {
  666.         GivePlayerWeapon(playerid, 35, 5000);
  667.     }
  668.     if(FlameThrower == 1)
  669.     {
  670.         GivePlayerWeapon(playerid, 37, 9999);
  671.     }
  672.     if(MiniGun == 1)
  673.     {
  674.         GivePlayerWeapon(playerid, 38, 9999);
  675.     }
  676.     if(FireExt == 1)
  677.     {
  678.         GivePlayerWeapon(playerid, 42, 9999);
  679.     }
  680.     return 1;
  681. }
  682.  
  683. //============================ Commands ========================================
  684.  
  685. CMD:event(playerid, params[])
  686. {
  687.     if(IsPlayerAdmin(playerid))
  688.     {
  689.         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.");
  690.         ShowPlayerDialog(playerid, EVENTMENU, DIALOG_STYLE_LIST, "Select Event type", "{42C92D}Cage Fight \n{42C92D}At Your Position", "Select", "Cancel");
  691.     }
  692.     return 1;
  693. }
  694.  
  695. CMD:join(playerid, params[])
  696. {
  697.     if(PlayerAtEvent[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} You are at an event now.");
  698.     {
  699.         //------------------------- Cage Fight----------------------------------
  700.         if(CageFight == 1)
  701.         {
  702.             TogglePlayerControllable(playerid,false);// Freezing the player until Event start
  703.             SetPlayerPos(playerid,2736.0537109375 + (random(3) - random(3)), -1765.4870605469 + (random(3) - random(3)), 79.151954650879);
  704.             SetPlayerVirtualWorld(playerid, 0);
  705.             SetPlayerInterior(playerid, 0);
  706.             SetPlayerHealth(playerid, 100);
  707.             SetPlayerArmour(playerid, 98.0);
  708.             NumCageFighters++;//counter
  709.             ResetPlayerWeapons(playerid);//Reset player weps for preset weps
  710.             GiveEventWeapons(playerid);
  711.             SetCameraBehindPlayer(playerid);
  712.             PlayerAtEvent[playerid] = 1;
  713.             SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} You have joined the Cage Fight.");
  714.             return 1;
  715.         }
  716.         //------------------------- Current Pos --------------------------------
  717.         if(CurrentPos == 1)
  718.         {
  719.             TogglePlayerControllable(playerid,false);// Freezing the player until Event start
  720.             SetPlayerPos(playerid, EventLocation[0] + (random(3) - random(3)),EventLocation[1] + (random(3) - random(3)),EventLocation[2]);
  721.             SetPlayerVirtualWorld(playerid, 0);
  722.             SetPlayerInterior(playerid, EventInterior);
  723.             SetPlayerHealth(playerid, 100);
  724.             SetPlayerArmour(playerid, 98.0);
  725.             NumCurrentFighters++;
  726.             PlayerAtEvent[playerid] = 1;
  727.             ResetPlayerWeapons(playerid);//Reset player weps for preset weps
  728.             GiveEventWeapons(playerid);
  729.             SetCameraBehindPlayer(playerid);
  730.             SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} You have joined the LMS Event.");
  731.             return 1;
  732.         }
  733.         //----------------------------------------------------------------------
  734.         else
  735.         {
  736.             SendClientMessage(playerid, COLOR_RED, "{F42626}[INFO]{FFFFFF} There are no events at the moment.");
  737.             return 1;
  738.         }
  739.     }
  740. }
  741.  
  742. CMD:endevent(playerid, params[])
  743. {
  744.     if(IsPlayerAdmin(playerid))
  745.     {
  746.         CageFight = 0;
  747.         CurrentPos = 0;
  748.        
  749.         CurrentPosOn = 0;
  750.         CageFightOn = 0;
  751.  
  752.         NumCageFighters = 0;
  753.         NumCurrentFighters = 0;
  754.  
  755.         ResetEventSelectedWeps();
  756.  
  757.         format(string, sizeof(string), "{E8D04C}[Event]{FFFFFF} %s has ended the event.",pName(playerid));
  758.         SendClientMessageToAll(COLOR_RED, string);
  759.  
  760.         for(new i = 0; i < GetMaxPlayers(); i++)
  761.         {
  762.             PlayerAtEvent[i] = 0;
  763.         }
  764.     }
  765.     return 1;
  766. }
  767.  
  768. stock pName(playerid)
  769. {
  770.     new Name[MAX_PLAYER_NAME];
  771.     GetPlayerName(playerid, Name, sizeof(Name));
  772.     return Name;
  773. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement