Page 1 of 1

Health for infected

Posted: 08 Feb 2021, 16:56
by SobekPogrywamy
Hello, I would like a modification of ze_core that will give a person infecting life for every infected person.

I think it needs to be edited in core because I tried to add disinfection to a separate class.

it was killing me because the plugin read that the first zombie has 8000hp
and class, 5000 + 1000hp for infections, which was killing me


Additionally, I'd like the first zombie not to have a specific life.
just to be added to a given class hp

e.g
classic zombie - 4000 hp first clasisc zombie - 5000hp
hunter zombie - 4500 hp, first hunter zmbie 5500hp

At the moment I am not able to do it myself because I am still learning.

Re: Health for infected

Posted: 09 Feb 2021, 14:17
by Raheem
Hello, post the code of classes.

Re: Health for infected

Posted: 09 Feb 2021, 15:14
by SobekPogrywamy
i have standard... but its still bugged XD



code]
  1. #include <zombie_escape>
  2. #include <ze_zombie_class>
  3.  
  4.  
  5. /*================================================================================
  6.  [Plugin Customization]
  7. =================================================================================*/
  8.  
  9.  
  10. // Classic Zombie Attributes
  11. new const CLASSIC_NAME[] =  "Classic Zombie"
  12. new const CLASSIC_INFO[] =  "-=Balanced=-"
  13. const CLASSIC_HEALTH = 5000
  14. const CLASSIC_SPEED = 250
  15. const CLASSIC_GRAVITY = 750
  16.  
  17. public plugin_precache()
  18. {
  19.     register_plugin("[ZE] Podstawowe zombie", "1.0", "blabla")
  20.     ze_register_zombie_class(CLASSIC_NAME, CLASSIC_INFO, CLASSIC_HEALTH, CLASSIC_SPEED, CLASSIC_GRAVITY)
  21. }
[/code]



  1. #include <zombie_escape>
  2. #include <ze_zombie_class_const>
  3.  
  4. new const ZE_ZOMBIECLASSES_FILE[] = "ze_zombieclasses.ini"
  5.  
  6. #define ZOMBIES_DEFAULT_NAME "Zombie"
  7. #define ZOMBIES_DEFAULT_DESCRIPTION "Classic"
  8. #define ZOMBIES_DEFAULT_HEALTH 1800
  9. #define ZOMBIES_DEFAULT_SPEED 315
  10. #define ZOMBIES_DEFAULT_GRAVITY 800
  11.  
  12. const OFFSET_CSMENUCODE = 205
  13.  
  14. // For class list menu handlers
  15. #define MENU_PAGE_CLASS g_menu_data[id]
  16. new g_menu_data[33]
  17.  
  18. enum _:TOTAL_FORWARDS
  19. {
  20.     FW_SELECT_CLASS_PRE = 0,
  21.     FW_SELECT_CLASS_POST
  22. }
  23. new g_iForwards[TOTAL_FORWARDS], g_iForwardResult
  24.  
  25. new Array:g_szZombieClassRealName,
  26.     Array:g_szZombieClassName,
  27.     Array:g_szZombieClassDesc,
  28.     Array:g_iZombieClassHealth,
  29.     Array:g_iZombieClassSpeed,
  30.     Array:g_flZombieClassGravity
  31.  
  32. new g_iZombieClass[33], g_iNextZombieClass[33], g_szAdditionalMenuText[32], g_iZombieClassNumber
  33.  
  34. public plugin_natives()
  35. {
  36.     register_native("ze_get_current_zombie_class", "native_ze_get_current_zombie_class", 1)
  37.     register_native("ze_get_next_zombie_class", "native_ze_get_next_zombie_class", 1)
  38.     register_native("ze_set_next_zombie_class", "native_ze_set_next_zombie_class", 1)
  39.     register_native("ze_get_zombie_class_health", "native_ze_get_zombie_class_health", 1)
  40.     register_native("ze_register_zombie_class", "native_ze_register_zombie_class")
  41.     register_native("ze_get_zombie_class_id", "native_ze_get_zombie_class_id", 1)
  42.     register_native("ze_get_zombie_class_name", "native_ze_get_zombie_class_name")
  43.     register_native("ze_get_zombie_class_desc", "native_ze_get_zombie_class_desc")
  44.     register_native("ze_get_zombie_class_number", "native_ze_get_zombie_class_number", 1)
  45.     register_native("ze_open_zombie_classes_menu", "native_ze_open_zombie_classes_menu", 1)
  46.     register_native("ze_add_zombie_class_menu_text", "native_ze_add_zombie_class_menu_text", 1)
  47.  
  48.     g_szZombieClassRealName = ArrayCreate(32, 1)
  49.     g_szZombieClassName = ArrayCreate(32, 1)
  50.     g_szZombieClassDesc = ArrayCreate(32, 1)
  51.     g_iZombieClassHealth = ArrayCreate(1, 1)
  52.     g_iZombieClassSpeed = ArrayCreate(1, 1)
  53.     g_flZombieClassGravity = ArrayCreate(1, 1)
  54. }
  55.  
  56. public plugin_init()
  57. {
  58.     register_plugin("[ZE] Addons: Zombie Classes", "1.0", "Jack GamePlay")
  59.  
  60.     register_clcmd("say /zm", "Show_Zombie_Classes_Menu")
  61.    
  62.     g_iForwards[FW_SELECT_CLASS_PRE] = CreateMultiForward("ze_select_zombie_class_pre", ET_CONTINUE, FP_CELL, FP_CELL)
  63.     g_iForwards[FW_SELECT_CLASS_POST] = CreateMultiForward("ze_select_zombie_class_post", ET_CONTINUE, FP_CELL, FP_CELL)
  64. }
  65.  
  66. public plugin_cfg()
  67. {
  68.     if (g_iZombieClassNumber < 1)
  69.     {
  70.         ArrayPushString(g_szZombieClassRealName, ZOMBIES_DEFAULT_NAME)
  71.         ArrayPushString(g_szZombieClassName, ZOMBIES_DEFAULT_NAME)
  72.         ArrayPushString(g_szZombieClassDesc, ZOMBIES_DEFAULT_DESCRIPTION)
  73.         ArrayPushCell(g_iZombieClassHealth, ZOMBIES_DEFAULT_HEALTH)
  74.         ArrayPushCell(g_iZombieClassSpeed, ZOMBIES_DEFAULT_SPEED)
  75.         ArrayPushCell(g_flZombieClassGravity, ZOMBIES_DEFAULT_GRAVITY)
  76.         g_iZombieClassNumber++
  77.     }
  78. }
  79.  
  80. public client_putinserver(id)
  81. {
  82.     g_iZombieClass[id] = ZE_WRONG_ZOMBIE_CLASS
  83.     g_iNextZombieClass[id] = ZE_WRONG_ZOMBIE_CLASS
  84. }
  85.  
  86. public client_disconnected(id)
  87. {
  88.     MENU_PAGE_CLASS = 0
  89. }
  90.  
  91. public Show_Zombie_Classes_Menu(id)
  92. {
  93.     static szMenu[128], szClassName[32], szClassDesc[32]
  94.     new iMenuID, iItemData[2], iIndex
  95.    
  96.     formatex(szMenu, charsmax(szMenu), "%L", LANG_PLAYER, "MENU_ZCLASS")
  97.     iMenuID = menu_create(szMenu, "ZombieClassesMenuHandler")
  98.    
  99.     for (iIndex = 0; iIndex < g_iZombieClassNumber; iIndex++)
  100.     {
  101.         // Additional text to display
  102.         g_szAdditionalMenuText[0] = 0
  103.        
  104.         // Execute class select attempt forward
  105.         ExecuteForward(g_iForwards[FW_SELECT_CLASS_PRE], g_iForwardResult, id, iIndex)
  106.        
  107.         // Show class to player?
  108.         if (g_iForwardResult >= ZE_CLASS_DONT_SHOW)
  109.             continue
  110.        
  111.         ArrayGetString(g_szZombieClassName, iIndex, szClassName, charsmax(szClassName))
  112.         ArrayGetString(g_szZombieClassDesc, iIndex, szClassDesc, charsmax(szClassDesc))
  113.        
  114.         // Class available to player?
  115.         if (g_iForwardResult >= ZE_CLASS_UNAVAILABLE)
  116.             formatex(szMenu, charsmax(szMenu), "\d%s | %s | %s", szClassName, szClassDesc, g_szAdditionalMenuText)
  117.         // Class is current class?
  118.         else if (iIndex == g_iNextZombieClass[id])
  119.             formatex(szMenu, charsmax(szMenu), "\w%s \d| \y%s \d[\yCurrent\d] \r%s", szClassName, szClassDesc, g_szAdditionalMenuText)
  120.         else
  121.             formatex(szMenu, charsmax(szMenu), "\y%s \d| \w%s \r%s", szClassName, szClassDesc, g_szAdditionalMenuText)
  122.        
  123.         iItemData[0] = iIndex
  124.         iItemData[1] = 0
  125.         menu_additem(iMenuID, szMenu, iItemData)
  126.     }
  127.    
  128.     // No classes to display?
  129.     if (menu_items(iMenuID) <= 0)
  130.     {
  131.         ze_colored_print(id, "%L", LANG_PLAYER, "NO_ZCLASSES")
  132.         menu_destroy(iMenuID)
  133.         return
  134.     }
  135.    
  136.     // Back - Next - Exit
  137.     formatex(szMenu, charsmax(szMenu), "%L", LANG_PLAYER, "BACK")
  138.     menu_setprop(iMenuID, MPROP_BACKNAME, szMenu)
  139.     formatex(szMenu, charsmax(szMenu), "%L", LANG_PLAYER, "NEXT")
  140.     menu_setprop(iMenuID, MPROP_NEXTNAME, szMenu)
  141.     formatex(szMenu, charsmax(szMenu), "%L", LANG_PLAYER, "EXIT")
  142.     menu_setprop(iMenuID, MPROP_EXITNAME, szMenu)
  143.    
  144.     MENU_PAGE_CLASS = min(MENU_PAGE_CLASS, menu_pages(iMenuID) - 1)
  145.    
  146.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  147.     menu_display(id, iMenuID, MENU_PAGE_CLASS)
  148. }
  149.  
  150. public ZombieClassesMenuHandler(id, iMenuID, iItemID)
  151. {
  152.     // Menu was closed
  153.     if (iItemID == MENU_EXIT)
  154.     {
  155.         MENU_PAGE_CLASS = 0
  156.         menu_destroy(iMenuID)
  157.         return PLUGIN_HANDLED
  158.     }
  159.    
  160.     // Remember class menu page
  161.     MENU_PAGE_CLASS = iItemID / 7
  162.    
  163.     // Retrieve class index
  164.     new iItemData[2], iDummy, iIndex
  165.     menu_item_getinfo(iMenuID, iItemID, iDummy, iItemData, charsmax(iItemData), _, _, iDummy)
  166.     iIndex = iItemData[0]
  167.    
  168.     // Execute class select attempt forward
  169.     ExecuteForward(g_iForwards[FW_SELECT_CLASS_PRE], g_iForwardResult, id, iIndex)
  170.    
  171.     // Class available to player?
  172.     if (g_iForwardResult >= ZE_CLASS_UNAVAILABLE)
  173.     {
  174.         menu_destroy(iMenuID)
  175.         return PLUGIN_HANDLED
  176.     }
  177.    
  178.     // Make selected class next class for player
  179.     g_iNextZombieClass[id] = iIndex
  180.    
  181.     new szClassName[32]
  182.     ArrayGetString(g_szZombieClassName, g_iNextZombieClass[id], szClassName, charsmax(szClassName))
  183.    
  184.     ze_colored_print(id, "!t%L!y: !g%s", LANG_PLAYER, "ZOMBIE_SELECT", szClassName)
  185.     ze_colored_print(id, "!t%L!y: !g%i !y- !t%L!y: !g%i !y- !t%L!y: !g%i", LANG_PLAYER, "ZOMBIE_HEALTH", ArrayGetCell(g_iZombieClassHealth, g_iNextZombieClass[id]), LANG_PLAYER, "ZOMBIE_SPEED", ArrayGetCell(g_iZombieClassSpeed, g_iNextZombieClass[id]), LANG_PLAYER, "ZOMBIE_GRAVITY", ArrayGetCell(g_flZombieClassGravity, g_iNextZombieClass[id]))
  186.    
  187.     // Execute class select post forward
  188.     ExecuteForward(g_iForwards[FW_SELECT_CLASS_POST], g_iForwardResult, id, iIndex)
  189.    
  190.     menu_destroy(iMenuID)
  191.     return PLUGIN_HANDLED
  192. }
  193.  
  194. public ze_user_infected(id)
  195. {
  196.     // Show zombie class menu if they haven't chosen any (e.g. just connected)
  197.     if (g_iNextZombieClass[id] == ZE_WRONG_ZOMBIE_CLASS)
  198.     {
  199.         if (g_iZombieClassNumber > 1)
  200.             Show_Zombie_Classes_Menu(id)
  201.         else // If only one class is registered, choose it automatically
  202.             g_iNextZombieClass[id] = 0
  203.     }
  204.    
  205.     // Bots pick class automatically
  206.     if (is_user_bot(id))
  207.     {
  208.         // Try choosing class
  209.         new iIndex, iStart_Index = random_num(0, g_iZombieClassNumber - 1)
  210.         for (iIndex = iStart_Index + 1; /* no condition */; iIndex++)
  211.         {
  212.             // Start over when we reach the end
  213.             if (iIndex >= g_iZombieClassNumber)
  214.                 iIndex = 0
  215.            
  216.             // Execute class select attempt forward
  217.             ExecuteForward(g_iForwards[FW_SELECT_CLASS_PRE], g_iForwardResult, id, iIndex)
  218.            
  219.             // Class available to player?
  220.             if (g_iForwardResult < ZE_CLASS_UNAVAILABLE)
  221.             {
  222.                 g_iNextZombieClass[id] = iIndex
  223.                 break
  224.             }
  225.            
  226.             // Loop completed, no class could be chosen
  227.             if (iIndex == iStart_Index)
  228.                 break
  229.         }
  230.     }
  231.    
  232.     // Set selected zombie class. If none selected yet, use the first one
  233.     g_iZombieClass[id] = g_iNextZombieClass[id]
  234.     if (g_iZombieClass[id] == ZE_WRONG_ZOMBIE_CLASS)
  235.             g_iZombieClass[id] = 0
  236.    
  237.     // Apply zombie attributes
  238.     set_entvar(id, var_health, float(ArrayGetCell(g_iZombieClassHealth, g_iZombieClass[id])))
  239.     set_entvar(id, var_gravity, float(ArrayGetCell(g_flZombieClassGravity, g_iZombieClass[id])) / 800)
  240.     ze_set_zombie_speed(id, ArrayGetCell(g_iZombieClassSpeed, g_iZombieClass[id]))
  241. }
  242.  
  243. public native_ze_get_current_zombie_class(id)
  244. {
  245.     if (!is_user_connected(id))
  246.     {
  247.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  248.         return ZE_WRONG_ZOMBIE_CLASS
  249.     }
  250.    
  251.     return g_iZombieClass[id]
  252. }
  253.  
  254. public native_ze_get_next_zombie_class(id)
  255. {
  256.     if (!is_user_connected(id))
  257.     {
  258.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  259.         return ZE_WRONG_ZOMBIE_CLASS
  260.     }
  261.    
  262.     return g_iNextZombieClass[id]
  263. }
  264.  
  265. public native_ze_set_next_zombie_class(id, iClassID)
  266. {
  267.     if (!is_user_connected(id))
  268.     {
  269.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  270.         return false
  271.     }
  272.    
  273.     if (0 > iClassID >= g_iZombieClassNumber)
  274.     {
  275.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid zombie class id (%d)", iClassID)
  276.         return false
  277.     }
  278.    
  279.     g_iNextZombieClass[id] = iClassID
  280.     return true
  281. }
  282.  
  283. public native_ze_get_zombie_class_health(id, iClassID)
  284. {
  285.     if (!is_user_connected(id))
  286.     {
  287.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  288.         return -1
  289.     }
  290.    
  291.     if (0 > iClassID >= g_iZombieClassNumber)
  292.     {
  293.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid zombie class id (%d)", iClassID)
  294.         return -1
  295.     }
  296.    
  297.     return ArrayGetCell(g_iZombieClassHealth, iClassID)
  298. }
  299.  
  300. public native_ze_register_zombie_class(plugin_id, num_params)
  301. {
  302.     new szName[32]
  303.     get_string(1, szName, charsmax(szName))
  304.    
  305.     if (strlen(szName) < 1)
  306.     {
  307.         log_error(AMX_ERR_NATIVE, "[ZE] Can't register zombie class with an empty name")
  308.         return ZE_WRONG_ZOMBIE_CLASS
  309.     }
  310.    
  311.     new iIndex, szZombieClassName[32]
  312.     for (iIndex = 0; iIndex < g_iZombieClassNumber; iIndex++)
  313.     {
  314.         ArrayGetString(g_szZombieClassRealName, iIndex, szZombieClassName, charsmax(szZombieClassName))
  315.         if (equali(szName, szZombieClassName))
  316.         {
  317.             log_error(AMX_ERR_NATIVE, "[ZE] Zombie class already registered (%s)", szName)
  318.             return ZE_WRONG_ZOMBIE_CLASS
  319.         }
  320.     }
  321.    
  322.     new szDesc[32]
  323.     get_string(2, szDesc, charsmax(szDesc))
  324.     new iHealth = get_param(3)
  325.     new iSpeed = get_param(4)
  326.     new flGravity = get_param(5)
  327.  
  328.     // Load settings from zombie classes file
  329.     new szRealName[32]
  330.     copy(szRealName, charsmax(szRealName), szName)
  331.     ArrayPushString(g_szZombieClassRealName, szRealName)
  332.  
  333.     // Name
  334.     if (!amx_load_setting_string(ZE_ZOMBIECLASSES_FILE, szRealName, "NAME", szName, charsmax(szName)))
  335.         amx_save_setting_string(ZE_ZOMBIECLASSES_FILE, szRealName, "NAME", szName)
  336.     ArrayPushString(g_szZombieClassName, szName)
  337.    
  338.     // Description
  339.     if (!amx_load_setting_string(ZE_ZOMBIECLASSES_FILE, szRealName, "INFO", szDesc, charsmax(szDesc)))
  340.         amx_save_setting_string(ZE_ZOMBIECLASSES_FILE, szRealName, "INFO", szDesc)
  341.     ArrayPushString(g_szZombieClassDesc, szDesc)
  342.    
  343.     // Health
  344.     if (!amx_load_setting_int(ZE_ZOMBIECLASSES_FILE, szRealName, "HEALTH", iHealth))
  345.         amx_save_setting_int(ZE_ZOMBIECLASSES_FILE, szRealName, "HEALTH", iHealth)
  346.     ArrayPushCell(g_iZombieClassHealth, iHealth)
  347.    
  348.     // Speed
  349.     if (!amx_load_setting_int(ZE_ZOMBIECLASSES_FILE, szRealName, "SPEED", iSpeed))
  350.         amx_save_setting_int(ZE_ZOMBIECLASSES_FILE, szRealName, "SPEED", iSpeed)
  351.     ArrayPushCell(g_iZombieClassSpeed, iSpeed)
  352.    
  353.     // Gravity
  354.     if (!amx_load_setting_int(ZE_ZOMBIECLASSES_FILE, szRealName, "GRAVITY", flGravity))
  355.         amx_load_setting_int(ZE_ZOMBIECLASSES_FILE, szRealName, "GRAVITY", flGravity)
  356.     ArrayPushCell(g_flZombieClassGravity, flGravity)
  357.    
  358.     g_iZombieClassNumber++
  359.     return g_iZombieClassNumber - 1
  360. }
  361.  
  362. public native_ze_get_zombie_class_id(const szName[])
  363. {
  364.     new iIndex, szZombieClassName[32]
  365.     for (iIndex = 0; iIndex < g_iZombieClassNumber; iIndex++)
  366.     {
  367.         ArrayGetString(g_szZombieClassRealName, iIndex, szZombieClassName, charsmax(szZombieClassName))
  368.         if (equali(szName, szZombieClassName))
  369.             return iIndex
  370.     }
  371.    
  372.     return ZE_WRONG_ZOMBIE_CLASS
  373. }
  374.  
  375. public native_ze_get_zombie_class_name(plugin_id, num_params)
  376. {
  377.     new iClassID = get_param(1)
  378.    
  379.     if (0 > iClassID >= g_iZombieClassNumber)
  380.     {
  381.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid zombie class id (%d)", iClassID)
  382.         return false
  383.     }
  384.    
  385.     new szName[32]
  386.     ArrayGetString(g_szZombieClassName, iClassID, szName, charsmax(szName))
  387.    
  388.     new iLen = get_param(3)
  389.     set_string(2, szName, iLen)
  390.     return true
  391. }
  392.  
  393. public native_ze_get_zombie_class_desc(plugin_id, num_params)
  394. {
  395.     new iClassID = get_param(1)
  396.    
  397.     if (0 > iClassID >= g_iZombieClassNumber)
  398.     {
  399.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid zombie class id (%d)", iClassID)
  400.         return false
  401.     }
  402.    
  403.     new szDesc[32]
  404.     ArrayGetString(g_szZombieClassDesc, iClassID, szDesc, charsmax(szDesc))
  405.    
  406.     new iLen = get_param(3)
  407.     set_string(2, szDesc, iLen)
  408.     return true
  409. }
  410.  
  411. public native_ze_get_zombie_class_number()
  412. {
  413.     return g_iZombieClassNumber
  414. }
  415.  
  416. public native_ze_open_zombie_classes_menu(id)
  417. {
  418.     if (!is_user_connected(id))
  419.     {
  420.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  421.         return false
  422.     }
  423.    
  424.     Show_Zombie_Classes_Menu(id)
  425.     return true
  426. }
  427.  
  428. public native_ze_add_zombie_class_menu_text(const text[])
  429. {
  430.     format(g_szAdditionalMenuText, charsmax(g_szAdditionalMenuText), "%s%s", g_szAdditionalMenuText, text)
  431. }

Re: Health for infected

Posted: 12 Feb 2021, 12:12
by Raheem
Try something like (ze_core.sma):
    1. #include <zombie_escape>
    2. #include <ze_zombie_class>
    3.  
    4. // Fowards
    5. enum _:TOTAL_FORWARDS
    6. {
    7.     FORWARD_NONE = 0,
    8.     FORWARD_ROUNDEND,
    9.     FORWARD_HUMANIZED,
    10.     FORWARD_PRE_INFECTED,
    11.     FORWARD_INFECTED,
    12.     FORWARD_ZOMBIE_APPEAR,
    13.     FORWARD_ZOMBIE_RELEASE,
    14.     FORWARD_GAME_STARTED_PRE,
    15.     FORWARD_GAME_STARTED,
    16.     FORWARD_DISCONNECT
    17. }
    18.  
    19. new g_iForwards[TOTAL_FORWARDS], g_iFwReturn
    20.  
    21. // Tasks IDs
    22. enum
    23. {
    24.     TASK_COUNTDOWN = 1100,
    25.     TASK_COUNTDOWN2,
    26.     TASK_SCORE_MESSAGE,
    27.     ZOMBIES_SPEED,
    28.     ROUND_TIME_LEFT
    29. }
    30.  
    31. // Colors (g_pCvarColors[] array indexes)
    32. enum
    33. {
    34.     Red = 0,
    35.     Green,
    36.     Blue
    37. }
    38.  
    39. // Variables
    40. new g_iAliveHumansNum,
    41.     g_iAliveZombiesNum,
    42.     g_iRoundTime,
    43.     g_iCountDown,
    44.     g_iReleaseNotice,
    45.     g_iMaxClients,
    46.     g_iHumansScore,
    47.     g_iZombiesScore,
    48.     g_iRoundNum,
    49.     g_iHSpeedFactor[33],
    50.     g_iZSpeedSet[33],
    51.     g_iUserGravity[33],
    52.     bool:g_bGameStarted,
    53.     bool:g_bIsZombie[33],
    54.     bool:g_bIsZombieFrozen[33],
    55.     bool:g_bZombieFreezeTime,
    56.     bool:g_bIsRoundEnding,
    57.     bool:g_bHSpeedUsed[33],
    58.     bool:g_bZSpeedUsed[33],
    59.     bool:g_bEndCalled,
    60.     bool:g_bIsKnockBackUsed[33],
    61.     bool:g_bIsGravityUsed[33],
    62.     bool:g_bEnteredNotChoosed[33],
    63.     bool:g_bDisconnectHumanWin,
    64.     Float:g_flReferenceTime,
    65.     Float:g_flUserKnockback[33]
    66.  
    67. // Cvars
    68. new g_pCvarHumanSpeedFactor,
    69.     g_pCvarHumanGravity,
    70.     g_pCvarHumanHealth,
    71.     g_pCvarZombieSpeed,
    72.     g_pCvarZombieGravity,
    73.     g_pCvarZombieReleaseTime,
    74.     g_pCvarFreezeTime,
    75.     g_pCvarRoundTime,
    76.     g_pCvarReqPlayers,
    77.     g_pCvarZombieHealth,
    78.     g_pCvarFirstZombiesHealth,
    79.     g_pCvarZombieKnockback,
    80.     g_pCvarScoreMessageType,
    81.     g_pCvarColors[3],
    82.     g_pCvarRoundEndDelay,
    83.     g_pCvarSmartRandom
    84.    
    85. // Dynamic Arrays
    86. new Array:g_aChosenPlayers
    87.  
    88. public plugin_natives()
    89. {
    90.     register_native("ze_is_user_zombie", "native_ze_is_user_zombie", 1)
    91.     register_native("ze_is_game_started", "native_ze_is_game_started", 1)
    92.     register_native("ze_is_zombie_frozen", "native_ze_is_zombie_frozen", 1)
    93.    
    94.     register_native("ze_get_round_number", "native_ze_get_round_number", 1)
    95.     register_native("ze_get_humans_number", "native_ze_get_humans_number", 1)
    96.     register_native("ze_get_zombies_number", "native_ze_get_zombies_number", 1)
    97.    
    98.     register_native("ze_set_user_zombie", "native_ze_set_user_zombie", 1)
    99.     register_native("ze_set_user_human", "native_ze_set_user_human", 1)
    100.     register_native("ze_set_human_speed_factor", "native_ze_set_human_speed_factor", 1)
    101.     register_native("ze_set_zombie_speed", "native_ze_set_zombie_speed", 1)
    102.    
    103.     register_native("ze_reset_human_speed", "native_ze_reset_human_speed", 1)
    104.     register_native("ze_reset_zombie_speed", "native_ze_reset_zombie_speed", 1)
    105.    
    106.     register_native("ze_get_user_knockback", "native_ze_get_user_knockback", 1)
    107.     register_native("ze_set_user_knockback", "native_ze_set_user_knockback", 1)
    108.     register_native("ze_reset_user_knockback", "native_ze_reset_user_knockback", 1)
    109.    
    110.     register_native("ze_set_user_gravity", "native_ze_set_user_gravity", 1)
    111.     register_native("ze_reset_user_gravity", "native_ze_reset_user_gravity", 1)
    112.    
    113.     register_native("ze_remove_zombie_freeze_msg", "native_ze_remove_zombie_freeze_msg", 1)
    114. }
    115.  
    116. public plugin_init()
    117. {
    118.     register_plugin("[ZE] Core/Engine", ZE_VERSION, AUTHORS)
    119.    
    120.     // Hook Chains
    121.     RegisterHookChain(RG_CBasePlayer_TraceAttack, "Fw_TraceAttack_Pre", 0)
    122.     RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
    123.     RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
    124.     RegisterHookChain(RG_CSGameRules_CheckWinConditions, "Fw_CheckMapConditions_Post", 1)
    125.     RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
    126.     RegisterHookChain(RG_RoundEnd, "Event_RoundEnd_Pre", 0)
    127.     RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "Fw_RestMaxSpeed_Post", 1)
    128.     RegisterHookChain(RG_HandleMenu_ChooseTeam, "Fw_HandleMenu_ChooseTeam_Post", 1)
    129.     RegisterHookChain(RG_HandleMenu_ChooseAppearance, "Fw_HandleMenu_ChoosedAppearance_Post", 1)
    130.    
    131.     // Events
    132.     register_event("HLTV", "New_Round", "a", "1=0", "2=0")
    133.     register_event("TextMsg", "Map_Restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in", "2=#Round_Draw")
    134.     register_logevent("Round_Start", 2, "1=Round_Start")
    135.     register_logevent("Round_End", 2, "1=Round_End")
    136.    
    137.     // Create Forwards
    138.     g_iForwards[FORWARD_ROUNDEND] = CreateMultiForward("ze_roundend", ET_IGNORE, FP_CELL)
    139.     g_iForwards[FORWARD_HUMANIZED] = CreateMultiForward("ze_user_humanized", ET_IGNORE, FP_CELL)
    140.     g_iForwards[FORWARD_PRE_INFECTED] = CreateMultiForward("ze_user_infected_pre", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL)
    141.     g_iForwards[FORWARD_INFECTED] = CreateMultiForward("ze_user_infected", ET_IGNORE, FP_CELL, FP_CELL)
    142.     g_iForwards[FORWARD_ZOMBIE_APPEAR] = CreateMultiForward("ze_zombie_appear", ET_IGNORE)
    143.     g_iForwards[FORWARD_ZOMBIE_RELEASE] = CreateMultiForward("ze_zombie_release", ET_IGNORE)
    144.     g_iForwards[FORWARD_GAME_STARTED_PRE] = CreateMultiForward("ze_game_started_pre", ET_CONTINUE)
    145.     g_iForwards[FORWARD_GAME_STARTED] = CreateMultiForward("ze_game_started", ET_IGNORE)
    146.     g_iForwards[FORWARD_DISCONNECT] = CreateMultiForward("ze_player_disconnect", ET_CONTINUE, FP_CELL)
    147.    
    148.     // Hud Messages
    149.     g_iReleaseNotice = CreateHudSyncObj()
    150.    
    151.     // Registering Messages
    152.     register_message(get_user_msgid("TeamScore"), "Message_Teamscore")
    153.    
    154.     // Sequential files (.txt)
    155.     register_dictionary("zombie_escape.txt")
    156.    
    157.     // Humans Cvars
    158.     g_pCvarHumanSpeedFactor = register_cvar("ze_human_speed_factor", "20.0")
    159.     g_pCvarHumanGravity = register_cvar("ze_human_gravity", "800")
    160.     g_pCvarHumanHealth = register_cvar("ze_human_health", "1000")
    161.    
    162.     // Zombie Cvars
    163.     g_pCvarZombieSpeed = register_cvar("ze_zombie_speed", "350.0")
    164.     g_pCvarZombieGravity = register_cvar("ze_zombie_gravity", "640")
    165.     g_pCvarZombieHealth = register_cvar("ze_zombie_health", "10000")
    166.     g_pCvarFirstZombiesHealth = register_cvar("ze_first_zombies_health", "20000")
    167.     g_pCvarZombieKnockback = register_cvar("ze_zombie_knockback", "300.0")
    168.    
    169.     // General Cvars
    170.     g_pCvarZombieReleaseTime = register_cvar("ze_release_time", "15")
    171.     g_pCvarFreezeTime = register_cvar("ze_freeze_time", "20")
    172.     g_pCvarRoundTime = register_cvar("ze_round_time", "9.0")
    173.     g_pCvarReqPlayers = register_cvar("ze_required_players", "2")
    174.     g_pCvarScoreMessageType = register_cvar("ze_score_message_type", "1")
    175.     g_pCvarColors[Red] = register_cvar("ze_score_message_red", "200")
    176.     g_pCvarColors[Green] = register_cvar("ze_score_message_green", "100")
    177.     g_pCvarColors[Blue] = register_cvar("ze_score_message_blue", "0")
    178.     g_pCvarRoundEndDelay = register_cvar("ze_round_end_delay", "5")
    179.     g_pCvarSmartRandom = register_cvar("ze_smart_random", "1")
    180.    
    181.     // Static Values
    182.     g_iMaxClients = get_member_game(m_nMaxPlayers)
    183.    
    184.     // Check Round Time to Terminate it
    185.     set_task(1.0, "Check_RoundTimeleft", ROUND_TIME_LEFT, _, _, "b")
    186. }
    187.  
    188. public plugin_cfg()
    189. {
    190.     // Get our configiration file and Execute it
    191.     new szCfgDir[64]
    192.     get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir))
    193.     server_cmd("exec %s/zombie_escape.cfg", szCfgDir)
    194.    
    195.     // Set Game Name
    196.     new szGameName[64]
    197.     formatex(szGameName, sizeof(szGameName), "Zombie Escape v%s", ZE_VERSION)
    198.     set_member_game(m_GameDesc, szGameName)
    199.    
    200.     // Set Version
    201.     register_cvar("ze_version", ZE_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
    202.     set_cvar_string("ze_version", ZE_VERSION)
    203.    
    204.     // Delay so cvars be loaded from zombie_escape.cfg
    205.     set_task(0.1, "DelaySmartRandom")
    206.    
    207.     // Delay some settings
    208.     set_task(0.1, "DelaySettings")
    209. }
    210.  
    211. public DelaySettings()
    212. {
    213.     // Set some cvars, not allowed to be changed from any other .cfg file (Not recommended to remove them)
    214.     new pCvarRoundTime, pCvarFreezeTime, pCvarMaxSpeed
    215.    
    216.     pCvarRoundTime = get_cvar_pointer("mp_roundtime")
    217.     pCvarFreezeTime = get_cvar_pointer("mp_freezetime")
    218.     pCvarMaxSpeed = get_cvar_pointer("sv_maxspeed")
    219.    
    220.     set_pcvar_num(pCvarRoundTime, get_pcvar_num(g_pCvarRoundTime))
    221.     set_pcvar_num(pCvarFreezeTime, get_pcvar_num(g_pCvarFreezeTime))
    222.    
    223.     // Max speed at least equal to zombies speed. Here zombies speed assumed to be higher than humans one.
    224.     if (get_pcvar_num(pCvarMaxSpeed) < get_pcvar_num(g_pCvarZombieSpeed))
    225.     {
    226.         set_pcvar_num(pCvarMaxSpeed, get_pcvar_num(g_pCvarZombieSpeed))
    227.     }
    228. }
    229.  
    230. public DelaySmartRandom()
    231. {
    232.     if (get_pcvar_num(g_pCvarSmartRandom))
    233.     {
    234.         // Create our array to store SteamIDs in
    235.         g_aChosenPlayers = ArrayCreate(34)
    236.     }
    237. }
    238.  
    239. public Fw_CheckMapConditions_Post()
    240. {
    241.     // Block Game Commencing
    242.     set_member_game(m_bGameStarted, true)
    243.    
    244.     // Set Freeze Time
    245.     set_member_game(m_iIntroRoundTime, get_pcvar_num(g_pCvarFreezeTime))
    246.    
    247.     // Set Round Time
    248.     set_member_game(m_iRoundTime, floatround(get_pcvar_float(g_pCvarRoundTime) * 60.0))
    249. }
    250.  
    251. public Fw_PlayerKilled_Post(id)
    252. {
    253.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
    254.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
    255.    
    256.     if (g_iAliveHumansNum == 0 && g_iAliveZombiesNum == 0)
    257.     {
    258.         // No Winner, All Players in one team killed Or Both teams Killed
    259.         client_print(0, print_center, "%L", LANG_PLAYER, "NO_WINNER")
    260.     }
    261. }
    262.  
    263. public Fw_RestMaxSpeed_Post(id)
    264. {
    265.     if (!g_bIsZombie[id])
    266.     {
    267.         static Float:flMaxSpeed
    268.         get_entvar(id, var_maxspeed, flMaxSpeed)
    269.        
    270.         if (flMaxSpeed != 1.0 && is_user_alive(id))
    271.         {
    272.             if (g_bHSpeedUsed[id])
    273.             {
    274.                 // Set New Human Speed Factor
    275.                 set_entvar(id, var_maxspeed, flMaxSpeed + float(g_iHSpeedFactor[id]))
    276.                 return HC_CONTINUE
    277.             }
    278.                
    279.             // Set Human Speed Factor, native not used
    280.             set_entvar(id, var_maxspeed, flMaxSpeed + get_pcvar_float(g_pCvarHumanSpeedFactor))
    281.             return HC_CONTINUE
    282.         }
    283.     }
    284.     else
    285.     {
    286.         if (g_bZombieFreezeTime)
    287.         {
    288.             // Fix for zombie weapon switching that can give him small speed in zombie freeze time
    289.             set_entvar(id, var_maxspeed, 1.0)
    290.         }
    291.     }
    292.    
    293.     return HC_SUPERCEDE
    294. }
    295.  
    296. public Fw_PlayerSpawn_Post(id)
    297. {  
    298.     if (!g_bGameStarted)
    299.     {
    300.         // Force All player to be Humans if Game not started yet
    301.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
    302.     }
    303.     else
    304.     {
    305.         if (get_member_game(m_bFreezePeriod))
    306.         {
    307.             // Respawn Him As human if we are in freeze time (Zombie Not Chosen yet)
    308.             Set_User_Human(id)
    309.             g_bIsZombieFrozen[id] = false
    310.         }
    311.         else
    312.         {
    313.             if (g_bZombieFreezeTime)
    314.             {
    315.                 // Zombie Chosen and zombies Frozen, Spawn him as zombie and Freeze Him
    316.                 Set_User_Zombie(id)
    317.                 g_bIsZombieFrozen[id] = true
    318.                 set_entvar(id, var_maxspeed, 1.0)
    319.             }
    320.             else
    321.             {
    322.                 // Respawn him as normal zombie
    323.                 Set_User_Zombie(id)
    324.                 g_bIsZombieFrozen[id] = false
    325.             }
    326.         }
    327.     }
    328. }
    329.  
    330. public New_Round()
    331. {
    332.     // Remove All tasks in the New Round
    333.     remove_task(TASK_COUNTDOWN)
    334.     remove_task(TASK_COUNTDOWN2)
    335.     remove_task(TASK_SCORE_MESSAGE)
    336.     remove_task(ZOMBIES_SPEED)
    337.    
    338.     if (g_bGameStarted)
    339.     {
    340.         g_iRoundNum++
    341.     }
    342.    
    343.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED_PRE], g_iFwReturn)
    344.    
    345.     if (g_iFwReturn >= ZE_STOP)
    346.         return
    347.    
    348.     // Score Message Task
    349.     set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
    350.    
    351.     if (!g_bGameStarted)
    352.     {
    353.         // No Enough Players
    354.         ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
    355.         return // Block the execution of the blew code
    356.     }
    357.    
    358.     if (g_iRoundNum == 1)
    359.     {
    360.         // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
    361.         g_iCountDown = get_member_game(m_iIntroRoundTime) - 2
    362.     }
    363.     else
    364.     {
    365.         // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
    366.         g_iCountDown = get_member_game(m_iIntroRoundTime) - 3
    367.     }
    368.    
    369.     // Game Already started, Countdown now started
    370.     set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
    371.     ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
    372.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
    373.    
    374.     // Round Starting
    375.     g_bIsRoundEnding = false
    376.     g_bEndCalled = false
    377. }
    378.  
    379. // Score Message Task
    380. public Score_Message(TaskID)
    381. {
    382.     // If value is 0, there is nothing to do for this case this means CVAR is disabled
    383.     switch(get_pcvar_num(g_pCvarScoreMessageType))
    384.     {
    385.         case 1: // DHUD
    386.         {
    387.             set_dhudmessage(get_pcvar_num(g_pCvarColors[Red]), get_pcvar_num(g_pCvarColors[Green]), get_pcvar_num(g_pCvarColors[Blue]), -1.0, 0.01, 0, 0.0, 9.0)
    388.             show_dhudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
    389.         }
    390.         case 2: // HUD
    391.         {
    392.             set_hudmessage(get_pcvar_num(g_pCvarColors[Red]), get_pcvar_num(g_pCvarColors[Green]), get_pcvar_num(g_pCvarColors[Blue]), -1.0, 0.01, 0, 0.0, 9.0)
    393.             show_hudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
    394.         }
    395.     }
    396. }
    397.  
    398. public Countdown_Start(TaskID)
    399. {
    400.     // Check if the players Disconnected and there is only one player then remove all messages, and stop tasks (+Stop sounds)
    401.     if (!g_bGameStarted)
    402.     {
    403.         StopSound()
    404.         remove_task(TaskID) // Remove the task
    405.         return
    406.     }
    407.    
    408.     if (!g_iCountDown)
    409.     {
    410.         Choose_Zombies()
    411.         remove_task(TaskID) // Remove the task
    412.         return // Block the execution of the blew code
    413.     }
    414.    
    415.     set_hudmessage(random(256), random(256), random(256), -1.0, 0.21, 0, 0.8, 0.8)
    416.     show_hudmessage(0, "%L", LANG_PLAYER, "RUN_NOTICE", g_iCountDown--)
    417. }
    418.  
    419. public Choose_Zombies()
    420. {
    421.     new iZombies, id, iAliveCount
    422.     new iReqZombies
    423.    
    424.     // Get total alive players and required players
    425.     iAliveCount  = GetAllAlivePlayersNum()
    426.     iReqZombies = RequiredZombies()
    427.    
    428.     // Loop till we find req players
    429.     while(iZombies < iReqZombies)
    430.     {
    431.         id = GetRandomAlive(random_num(1, iAliveCount))
    432.        
    433.         if (!is_user_alive(id) || g_bIsZombie[id])
    434.             continue
    435.        
    436.         // Check if CVAR enabled and if player in the array, it means he chosen previous round so skip him this round
    437.         if (get_pcvar_num(g_pCvarSmartRandom) && IsPlayerInArray(g_aChosenPlayers, id))
    438.             continue
    439.  
    440.         Set_User_Zombie(id)
    441.         set_entvar(id, var_health, float(ze_get_zombie_class_health(id, ze_get_current_zombie_class(id)) * 2))
    442.         g_bIsZombieFrozen[id] = true
    443.         set_entvar(id, var_maxspeed, 1.0)
    444.         iZombies++
    445.     }
    446.    
    447.     if (iZombies > 0)
    448.     {
    449.         g_bZombieFreezeTime = true
    450.         set_task(0.1, "Zombies_Speed", ZOMBIES_SPEED, _, _, "b") // Better than PreThink
    451.         ExecuteForward(g_iForwards[FORWARD_ZOMBIE_APPEAR], g_iFwReturn)
    452.     }
    453.    
    454.     if (get_pcvar_num(g_pCvarSmartRandom))
    455.     {
    456.         // Clear the array first
    457.         ArrayClear(g_aChosenPlayers)
    458.        
    459.         new szAuthId[34]
    460.        
    461.         // Add steamid of chosen zombies, so we don't choose them next round again (using steamid means it support reconnect)
    462.         for (new id = 1; id <= g_iMaxClients; id++)
    463.         {
    464.             if(!is_user_connected(id) || !g_bIsZombie[id])
    465.                 continue
    466.            
    467.             get_user_authid(id, szAuthId, charsmax(szAuthId))
    468.            
    469.             ArrayPushString(g_aChosenPlayers, szAuthId)
    470.         }
    471.     }
    472.    
    473.     // 2 is Hardcoded Value, It's Fix for the countdown to work correctly
    474.     g_iCountDown = get_pcvar_num(g_pCvarZombieReleaseTime) - 2
    475.    
    476.     set_task(1.0, "ReleaseZombie_CountDown", TASK_COUNTDOWN2, _, _, "b")
    477. }
    478.  
    479. public ReleaseZombie_CountDown(TaskID)
    480. {
    481.     if (!g_iCountDown)
    482.     {
    483.         ReleaseZombie()
    484.         remove_task(TaskID)
    485.         return
    486.     }
    487.    
    488.     // Release Hud Message
    489.     set_hudmessage(255, 255, 0, -1.0, 0.21, 1, 2.0, 2.0)
    490.     ShowSyncHudMsg(0, g_iReleaseNotice, "%L", LANG_PLAYER, "ZOMBIE_RELEASE", g_iCountDown--)
    491. }
    492.  
    493. public ReleaseZombie()
    494. {
    495.     ExecuteForward(g_iForwards[FORWARD_ZOMBIE_RELEASE], g_iFwReturn)
    496.    
    497.     g_bZombieFreezeTime = false
    498.    
    499.     for(new id = 1; id <= g_iMaxClients; id++)
    500.     {
    501.         if (is_user_alive(id) && g_bIsZombie[id])
    502.         {
    503.             g_bIsZombieFrozen[id] = false
    504.         }
    505.     }
    506. }
    507.  
    508. public Zombies_Speed(TaskID)
    509. {
    510.     for(new id = 1; id <= g_iMaxClients; id++)
    511.     {
    512.         if(!is_user_alive(id) || !g_bIsZombie[id])
    513.             continue
    514.        
    515.         if (g_bIsZombieFrozen[id])
    516.         {
    517.             // Zombie & Frozen, then Freeze him
    518.             set_entvar(id, var_maxspeed, 1.0)
    519.         }
    520.         else
    521.         {
    522.             if (g_bZSpeedUsed[id])
    523.             {
    524.                 // Zombie but Not Frozen the set his speed form .cfg
    525.                 set_entvar(id, var_maxspeed, float(g_iZSpeedSet[id]))
    526.                 continue;
    527.             }
    528.                
    529.             // Zombie but Not Frozen the set his speed form .cfg
    530.             set_entvar(id, var_maxspeed, get_pcvar_float(g_pCvarZombieSpeed))
    531.         }
    532.     }
    533. }
    534.  
    535. public Fw_TraceAttack_Pre(iVictim, iAttacker, Float:flDamage, Float:flDirection[3], iTracehandle, bitsDamageType)
    536. {
    537.     if (iVictim == iAttacker || !is_user_connected(iVictim) || !is_user_connected(iAttacker))
    538.         return HC_CONTINUE
    539.    
    540.     // Attacker and Victim is in same teams? Skip code blew
    541.     if (get_member(iAttacker, m_iTeam) == get_member(iVictim, m_iTeam))
    542.         return HC_CONTINUE
    543.    
    544.     // In freeze time? Skip all other plugins (Skip the real trace attack event)
    545.     if (g_bIsZombieFrozen[iVictim] || g_bIsZombieFrozen[iAttacker])
    546.         return HC_SUPERCEDE
    547.    
    548.     if (g_bIsZombie[iAttacker])
    549.     {
    550.         g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
    551.        
    552.         if (!Set_User_Zombie(iVictim, iAttacker, flDamage))
    553.             return HC_SUPERCEDE
    554.        
    555.         if (g_iAliveHumansNum == 1) // Check if this is Last Human, Because of Delay i can't check if it's 0 instead of 1
    556.         {
    557.             // End round event called one time
    558.             g_bEndCalled = true
    559.            
    560.             // Round is Ending
    561.             g_bIsRoundEnding = true
    562.            
    563.             // Zombie Win, Leave text blank so we use ours from ML
    564.             rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
    565.            
    566.             // Show Our Message
    567.             client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
    568.            
    569.             // Excecute round end forward
    570.             ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, ZE_TEAM_ZOMBIE)
    571.         }
    572.     }
    573.    
    574.     return HC_CONTINUE
    575. }
    576.  
    577. public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
    578. {
    579.     // Not Vaild Victim or Attacker so skip the event (Important to block out bounds errors)
    580.     if (!is_user_connected(iVictim) || !is_user_connected(iAttacker))
    581.         return HC_CONTINUE
    582.    
    583.     // Set Knockback here, So if we blocked damage in TraceAttack event player won't get knockback (Fix For Madness)
    584.     if (g_bIsZombie[iVictim] && !g_bIsZombie[iAttacker])
    585.     {
    586.         // Remove Shock Pain
    587.         set_member(iVictim, m_flVelocityModifier, 1.0)
    588.        
    589.         // Set Knockback
    590.         static Float:flOrigin[3]
    591.         get_entvar(iAttacker, var_origin, flOrigin)
    592.         Set_Knockback(iVictim, flOrigin, g_bIsKnockBackUsed[iVictim] ? g_flUserKnockback[iVictim]:get_pcvar_float(g_pCvarZombieKnockback), 2)
    593.     }
    594.    
    595.     return HC_CONTINUE
    596. }
    597.  
    598. public Round_End()
    599. {
    600.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
    601.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
    602.    
    603.     if ((g_iAliveZombiesNum == 0 && g_bGameStarted) || (g_bDisconnectHumanWin))
    604.     {
    605.         ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, ZE_TEAM_HUMAN)
    606.         client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
    607.         g_iHumansScore++
    608.         g_bIsRoundEnding = true
    609.         g_bDisconnectHumanWin = false
    610.         return // To block Execute the code blew
    611.     }
    612.    
    613.     g_iZombiesScore++
    614.     g_bIsRoundEnding = true
    615.    
    616.     // If it's already called one time, don't call it again
    617.     if (!g_bEndCalled)
    618.     {
    619.         ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, ZE_TEAM_ZOMBIE)
    620.     }
    621.    
    622.     client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
    623. }
    624.  
    625. public Event_RoundEnd_Pre(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
    626. {
    627.     // The two unhandeld cases by rg_round_end() native in our Mod
    628.     if (event == ROUND_CTS_WIN || event == ROUND_TERRORISTS_WIN)
    629.     {
    630.         SetHookChainArg(3, ATYPE_FLOAT, get_pcvar_float(g_pCvarRoundEndDelay))
    631.     }
    632. }
    633.  
    634. public Round_Start()
    635. {
    636.     g_flReferenceTime = get_gametime()
    637.     g_iRoundTime = get_member_game(m_iRoundTime)
    638. }
    639.  
    640. public Check_RoundTimeleft()
    641. {
    642.     new Float:flRoundTimeLeft = (g_flReferenceTime + float(g_iRoundTime)) - get_gametime()
    643.    
    644.     if (floatround(flRoundTimeLeft) == 0 && !g_bIsRoundEnding && !get_member_game(m_bFreezePeriod))
    645.     {
    646.         // Round is Ending
    647.         g_bIsRoundEnding = true
    648.        
    649.         // If Time is Out then Terminate the Round
    650.         rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
    651.        
    652.         // Show our Message
    653.         client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
    654.     }
    655. }
    656.  
    657. public client_disconnected(id)
    658. {
    659.     // Reset speed for this dropped id
    660.     g_bHSpeedUsed[id] = false
    661.     g_bZSpeedUsed[id] = false
    662.     g_bIsKnockBackUsed[id] = false
    663.     g_bIsGravityUsed[id] = false
    664.     g_flUserKnockback[id] = 0.0
    665.     g_iUserGravity[id] = 0
    666.    
    667.     remove_task(id)
    668.    
    669.     // Execute our disconnected forward
    670.     ExecuteForward(g_iForwards[FORWARD_DISCONNECT], g_iFwReturn, id)
    671.    
    672.     if (g_iFwReturn >= ZE_STOP)
    673.         return
    674.    
    675.     // Delay Then Check Players to Terminate The round (Delay needed)
    676.     set_task(0.1, "Check_AlivePlayers")
    677. }
    678.  
    679. // This check done when player disconnect
    680. public Check_AlivePlayers()
    681. {
    682.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
    683.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
    684.    
    685.     // Game Started? (There is at least 2 players Alive?)
    686.     if (g_bGameStarted)
    687.     {
    688.         // We are in freeze time?
    689.         if (get_member_game(m_bFreezePeriod))
    690.         {
    691.             // Humans alive number = 1 and no zombies?
    692.             if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers))
    693.             {
    694.                 // Game started false again
    695.                 g_bGameStarted = false
    696.             }
    697.         }
    698.         else // Not freeze time?
    699.         {
    700.             // Variables
    701.             new iAllZombiesNum = GetTeamPlayersNum(CsTeams:TEAM_TERRORIST),
    702.             iAllHumansNum = GetTeamPlayersNum(CsTeams:TEAM_CT),
    703.             iDeadZombiesNum = GetDeadPlayersNum(CsTeams:TEAM_TERRORIST),
    704.             iDeadHumansNum = GetDeadPlayersNum(CsTeams:TEAM_CT)
    705.    
    706.             // Alive humans number = 1 and no zombies at all, And no dead humans?
    707.             if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadHumansNum == 0 && iAllZombiesNum == 0)
    708.             {
    709.                 // Game started is false and humans wins (Escape Success)
    710.                 g_bGameStarted = false
    711.                 g_bDisconnectHumanWin = true
    712.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
    713.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
    714.             }
    715.            
    716.             // Alive zombies number = 1 and no humans at all, And no dead zombies?
    717.             if (g_iAliveZombiesNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadZombiesNum == 0 && iAllHumansNum == 0)
    718.             {
    719.                 // Game started is false and zombies wins (Escape Fail)
    720.                 g_bGameStarted = false
    721.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
    722.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
    723.             }
    724.            
    725.             // Humans number more than 1 and no zombies?
    726.             if (g_iAliveHumansNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveZombiesNum == 0 && !g_bIsRoundEnding)
    727.             {
    728.                 // Then Escape success as there is no Zombies
    729.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
    730.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
    731.             }
    732.            
    733.             // Zombies number more than 1 and no humans?
    734.             if (g_iAliveZombiesNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveHumansNum == 0 && !g_bIsRoundEnding)
    735.             {
    736.                 // Then Escape Fail as there is no humans
    737.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
    738.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
    739.             }
    740.         }
    741.     }
    742. }
    743.  
    744. public client_putinserver(id)
    745. {
    746.     // Add Delay and Check Conditions To start the Game (Delay needed)
    747.     set_task(1.0, "Check_AllPlayersNumber", _, _, _, "b")
    748.    
    749.     // Check for dead terrorists - Bug fix
    750.     set_task(0.1, "CheckTerrorists", id, _, _, "b")
    751. }
    752.  
    753. public CheckTerrorists(id)
    754. {
    755.     if (g_bEnteredNotChoosed[id] && g_bGameStarted)
    756.     {
    757.         if (is_user_connected(id))
    758.         {
    759.             rg_join_team(id, TEAM_CT) // Force user to choose CT
    760.             g_bEnteredNotChoosed[id] = false
    761.         }
    762.     }
    763. }
    764.  
    765. public Fw_HandleMenu_ChoosedAppearance_Post(const index, const slot)
    766. {
    767.     g_bEnteredNotChoosed[index] = false
    768. }
    769.  
    770. public Fw_HandleMenu_ChooseTeam_Post(id, MenuChooseTeam:iSlot)
    771. {
    772.     // Fixing Dead-T restarting the round
    773.     if (iSlot == MenuChoose_T) // Choosed T, Still not choosed a player
    774.     {
    775.         g_bEnteredNotChoosed[id] = true
    776.     }
    777.    
    778.     if ((iSlot == MenuChoose_AutoSelect) && (get_member(id, m_iTeam) == TEAM_TERRORIST))
    779.     {
    780.         g_bEnteredNotChoosed[id] = true
    781.     }
    782.    
    783.     // Add Delay and Check Conditions To start the Game (Delay needed)
    784.     set_task(1.0, "Check_AllPlayersNumber", _, _, _, "b")
    785. }
    786.  
    787. public Check_AllPlayersNumber(TaskID)
    788. {
    789.     if (g_bGameStarted)
    790.     {
    791.         // If game started remove the task and block the blew Checks
    792.         remove_task(TaskID)
    793.         return
    794.     }
    795.    
    796.     if (GetAllAlivePlayersNum() >= get_pcvar_num(g_pCvarReqPlayers))
    797.     {
    798.         // Players In server == The Required so game started is true
    799.         g_bGameStarted = true
    800.        
    801.         // Restart the game
    802.         server_cmd("sv_restart 2")
    803.        
    804.         // Print Fake game Commencing Message
    805.         client_print(0, print_center, "%L", LANG_PLAYER, "START_GAME")
    806.        
    807.         // Remove the task
    808.         remove_task(TaskID)
    809.     }
    810. }
    811.  
    812. Set_User_Human(id)
    813. {
    814.     if (!is_user_alive(id))
    815.         return
    816.    
    817.     g_bIsZombie[id] = false
    818.     set_entvar(id, var_health, get_pcvar_float(g_pCvarHumanHealth))
    819.     set_entvar(id, var_gravity, float(g_bIsGravityUsed[id] ? g_iUserGravity[id]:get_pcvar_num(g_pCvarHumanGravity))/800.0)
    820.     ExecuteForward(g_iForwards[FORWARD_HUMANIZED], g_iFwReturn, id)
    821.    
    822.     // Reset Nightvision (Useful for antidote, so when someone use sethuman native the nightvision also reset)
    823.     Set_NightVision(id, 0, 0, 0x0000, 0, 0, 0, 0)
    824.    
    825.     if (get_member(id, m_iTeam) != TEAM_CT)
    826.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
    827. }
    828.  
    829. Set_User_Zombie(id, iAttacker = 0, Float:flDamage = 0.0)
    830. {
    831.     if (!is_user_alive(id))
    832.         return false
    833.        
    834.     // Execute pre-infection forward
    835.     ExecuteForward(g_iForwards[FORWARD_PRE_INFECTED], g_iFwReturn, id, iAttacker, floatround(flDamage))
    836.    
    837.     if (g_iFwReturn >= ZE_STOP)
    838.     {
    839.         return false
    840.     }
    841.    
    842.     if (iAttacker > 0)
    843.     {
    844.         // Death Message with Infection style, only if infection caused by player not server
    845.         SendDeathMsg(iAttacker, id)
    846.     }
    847.    
    848.     g_bIsZombie[id] = true
    849.    
    850.     set_entvar(id, var_health, float(ze_get_zombie_class_health(id, ze_get_current_zombie_class(id))))
    851.     set_entvar(id, var_gravity, float(g_bIsGravityUsed[id] ? g_iUserGravity[id] : get_pcvar_num(g_pCvarZombieGravity))/800.0)
    852.     rg_remove_all_items(id)
    853.     rg_give_item(id, "weapon_knife", GT_APPEND)
    854.     ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, id, iAttacker)
    855.    
    856.     if (get_member(id, m_iTeam) != TEAM_TERRORIST)
    857.         rg_set_user_team(id, TEAM_TERRORIST, MODEL_UNASSIGNED)
    858.    
    859.     return true
    860. }
    861.  
    862. public Map_Restart()
    863. {
    864.     // Add Delay To help Rest Scores if player kill himself, and there no one else him so round draw (Delay needed)
    865.     set_task(0.1, "Reset_Score_Message")
    866. }
    867.  
    868. public Reset_Score_Message()
    869. {
    870.     g_iHumansScore = 0
    871.     g_iZombiesScore = 0
    872.     g_iRoundNum = 0
    873. }
    874.  
    875. public plugin_end()
    876. {
    877.     if (get_pcvar_num(g_pCvarSmartRandom))
    878.     {
    879.         ArrayDestroy(g_aChosenPlayers)
    880.     }
    881. }
    882.  
    883. public Message_Teamscore()
    884. {
    885.     new szTeam[2]
    886.     get_msg_arg_string(1, szTeam, charsmax(szTeam))
    887.    
    888.     switch (szTeam[0])
    889.     {
    890.         case 'C': set_msg_arg_int(2, get_msg_argtype(2), g_iHumansScore)
    891.         case 'T': set_msg_arg_int(2, get_msg_argtype(2), g_iZombiesScore)
    892.     }
    893. }
    894.  
    895. // Natives
    896. public native_ze_is_user_zombie(id)
    897. {
    898.     if (!is_user_connected(id))
    899.     {
    900.         return -1;
    901.     }
    902.    
    903.     return g_bIsZombie[id]
    904. }
    905.  
    906. public native_ze_set_user_zombie(id)
    907. {
    908.     if (!is_user_connected(id))
    909.     {
    910.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    911.         return false;
    912.     }
    913.    
    914.     Set_User_Zombie(id)
    915.     return true;
    916. }
    917.  
    918. public native_ze_set_user_human(id)
    919. {
    920.     if (!is_user_connected(id))
    921.     {
    922.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    923.         return false;
    924.     }
    925.    
    926.     Set_User_Human(id)
    927.     return true;
    928. }
    929.  
    930. public native_ze_is_game_started()
    931. {
    932.     return g_bGameStarted
    933. }
    934.  
    935. public native_ze_is_zombie_frozen(id)
    936. {
    937.     if (!is_user_connected(id) || !g_bIsZombie[id])
    938.     {
    939.         return -1;
    940.     }
    941.    
    942.     return g_bIsZombieFrozen[id]
    943. }
    944.  
    945. public native_ze_get_round_number()
    946. {
    947.     if (!g_bGameStarted)
    948.     {
    949.         return -1;
    950.     }
    951.    
    952.     return g_iRoundNum
    953. }
    954.  
    955. public native_ze_get_humans_number()
    956. {
    957.     return GetAlivePlayersNum(CsTeams:TEAM_CT)
    958. }
    959.  
    960. public native_ze_get_zombies_number()
    961. {
    962.     return GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
    963. }
    964.  
    965. public native_ze_set_human_speed_factor(id, iFactor)
    966. {
    967.     if (!is_user_connected(id))
    968.     {
    969.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    970.         return false;
    971.     }
    972.    
    973.     g_bHSpeedUsed[id] = true
    974.     g_iHSpeedFactor[id] = iFactor
    975.     rg_reset_maxspeed(id)
    976.     return true;
    977. }
    978.  
    979. public native_ze_reset_human_speed(id)
    980. {
    981.     if (!is_user_connected(id))
    982.     {
    983.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    984.         return false;
    985.     }
    986.    
    987.     g_bHSpeedUsed[id] = false
    988.     rg_reset_maxspeed(id)
    989.     return true;
    990. }
    991.  
    992. public native_ze_set_zombie_speed(id, iSpeed)
    993. {
    994.     if (!is_user_connected(id))
    995.     {
    996.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    997.         return false;
    998.     }
    999.    
    1000.     g_bZSpeedUsed[id] = true
    1001.     g_iZSpeedSet[id] = iSpeed
    1002.     return true;
    1003. }
    1004.  
    1005. public native_ze_reset_zombie_speed(id)
    1006. {
    1007.     if (!is_user_connected(id))
    1008.     {
    1009.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    1010.         return false;
    1011.     }
    1012.    
    1013.     g_bZSpeedUsed[id] = false
    1014.     return true;
    1015. }
    1016.  
    1017. public native_ze_get_user_knockback(id)
    1018. {
    1019.     if (!is_user_connected(id))
    1020.     {
    1021.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    1022.         return -1
    1023.     }
    1024.  
    1025.     return floatround(g_bIsKnockBackUsed[id] ? g_flUserKnockback[id]:get_pcvar_float(g_pCvarZombieKnockback))
    1026. }
    1027.  
    1028. public native_ze_set_user_knockback(id, Float:flKnockback)
    1029. {
    1030.     if (!is_user_connected(id))
    1031.     {
    1032.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    1033.         return false
    1034.     }
    1035.    
    1036.     g_bIsKnockBackUsed[id] = true
    1037.     g_flUserKnockback[id] = flKnockback
    1038.     return true
    1039. }
    1040.  
    1041. public native_ze_reset_user_knockback(id)
    1042. {
    1043.     if (!is_user_connected(id))
    1044.     {
    1045.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    1046.         return false
    1047.     }
    1048.  
    1049.     g_bIsKnockBackUsed[id] = false
    1050.     g_flUserKnockback[id] = 0.0
    1051.     return true
    1052. }
    1053.  
    1054. public native_ze_set_user_gravity(id, iGravity)
    1055. {
    1056.     if (!is_user_connected(id))
    1057.     {
    1058.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    1059.         return false
    1060.     }
    1061.    
    1062.     g_bIsGravityUsed[id] = true
    1063.     g_iUserGravity[id] = iGravity
    1064.     set_entvar(id, var_gravity, float(iGravity) / 800.0)
    1065.  
    1066.     return true
    1067. }
    1068.  
    1069. public native_ze_reset_user_gravity(id)
    1070. {
    1071.     if (!is_user_connected(id))
    1072.     {
    1073.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
    1074.         return false
    1075.     }
    1076.  
    1077.     g_bIsGravityUsed[id] = false
    1078.     set_entvar(id, var_gravity, float(g_bIsZombie[id] ? get_pcvar_num(g_pCvarZombieGravity):get_pcvar_num(g_pCvarHumanGravity)) / 800.0)
    1079.  
    1080.     return true
    1081. }
    1082.  
    1083. public native_ze_remove_zombie_freeze_msg()
    1084. {
    1085.     if (task_exists(TASK_COUNTDOWN2))
    1086.     {
    1087.         remove_task(TASK_COUNTDOWN2)
    1088.         return true
    1089.     }
    1090.    
    1091.     return false
    1092. }
Normal zombies will have health defined in the class they chosen, while first zombies will get the health of their class multiplied by 2.
This what you need?

Re: Health for infected

Posted: 13 Feb 2021, 18:37
by SobekPogrywamy
yes, i will test it

Re: Health for infected

Posted: 14 Feb 2021, 10:14
by SobekPogrywamy
can u add too 1000hp for infections??

Re: Health for infected

Posted: 14 Feb 2021, 17:51
by Raheem
SobekPogrywamy wrote: 3 years ago can u add too 1000hp for infections??
Please explain.

Re: Health for infected

Posted: 16 Feb 2021, 12:06
by SobekPogrywamy
if a zombie infects someone, he will get a reward in the form of 1000hp

Re: Health for infected

Posted: 16 Feb 2021, 12:15
by Raheem
Change:
    1. Set_User_Zombie(id, iAttacker = 0, Float:flDamage = 0.0)
    2. {
    3.     if (!is_user_alive(id))
    4.         return false
    5.        
    6.     // Execute pre-infection forward
    7.     ExecuteForward(g_iForwards[FORWARD_PRE_INFECTED], g_iFwReturn, id, iAttacker, floatround(flDamage))
    8.    
    9.     if (g_iFwReturn >= ZE_STOP)
    10.     {
    11.         return false
    12.     }
    13.    
    14.     if (iAttacker > 0)
    15.     {
    16.         // Death Message with Infection style, only if infection caused by player not server
    17.         SendDeathMsg(iAttacker, id)
    18.     }
    19.    
    20.     g_bIsZombie[id] = true
    21.    
    22.     set_entvar(id, var_health, float(ze_get_zombie_class_health(id, ze_get_current_zombie_class(id))))
    23.     set_entvar(id, var_gravity, float(g_bIsGravityUsed[id] ? g_iUserGravity[id] : get_pcvar_num(g_pCvarZombieGravity))/800.0)
    24.     rg_remove_all_items(id)
    25.     rg_give_item(id, "weapon_knife", GT_APPEND)
    26.     ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, id, iAttacker)
    27.    
    28.     if (get_member(id, m_iTeam) != TEAM_TERRORIST)
    29.         rg_set_user_team(id, TEAM_TERRORIST, MODEL_UNASSIGNED)
    30.    
    31.     return true
    32. }
TO:
    1. Set_User_Zombie(id, iAttacker = 0, Float:flDamage = 0.0)
    2. {
    3.     if (!is_user_alive(id))
    4.         return false
    5.        
    6.     // Execute pre-infection forward
    7.     ExecuteForward(g_iForwards[FORWARD_PRE_INFECTED], g_iFwReturn, id, iAttacker, floatround(flDamage))
    8.    
    9.     if (g_iFwReturn >= ZE_STOP)
    10.     {
    11.         return false
    12.     }
    13.    
    14.     if (iAttacker > 0)
    15.     {
    16.         // Death Message with Infection style, only if infection caused by player not server
    17.         SendDeathMsg(iAttacker, id)
    18.     }
    19.    
    20.     g_bIsZombie[id] = true
    21.    
    22.     set_entvar(id, var_health, float(ze_get_zombie_class_health(id, ze_get_current_zombie_class(id))))
    23.    
    24.     set_entvar(id, var_health, get_entvar(iAttacker, var_health) + 1000.0)
    25.    
    26.     set_entvar(id, var_gravity, float(g_bIsGravityUsed[id] ? g_iUserGravity[id] : get_pcvar_num(g_pCvarZombieGravity))/800.0)
    27.     rg_remove_all_items(id)
    28.     rg_give_item(id, "weapon_knife", GT_APPEND)
    29.     ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, id, iAttacker)
    30.    
    31.     if (get_member(id, m_iTeam) != TEAM_TERRORIST)
    32.         rg_set_user_team(id, TEAM_TERRORIST, MODEL_UNASSIGNED)
    33.    
    34.     return true
    35. }

Re: Health for infected

Posted: 17 Feb 2021, 12:07
by SobekPogrywamy
L 02/17/2021 - 13:06:15: [AMXX] Displaying debug trace (plugin "ze_zombie_class.amxx", version "1.0")
L 02/17/2021 - 13:06:15: [AMXX] Run time error 10: native error (native "ArrayGetCell")
L 02/17/2021 - 13:06:15: [AMXX] [0] ze_zombie_class.sma::native_ze_get_zombie_class_health (line 298)
L 02/17/2021 - 13:06:15: Unhandled dynamic native error
L 02/17/2021 - 13:06:15: [AMXX] Displaying debug trace (plugin "ze_core.amxx", version "1.6")
L 02/17/2021 - 13:06:15: [AMXX] Run time error 10: native error (native "ze_get_zombie_class_health")
L 02/17/2021 - 13:06:15: [AMXX] [0] ze_core.sma::Set_User_Zombie (line 850)
L 02/17/2021 - 13:06:15: [AMXX] [1] ze_core.sma::Choose_Zombies (line 440)
L 02/17/2021 - 13:06:15: [AMXX] [2] ze_core.sma::Countdown_Start (line 410)
L 02/17/2021 - 13:06:16: Invalid index -1 (count: 4)
L 02/17/2021 - 13:06:16: [AMXX] Displaying debug trace (plugin "ze_zombie_class.amxx", version "1.0")
L 02/17/2021 - 13:06:16: [AMXX] Run time error 10: native error (native "ArrayGetCell")
L 02/17/2021 - 13:06:16: [AMXX] [0] ze_zombie_class.sma::native_ze_get_zombie_class_health (line 298)
L 02/17/2021 - 13:06:16: Unhandled dynamic native error
L 02/17/2021 - 13:06:16: [AMXX] Displaying debug trace (plugin "ze_core.amxx", version "1.6")
L 02/17/2021 - 13:06:16: [AMXX] Run time error 10: native error (native "ze_get_zombie_class_health")
L 02/17/2021 - 13:06:16: [AMXX] [0] ze_core.sma::Set_User_Zombie (line 850)
L 02/17/2021 - 13:06:16: [AMXX] [1] ze_core.sma::Choose_Zombies (line 440)
L 02/17/2021 - 13:06:16: [AMXX] [2] ze_core.sma::Countdown_Start (line 410)
L 02/17/2021 - 13:06:17: World triggered "Round_Start"

Re: Health for infected

Posted: 19 Feb 2021, 13:14
by Raheem
SobekPogrywamy wrote: 3 years ago L 02/17/2021 - 13:06:15: [AMXX] Displaying debug trace (plugin "ze_zombie_class.amxx", version "1.0")
L 02/17/2021 - 13:06:15: [AMXX] Run time error 10: native error (native "ArrayGetCell")
L 02/17/2021 - 13:06:15: [AMXX] [0] ze_zombie_class.sma::native_ze_get_zombie_class_health (line 298)
L 02/17/2021 - 13:06:15: Unhandled dynamic native error
L 02/17/2021 - 13:06:15: [AMXX] Displaying debug trace (plugin "ze_core.amxx", version "1.6")
L 02/17/2021 - 13:06:15: [AMXX] Run time error 10: native error (native "ze_get_zombie_class_health")
L 02/17/2021 - 13:06:15: [AMXX] [0] ze_core.sma::Set_User_Zombie (line 850)
L 02/17/2021 - 13:06:15: [AMXX] [1] ze_core.sma::Choose_Zombies (line 440)
L 02/17/2021 - 13:06:15: [AMXX] [2] ze_core.sma::Countdown_Start (line 410)
L 02/17/2021 - 13:06:16: Invalid index -1 (count: 4)
L 02/17/2021 - 13:06:16: [AMXX] Displaying debug trace (plugin "ze_zombie_class.amxx", version "1.0")
L 02/17/2021 - 13:06:16: [AMXX] Run time error 10: native error (native "ArrayGetCell")
L 02/17/2021 - 13:06:16: [AMXX] [0] ze_zombie_class.sma::native_ze_get_zombie_class_health (line 298)
L 02/17/2021 - 13:06:16: Unhandled dynamic native error
L 02/17/2021 - 13:06:16: [AMXX] Displaying debug trace (plugin "ze_core.amxx", version "1.6")
L 02/17/2021 - 13:06:16: [AMXX] Run time error 10: native error (native "ze_get_zombie_class_health")
L 02/17/2021 - 13:06:16: [AMXX] [0] ze_core.sma::Set_User_Zombie (line 850)
L 02/17/2021 - 13:06:16: [AMXX] [1] ze_core.sma::Choose_Zombies (line 440)
L 02/17/2021 - 13:06:16: [AMXX] [2] ze_core.sma::Countdown_Start (line 410)
L 02/17/2021 - 13:06:17: World triggered "Round_Start"
[mention]Night Fury[/mention], Fix the classes core.

Re: Health for infected

Posted: 23 Apr 2021, 19:20
by SobekPogrywamy
:rolling_eyes: