Rei_Ayanami

Fallout event Filterscript

Jul 29th, 2023
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <zcmd>
  3. #define PUTIH 0xFFFFFFFF
  4. stock GetName(otherID)
  5. {
  6.     new nama[MAX_PLAYER_NAME];
  7.     GetPlayerName(otherID, nama, MAX_PLAYER_NAME);
  8.     return nama;
  9. }
  10.  
  11. new glassObject[189], GlassEvent, inEvent[MAX_PLAYERS], eventTimer, destroyTimer, nextglass, timez, blub;
  12.  
  13. public OnFilterScriptInit()
  14. {
  15.     GlassEvent = false;
  16.     destroyTimer = -1;
  17.     timez = 0;
  18.     return 1;
  19. }
  20.  
  21. public OnPlayerConnect(playerid)
  22. {
  23.     inEvent[playerid] = false;
  24.     return 1;
  25. }
  26.  
  27. forward blubglass();
  28. public blubglass()
  29. {
  30.  
  31.     new i = random(6);
  32.     if(i == 1)
  33.         SetObjectRot(glassObject[nextglass], -100.00000, 0.00000, -90.60000);
  34.     if(i == 2)
  35.         SetObjectRot(glassObject[nextglass], -90.00000, 0.00000, -90.60000);
  36.     if(i == 3)
  37.         SetObjectRot(glassObject[nextglass], -75.00000, 0.00000, -90.60000);
  38.     if(i == 4)
  39.         SetObjectRot(glassObject[nextglass], -95.00000, 0.00000, -90.60000);
  40.     else
  41.         SetObjectRot(glassObject[nextglass], -80.00000, 0.00000, -90.60000);
  42. }
  43.  
  44. forward destroyone();
  45. public destroyone()
  46. {
  47.     if(timez > 0)
  48.     {
  49.         timez--;
  50.         if(timez == 7 || timez == 5)
  51.         {
  52.             if(!IsValidObject(glassObject[nextglass]))
  53.                 nextglass = random(62);
  54.         }
  55.         if(timez == 6 || timez == 4)
  56.         {
  57.             if(!IsValidObject(glassObject[nextglass]))
  58.                 nextglass = random(62);
  59.         }
  60.         if(timez == 3)
  61.         {
  62.             blub = SetTimer("blubglass", 250, true);
  63.         }
  64.         if(timez == 1)
  65.         {
  66.             KillTimer(blub);
  67.             if(IsValidObject(glassObject[nextglass]))
  68.                 DestroyObject(glassObject[nextglass]);
  69.             timez = 7;
  70.         }
  71.     }
  72. }
  73.  
  74. forward checkPlay();
  75. public checkPlay()
  76. {  
  77.     new Float:x, Float:y, Float:z;
  78.    
  79.     for(new i = 0; i < MAX_PLAYERS; i++)
  80.     {
  81.         if(IsPlayerConnected(i))
  82.         {
  83.             if (inEvent[i])
  84.             {
  85.                 if (GetPlayerVirtualWorld(i) == 500)
  86.                 {
  87.                     GetPlayerPos(i, x, y, z);
  88.                    
  89.                     if (z < 385.00)
  90.                     {
  91.                         SpawnPlayer(i);
  92.                         inEvent[i] = false;
  93.                         for (new p=0; p<MAX_PLAYERS; p++)
  94.                         {
  95.                             if(inEvent[p])
  96.                             {
  97.                                 new eliminated[100];
  98.                                 format(eliminated, sizeof(eliminated), "{FAAC58}%s(%i) {FFFFFF}was eliminated from the event.", GetName(i), i);
  99.                                 SendClientMessage(p, PUTIH, eliminated);
  100.                             }
  101.                         }                      
  102.                     }
  103.                 }
  104.             }
  105.         }
  106.     }
  107. }
  108.  
  109. stock createGlass()
  110. {
  111.     glassObject[0] = CreateObject(1649, -1740.44092, 845.66888, 428.79611, -90.00000, 0.00000, -90.60000);
  112.     glassObject[1] = CreateObject(1649, -1737.18042, 845.63318, 428.79611, -90.00000, 0.00000, -90.60000);
  113.     glassObject[2] = CreateObject(1649, -1740.48816, 841.32959, 428.79611, -90.00000, 0.00000, -90.60000);
  114.     glassObject[3] = CreateObject(1649, -1737.22803, 841.29327, 428.79611, -90.00000, 0.00000, -90.60000);
  115.     glassObject[4] = CreateObject(1649, -1743.76868, 841.38629, 428.79611, -90.00000, 0.00000, -90.60000);
  116.     glassObject[5] = CreateObject(1649, -1743.70081, 845.68628, 428.79611, -90.00000, 0.00000, -90.60000);
  117.     glassObject[6] = CreateObject(1649, -1743.67358, 850.00671, 428.79611, -90.00000, 0.00000, -90.60000);
  118.     glassObject[7] = CreateObject(1649, -1740.37341, 849.96948, 428.79611, -90.00000, 0.00000, -90.60000);
  119.     glassObject[8] = CreateObject(1649, -1737.11243, 849.93317, 428.79611, -90.00000, 0.00000, -90.60000);
  120.     glassObject[9] = CreateObject(1649, -1733.85181, 849.89679, 428.79611, -90.00000, 0.00000, -90.60000);
  121.     glassObject[10] = CreateObject(1649, -1733.93787, 845.51715, 428.79611, -90.00000, 0.00000, -90.60000);
  122.     glassObject[11] = CreateObject(1649, -1733.96399, 841.24866, 428.79611, -90.00000, 0.00000, -90.60000);
  123.     glassObject[12] = CreateObject(1649, -1730.74585, 841.14685, 428.79611, -90.00000, 0.00000, -90.60000);
  124.     glassObject[13] = CreateObject(1649, -1730.63953, 845.54553, 428.79611, -90.00000, 0.00000, -90.60000);
  125.     glassObject[14] = CreateObject(1649, -1730.59717, 849.84680, 428.79611, -90.00000, 0.00000, -90.60000);
  126.     glassObject[15] = CreateObject(1649, -1743.81250, 837.06433, 428.79611, -90.00000, 0.00000, -90.60000);
  127.     glassObject[16] = CreateObject(1649, -1740.53174, 837.00037, 428.79611, -90.00000, 0.00000, -90.60000);
  128.     glassObject[17] = CreateObject(1649, -1737.23096, 836.97479, 428.79611, -90.00000, 0.00000, -90.60000);
  129.     glassObject[18] = CreateObject(1649, -1734.09045, 836.91614, 428.79611, -90.00000, 0.00000, -90.60000);
  130.     glassObject[19] = CreateObject(1649, -1730.79199, 836.81165, 428.79611, -90.00000, 0.00000, -90.60000);
  131.     glassObject[20] = CreateObject(1649, -1747.12341, 837.09131, 428.79611, -90.00000, 0.00000, -90.60000);
  132.     glassObject[21] = CreateObject(1649, -1747.06689, 841.43445, 428.79611, -90.00000, 0.00000, -90.60000);
  133.     glassObject[22] = CreateObject(1649, -1747.01526, 845.75745, 428.79611, -90.00000, 0.00000, -90.60000);
  134.     glassObject[23] = CreateObject(1649, -1746.95740, 849.99884, 428.79611, -90.00000, 0.00000, -90.60000);
  135.     glassObject[24] = CreateObject(1649, -1730.82996, 832.48993, 428.79611, -90.00000, 0.00000, -90.60000);
  136.     glassObject[25] = CreateObject(1649, -1734.09753, 832.52924, 428.79611, -90.00000, 0.00000, -90.60000);
  137.     glassObject[26] = CreateObject(1649, -1737.34229, 832.58447, 428.79611, -90.00000, 0.00000, -90.60000);
  138.     glassObject[27] = CreateObject(1649, -1740.63342, 832.60742, 428.79611, -90.00000, 0.00000, -90.60000);
  139.     glassObject[28] = CreateObject(1649, -1743.83813, 832.65540, 428.79611, -90.00000, 0.00000, -90.60000);
  140.     glassObject[29] = CreateObject(1649, -1747.13342, 832.65881, 428.79611, -90.00000, 0.00000, -90.60000);
  141.     glassObject[30] = CreateObject(1649, -1750.43262, 832.73029, 428.79611, -90.00000, 0.00000, -90.60000);
  142.     glassObject[31] = CreateObject(1649, -1750.41174, 837.09027, 428.79611, -90.00000, 0.00000, -90.60000);
  143.     glassObject[32] = CreateObject(1649, -1750.32996, 841.42944, 428.79611, -90.00000, 0.00000, -90.60000);
  144.     glassObject[33] = CreateObject(1649, -1750.28845, 845.78906, 428.79611, -90.00000, 0.00000, -90.60000);
  145.     glassObject[34] = CreateObject(1649, -1750.24622, 850.10901, 428.79611, -90.00000, 0.00000, -90.60000);
  146.     glassObject[35] = CreateObject(1649, -1730.54651, 854.22644, 428.79611, -90.00000, 0.00000, -90.60000);
  147.     glassObject[36] = CreateObject(1649, -1733.78687, 854.29486, 428.79611, -90.00000, 0.00000, -90.60000);
  148.     glassObject[37] = CreateObject(1649, -1737.08728, 854.30304, 428.79611, -90.00000, 0.00000, -90.60000);
  149.     glassObject[38] = CreateObject(1649, -1740.26367, 854.29370, 428.79611, -90.00000, 0.00000, -90.60000);
  150.     glassObject[39] = CreateObject(1649, -1743.52954, 854.32788, 428.79611, -90.00000, 0.00000, -90.60000);
  151.     glassObject[40] = CreateObject(1649, -1746.84167, 854.36127, 428.79611, -90.00000, 0.00000, -90.60000);
  152.     glassObject[41] = CreateObject(1649, -1750.14624, 854.45685, 428.79611, -90.00000, 0.00000, -90.60000);
  153.     glassObject[42] = CreateObject(1649, -1753.71252, 832.77502, 428.79611, -90.00000, 0.00000, -90.60000);
  154.     glassObject[43] = CreateObject(1649, -1753.56506, 837.16809, 428.79611, -90.00000, 0.00000, -90.60000);
  155.     glassObject[44] = CreateObject(1649, -1753.59863, 841.46564, 428.79611, -90.00000, 0.00000, -90.60000);
  156.     glassObject[45] = CreateObject(1649, -1753.53516, 845.80377, 428.79611, -90.00000, 0.00000, -90.60000);
  157.     glassObject[46] = CreateObject(1649, -1753.46643, 850.09772, 428.79611, -90.00000, 0.00000, -90.60000);
  158.     glassObject[47] = CreateObject(1649, -1753.44092, 854.44940, 428.79611, -90.00000, 0.00000, -90.60000);
  159.     glassObject[48] = CreateObject(1649, -1730.49390, 858.64581, 428.79611, -90.00000, 0.00000, -90.60000);
  160.     glassObject[49] = CreateObject(1649, -1733.77344, 858.66431, 428.79611, -90.00000, 0.00000, -90.60000);
  161.     glassObject[50] = CreateObject(1649, -1737.05298, 858.68329, 428.79611, -90.00000, 0.00000, -90.60000);
  162.     glassObject[51] = CreateObject(1649, -1740.31287, 858.70197, 428.79611, -90.00000, 0.00000, -90.60000);
  163.     glassObject[52] = CreateObject(1649, -1743.45178, 858.75903, 428.79611, -90.00000, 0.00000, -90.60000);
  164.     glassObject[53] = CreateObject(1649, -1746.75024, 858.76831, 428.79611, -90.00000, 0.00000, -90.60000);
  165.     glassObject[54] = CreateObject(1649, -1750.05212, 858.79803, 428.79611, -90.00000, 0.00000, -90.60000);
  166.     glassObject[55] = CreateObject(1649, -1753.37537, 858.88470, 428.79611, -90.00000, 0.00000, -90.60000);
  167.     glassObject[56] = CreateObject(1649, -1756.61438, 858.90198, 428.79611, -90.00000, 0.00000, -90.60000);
  168.     glassObject[57] = CreateObject(1649, -1756.71008, 854.54590, 428.79611, -90.00000, 0.00000, -90.60000);
  169.     glassObject[58] = CreateObject(1649, -1756.71973, 850.21057, 428.79611, -90.00000, 0.00000, -90.60000);
  170.     glassObject[59] = CreateObject(1649, -1756.76819, 845.92291, 428.79611, -90.00000, 0.00000, -90.60000);
  171.     glassObject[60] = CreateObject(1649, -1756.84387, 841.63708, 428.79611, -90.00000, 0.00000, -90.60000);
  172.     glassObject[61] = CreateObject(1649, -1756.79749, 837.29614, 428.79611, -90.00000, 0.00000, -90.60000);
  173.     glassObject[62] = CreateObject(1649, -1756.81995, 832.97583, 428.79611, -90.00000, 0.00000, -90.60000);
  174. }
  175.  
  176. stock destroyGlass()
  177. {
  178.     for(new i = 0; i < 63; i++)
  179.     {
  180.         if(IsValidObject(glassObject[nextglass])) DestroyObject(glassObject[nextglass]);
  181.     }
  182.     KillTimer(eventTimer);
  183.     KillTimer(destroyTimer);
  184. }
  185.  
  186. COMMAND:toggleevent(playerid, params[])
  187. {
  188.     if(IsPlayerAdmin(playerid))
  189.     {
  190.         if (GlassEvent)
  191.         {
  192.             GlassEvent = 0;
  193.             SendClientMessageToAll(PUTIH, "{B7B7B7}[EVENT CLOSED] {FFFFFF}An administrator has closed the fallout event.");
  194.         }
  195.         else
  196.         {
  197.             destroyGlass();
  198.             createGlass();
  199.                    
  200.             GlassEvent = 1;
  201.            
  202.             SendClientMessageToAll(PUTIH, "{B7B7B7}[EVENT OPENED] {FFFFFF}An administrator has started a fallout event! Type {FFDC2E}/joinevent{FFFFFF} to participate.");
  203.         }
  204.     }
  205.     else
  206.     {
  207.         return 0;
  208.     }      
  209.     return 1;
  210. }
  211.  
  212. COMMAND:startevent(playerid, params[])
  213. {
  214.     if(IsPlayerAdmin(playerid))
  215.     {
  216.         for(new i = 0; i < MAX_PLAYERS; i++)
  217.         {
  218.             if(IsPlayerConnected(i))
  219.             {
  220.                 if (inEvent[nextglass])
  221.                 {  
  222.                     TogglePlayerControllable(i, 1);
  223.                     GameTextForPlayer(i, "FALLOUT EVENT STARTED!", 5000, 5);
  224.                    
  225.                     eventTimer = SetTimer("checkPlay", 3000, true);
  226.                     destroyTimer = SetTimer("destroyone", 1000, true);
  227.                     timez = 10;
  228.                     nextglass = random(62);
  229.                 }
  230.             }
  231.         }
  232.     }
  233.     else
  234.     {
  235.         return 0;
  236.     }
  237.     return 1;
  238. }
  239.  
  240. COMMAND:destroyevent(playerid, params[])
  241. {
  242.     if(IsPlayerConnected(playerid))
  243.     {
  244.         if(IsPlayerAdmin(playerid))
  245.         {
  246.             destroyGlass();
  247.            
  248.             SendClientMessage(playerid, PUTIH, "{B7B7B7}[SERVER] {FFFFFF}Glass destroyed.");
  249.         }
  250.         else
  251.         {
  252.             return 0;
  253.         }
  254.     }
  255.     else
  256.     {
  257.         SendClientMessage(playerid, PUTIH, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
  258.     }
  259.        
  260.     return 1;
  261. }
  262.  
  263. COMMAND:joinevent(playerid, params[])
  264. {
  265.     if(IsPlayerConnected(playerid))
  266.     {
  267.         if (!inEvent[playerid])
  268.         {
  269.             if (GlassEvent)
  270.             {
  271.                 new randSpawn = random(16);
  272.                 switch(randSpawn)
  273.                 {
  274.                     case 0:
  275.                     {
  276.                         SetPlayerPos(playerid, -1756.6765, 833.0526, 429.7961);
  277.                     }
  278.                     case 1:
  279.                     {
  280.                         SetPlayerPos(playerid, -1756.7405, 841.5081, 429.7961);
  281.                     }
  282.                     case 2:
  283.                     {
  284.                         SetPlayerPos(playerid, -1756.7408, 850.0634, 429.7961);
  285.                     }
  286.                     case 3:
  287.                     {
  288.                         SetPlayerPos(playerid, -1756.7194, 858.9014, 429.7961);
  289.                     }
  290.                     case 4:
  291.                     {
  292.                         SetPlayerPos(playerid, -1750.2263, 859.0184, 429.7961);
  293.                     }
  294.                     case 5:
  295.                     {
  296.                         SetPlayerPos(playerid, -1743.9375, 859.0184, 429.7961);
  297.                     }
  298.                     case 6:
  299.                     {
  300.                         SetPlayerPos(playerid, -1736.6906, 859.0184, 429.7961);
  301.                     }
  302.                     case 7:
  303.                     {
  304.                         SetPlayerPos(playerid, -1730.7318, 859.0184, 429.7961);
  305.                     }
  306.                     case 8:
  307.                     {
  308.                         SetPlayerPos(playerid, -1730.4872, 850.3536, 429.7961);
  309.                     }
  310.                     case 9:
  311.                     {
  312.                         SetPlayerPos(playerid, -1730.5259, 841.1364, 429.7961);
  313.                     }
  314.                     case 10:
  315.                     {
  316.                         SetPlayerPos(playerid, -1730.6837, 832.7377, 429.7961);
  317.                     }
  318.                     case 11:
  319.                     {
  320.                         SetPlayerPos(playerid, -1736.8262, 832.4484, 429.7961);
  321.                     }
  322.                     case 12:
  323.                     {
  324.                         SetPlayerPos(playerid, -1744.0161, 832.5099, 429.7961);
  325.                     }
  326.                     case 13:
  327.                     {
  328.                         SetPlayerPos(playerid, -1749.9906, 832.5613, 429.7961);
  329.                     }
  330.                     case 14:
  331.                     {
  332.                         SetPlayerPos(playerid, -1750.1062, 840.8447, 429.7961);
  333.                     }
  334.                     case 15:
  335.                     {
  336.                         SetPlayerPos(playerid, -1750.0922, 849.1535, 429.7961);
  337.                     }
  338.                     case 16:
  339.                     {
  340.                         SetPlayerPos(playerid, -1744.1351, 849.7830, 429.7961);
  341.                     }
  342.                     case 17:
  343.                     {
  344.                         SetPlayerPos(playerid, -1743.6621, 842.0274, 429.7961);
  345.                     }
  346.                     case 18:
  347.                     {
  348.                         SetPlayerPos(playerid, -1737.4501, 841.3073, 429.7961);
  349.                     }
  350.                     case 19:
  351.                     {
  352.                         SetPlayerPos(playerid, -1737.0245, 849.3864, 429.7961);
  353.                     }
  354.                 }
  355.                
  356.                 SetPlayerTeam(playerid, NO_TEAM);
  357.                
  358.                 SetPlayerVirtualWorld(playerid, 500);
  359.                
  360.                 inEvent[playerid] = true;
  361.                 TogglePlayerControllable(playerid, 0);
  362.                
  363.                 SetPlayerArmour(playerid, 0);
  364.                 SetPlayerHealth(playerid, 999999);
  365.                
  366.                 ResetPlayerWeapons(playerid);
  367.                
  368.                 GameTextForPlayer(playerid, "THE EVENT WILL START SHORTLY!~n~~r~You are temporarily frozen", 10000, 5);
  369.             }
  370.             else
  371.             {
  372.                 SendClientMessage(playerid, PUTIH, "{B7B7B7}[SERVER] {FFFFFF}There is no fallout event open right now.");
  373.             }
  374.         }
  375.         else
  376.         {
  377.             SendClientMessage(playerid, PUTIH, "{B7B7B7}[SERVER] {FFFFFF}You cannot join event.");
  378.         }
  379.     }
  380.     else
  381.     {
  382.         SendClientMessage(playerid, PUTIH, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
  383.     }
  384.    
  385.     return 1;
  386. }
Add Comment
Please, Sign In to add comment