Approved Round End Control

Plug-ins compatibility with Zombie Escape 1.x only!


Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

Round End Control

#1

Post by Raheem » 4 years ago

Round End Control
Description:
  • After humans escaped, it's assumed that all zombies must die and the round end. Sometimes some zombies not dead, and they delay next round. This plugin will give zombies change for x seconds to infect all humans, if they fail they will be slayed and round end.
Cvars:
  • auto_slay_delay_control 60 Time after it the zombies will be slayed.
  • hud_enable_autoslay 1 Enable DHUD countdown for zombies.
NOTES:
  • Report any map that the plugin does not work correctly in it, so it can be fixed.
Download:
Last edited by Raheem 3 years ago, edited 3 times in total.
Reason: More security.
He who fails to plan is planning to fail

User avatar
th3_king
VIP
VIP
Egypt
Posts: 35
Joined: 6 years ago
Location: Egypt
Contact:

#2

Post by th3_king » 4 years ago

Good Job! :D

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#3

Post by Muhammet20 » 4 years ago

Raheem wrote: 4 years ago
Round End Control
Description:
  • After humans escaped, it's assumed that all zombies must die and the round end. Sometimes some zombies not dead, and they delay next round. This plugin will give zombies change for x seconds to infect all humans, if they fail they will be slayed and round end.
Cvars:
  • auto_slay_delay_control 90 Time after it the zombies will be slayed.
  • hud_enable_autoslay 1 Enable DHUD countdown for zombies.

Code:
    1. /*
    2. *   This will hook the trigger_hurt when it's activated.
    3. *   What i know is that trigger_hurt can be activated via button or trigger_multiple
    4. *   This method is good for maps that conatin trains..etc
    5. *   Also we will hook which using trigger_multiple only
    6. *
    7. *   If user is touching the train and this player touched trigger_multiple then the trigger_hurt will be called.
    8. *   In fact the trigger_hurt will be called once trigger_multiple is touched by player but we will tie it with train also. Away to avoid hardcode every map.
    9. */
    10.  
    11. #include "zombie_escape.inc"
    12.  
    13. #define MIN_DAMAGE 9000
    14.  
    15. // Add all moving entities
    16. new const g_szEntities[][] =
    17. {
    18.     "func_tracktrain",
    19.     "func_vehicle"
    20. }
    21.  
    22. new Float:g_flLastTouched[33], bool:g_bCalled, g_iTriggerHurtForward, g_szMapName[32]
    23.  
    24. public plugin_init()
    25. {
    26.     register_plugin("Hook Trigger Hurt", "1.0", "Raheem")
    27.  
    28.     for(new iEnt = 0; iEnt <= charsmax(g_szEntities); iEnt++)
    29.     {
    30.         RegisterHam(Ham_Touch, g_szEntities[iEnt], "Fw_TouchMoving_Pre", 0)
    31.     }
    32.    
    33.     RegisterHam(Ham_Touch, "trigger_multiple", "Fw_TouchTriggerMultiple_Pre", 0)
    34.    
    35.     // Here we register touching any trigger_hurt
    36.     RegisterHam(Ham_Touch, "trigger_hurt", "Fw_TouchTrigger_Pre", 0)
    37.    
    38.     g_iTriggerHurtForward = CreateMultiForward("ze_trigger_hurt", ET_IGNORE)
    39.    
    40.     // Get map name
    41.     get_mapname(g_szMapName, charsmax(g_szMapName))
    42. }
    43.  
    44. public ze_game_started()
    45. {
    46.     g_bCalled = false
    47. }
    48.  
    49. public Fw_TouchTriggerMultiple_Pre(iEnt, id)
    50. {
    51.     // ze_military_v1 only use normal trigger hurt calling
    52.     if (equal(g_szMapName, "ze_military_v1"))
    53.         return
    54.    
    55.     // Here player touching trigger_multiple
    56.     // Let's check first if he is touching also the train or not
    57.     if (TouchingMovingVehicle(id))
    58.     {
    59.         if (equal(g_szMapName, "ze_metropolitano_lg"))
    60.         {
    61.             new szModel[32]
    62.             get_entvar(iEnt, EntVars:var_model, szModel, charsmax(szModel))
    63.            
    64.             if (equal(szModel, "*44"))
    65.             {
    66.                 if (!g_bCalled)
    67.                 {
    68.                     ExecuteForward(g_iTriggerHurtForward)
    69.                     g_bCalled = true
    70.                 }
    71.             }
    72.            
    73.             return
    74.         }
    75.        
    76.         if (equal(g_szMapName, "ze_black_train_v1"))
    77.         {
    78.             new szModel[32]
    79.             pev(iEnt, pev_model, szModel, charsmax(szModel))
    80.             //get_entvar(iEnt, EntVars:var_model, szModel, charsmax(szModel))
    81.            
    82.             if (equal(szModel, "*34"))
    83.             {
    84.                 if (!g_bCalled)
    85.                 {
    86.                     ExecuteForward(g_iTriggerHurtForward)
    87.                     g_bCalled = true
    88.                 }
    89.             }
    90.            
    91.              return
    92.         }
    93.        
    94.         // Player in vehicle and he touched trigger_multiple
    95.         if (!g_bCalled)
    96.         {
    97.             // Here we execute our forward
    98.             ExecuteForward(g_iTriggerHurtForward)
    99.             g_bCalled = true
    100.         }
    101.     }
    102. }
    103.  
    104. public Fw_TouchTrigger_Pre(iEnt, id)
    105. {
    106.     if (!is_user_alive(id) || !pev_valid(iEnt))
    107.         return HAM_IGNORED
    108.    
    109.     if (equal(g_szMapName, "ze_black_train_v1"))
    110.         return HAM_IGNORED
    111.    
    112.     if (pev(iEnt, pev_dmg) > MIN_DAMAGE)
    113.     {
    114.         if (!g_bCalled)
    115.         {
    116.             ExecuteForward(g_iTriggerHurtForward)
    117.             g_bCalled = true
    118.         }
    119.     }
    120.  
    121.     return HAM_IGNORED
    122. }
    123.  
    124. public Fw_TouchMoving_Pre(iEnt, id)
    125. {
    126.     if (!is_user_connected(id))
    127.         return HAM_IGNORED;
    128.    
    129.     // ze_jurassicpark_v2 map
    130.     if (equal(g_szMapName, "ze_jurassicpark_v2"))
    131.     {
    132.         new szModel[32]
    133.         get_entvar(iEnt, EntVars:var_model, szModel, charsmax(szModel))
    134.        
    135.         if (equal(szModel, "*51"))
    136.         {
    137.             return HAM_IGNORED;
    138.         }
    139.     }
    140.    
    141.     // ze_egyptopark map
    142.     if (equal(g_szMapName, "ze_egyptopark"))
    143.     {
    144.         new szModel[32]
    145.         get_entvar(iEnt, EntVars:var_model, szModel, charsmax(szModel))
    146.        
    147.         if (equal(szModel, "*30"))
    148.         {
    149.             return HAM_IGNORED;
    150.         }
    151.     }
    152.    
    153.     g_flLastTouched[id] = get_gametime()
    154.    
    155.     return HAM_IGNORED;
    156. }
    157.  
    158. stock TouchingMovingVehicle(id)
    159. {
    160.     if (!is_user_alive(id))
    161.         return false;
    162.    
    163.     if (g_flLastTouched[id] + 0.01 >= get_gametime()) /* For more accurecy lower 0.1 to for example 0.01*/
    164.     {
    165.         return true;
    166.     }
    167.    
    168.    return false;
    169. }
    1. #include <zombie_escape>
    2.  
    3. #define MESSAGE_TASK 11661
    4. #define CHANCE_TASK 22331
    5.  
    6. forward ze_trigger_hurt();
    7.  
    8. // Cvars
    9. new g_pCvarDelayTime, g_pCvarDHUHEnable
    10.  
    11. // Variables
    12. new bool:g_bMessageAppeared, g_iCounter[33], g_iMaxClients, g_szMapName[32]
    13.  
    14. public plugin_init()
    15. {
    16.     register_plugin("Round End Control", "1.0", "Raheem")
    17.    
    18.     // Cvars
    19.     g_pCvarDelayTime = register_cvar("auto_slay_delay_control", "90")
    20.     g_pCvarDHUHEnable = register_cvar("hud_enable_autoslay", "1")
    21.    
    22.     g_iMaxClients = get_member_game(m_nMaxPlayers)
    23.    
    24.     // Get map name
    25.     get_mapname(g_szMapName, charsmax(g_szMapName))
    26. }
    27.  
    28. public ze_trigger_hurt()
    29. {
    30.     if (equal(g_szMapName, "ze_black_train_v1"))
    31.     {
    32.         set_task(45.0, "CheckPlayers")
    33.         return
    34.     }
    35.    
    36.     set_task(20.0, "CheckPlayers")
    37. }
    38.  
    39. public CheckPlayers()
    40. {
    41.     if (ze_get_zombies_number() >= 1)
    42.     {
    43.         for(new id = 1; id <= g_iMaxClients; id++)
    44.         {
    45.             if (!is_user_alive(id))
    46.                 continue
    47.            
    48.             if (ze_is_user_zombie(id))
    49.             {
    50.                 ze_colored_print(id, "!tYou have !g%i seconds !tto infect all humans!y!!!", get_pcvar_num(g_pCvarDelayTime))
    51.                
    52.                 if (get_pcvar_num(g_pCvarDHUHEnable))
    53.                 {
    54.                     set_task(1.0, "ShowCounter", MESSAGE_TASK+id, _, _, "b")
    55.                 }
    56.                
    57.                 set_task(get_pcvar_float(g_pCvarDelayTime), "GiveChance", CHANCE_TASK+id)
    58.                
    59.                 g_iCounter[id] = get_pcvar_num(g_pCvarDelayTime)
    60.             }
    61.         }
    62.        
    63.         g_bMessageAppeared = true
    64.     }
    65. }
    66.  
    67. public ShowCounter(taskid)
    68. {
    69.     new id = taskid - MESSAGE_TASK
    70.    
    71.     if (!g_iCounter[id] || !is_user_alive(id))
    72.     {
    73.         remove_task(taskid)
    74.         return
    75.     }
    76.    
    77.     set_dhudmessage(0, 255, 0, -1.0, 0.20, 0, 0.0, 0.6)
    78.     show_dhudmessage(id, "** AUTO SLAY AFTER: %i **", g_iCounter[id])
    79.     g_iCounter[id]--
    80. }
    81.  
    82. public GiveChance(taskid)
    83. {
    84.     new id = taskid - CHANCE_TASK
    85.    
    86.     if (!is_user_alive(id) || !ze_is_user_zombie(id))
    87.     {
    88.         remove_task(taskid)
    89.         return
    90.     }
    91.    
    92.     user_kill(id)
    93.     client_cmd(id, "spk vox/bizwarn")
    94.     ze_colored_print(id, "!tChance is over!y, !tyou failed to infect all humans!y!!!")
    95. }
    96.  
    97. public ze_roundend(WinTeam)
    98. {
    99.     for(new id = 1; id <= g_iMaxClients; id++)
    100.     {
    101.         remove_task(id+MESSAGE_TASK)
    102.         remove_task(id+CHANCE_TASK)
    103.     }
    104.    
    105.     g_bMessageAppeared = false
    106. }
    107.  
    108. public ze_user_humanized(id)
    109. {
    110.     g_iCounter[id] = 0
    111.     g_bMessageAppeared = false
    112.     remove_task(id+MESSAGE_TASK)
    113.     remove_task(id+CHANCE_TASK)
    114. }
    115.  
    116. public ze_game_started()
    117. {
    118.     g_bMessageAppeared = false
    119. }
    120.  
    121. public client_disconnected(id)
    122. {
    123.     remove_task(id+MESSAGE_TASK)
    124.     remove_task(id+CHANCE_TASK)
    125. }
    126.  
    127. public ze_user_infected(iVictim, iInfector)
    128. {
    129.     if (iInfector == 0)
    130.         return
    131.    
    132.     if (ze_get_humans_number() == 0)
    133.         return
    134.    
    135.     if (g_bMessageAppeared)
    136.     {
    137.         g_iCounter[iVictim] = g_iCounter[iInfector]
    138.        
    139.         ze_colored_print(iVictim, "!tYou have !g%i seconds !tto infect all humans!y!!!", g_iCounter[iVictim])
    140.         set_task(1.0, "ShowCounter", MESSAGE_TASK+iVictim, _, _, "b")
    141.         set_task(float(g_iCounter[iVictim]), "GiveChance", CHANCE_TASK+iVictim)
    142.     }
    143. }
NOTES:
  1. You will need to install these 2 plugins.
  2. There is some hard coded values for some maps.
  3. I wasted much time on this plugin, it's working like 95% without issues. But still 5%, you can report bugs exactly so it became 100% working.
  4. All bugs will be resolved once it's reported correctly.
  5. Any map need hard code, just post it down if this plugin not work exactly in it.
  6. Maybe you face sometimes slay for zombies without reason, if you faced something like this try trace the issue and report me so i solve it.
Wow Man
This is a Nice Plugin
Keep Up Bro , +Like

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#4

Post by czirimbolo » 4 years ago

Raheem wrote: 4 years ago
}[/Codebox][/list]

NOTES:
  1. You will need to install these 2 plugins.
  2. There is some hard coded values for some maps.
  3. I wasted much time on this plugin, it's working like 95% without issues. But still 5%, you can report bugs exactly so it became 100% working.
  4. All bugs will be resolved once it's reported correctly.
  5. Any map need hard code, just post it down if this plugin not work exactly in it.
  6. Maybe you face sometimes slay for zombies without reason, if you faced something like this try trace the issue and report me so i solve it.
I used this only 1 day. Its killing zombies on some maps before end map. Its killing even on start. I cant use it.

ze_airstrike_dp
ze_campescape_lg
ze_prisonbreak_b3
and more
Image

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#5

Post by Spir0x » 3 years ago

Raheem needs to fix it yeah

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#6

Post by Spir0x » 3 years ago

I got a simple idea, why not making the round end control appears when there's zombies alive after trigger hurt by players typing /end or /rec (round end control) so now the time is not needed anymore because when a player types /end or /rec boom the trigger hurt appears directly !
and try to make this happens only one time to avoid the spams and only the first player can do it. when others types they find : Trigger hurt is already done.

karan
Mod Tester
Mod Tester
India
Posts: 122
Joined: 6 years ago
Location: India
Contact:

#7

Post by karan » 3 years ago

anyone can misuse it easily
Image

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#8

Post by Spir0x » 3 years ago

Man I already said to do it perfectly. Only one & first player who type /end can use it.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#9

Post by Raheem » 3 years ago

Fixed, please try it and report any map that the plugin does not work properly in it.
He who fails to plan is planning to fail

Cirovic
Member
Member
Great Britain
Posts: 8
Joined: 2 years ago
Contact:

#10

Post by Cirovic » 2 years ago

ze_jurassicpark_v2 dont owrk here.,

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 1 guest