Available Score HUD

Unpaid Requests, Public Plugins
Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#11

Post by Raheem » 2 years ago

Amnesia wrote: 2 years ago
Raheem wrote: 5 years ago
  1. #include <zombie_escape>
  2.  
  3. // Fowards
  4. enum _:TOTAL_FORWARDS
  5. {
  6.     FORWARD_NONE = 0,
  7.     FORWARD_ROUNDEND,
  8.     FORWARD_HUMANIZED,
  9.     FORWARD_PRE_INFECTED,
  10.     FORWARD_INFECTED,
  11.     FORWARD_ZOMBIE_APPEAR,
  12.     FORWARD_ZOMBIE_RELEASE,
  13.     FORWARD_GAME_STARTED
  14. }
  15.  
  16. new g_iForwards[TOTAL_FORWARDS], g_iFwReturn, g_iTeam
  17.  
  18. // Tasks IDs
  19. enum
  20. {
  21.     TASK_COUNTDOWN = 1100,
  22.     TASK_COUNTDOWN2,
  23.     TASK_SCORE_MESSAGE,
  24.     FREEZE_ZOMBIES,
  25.     ROUND_TIME_LEFT
  26. }
  27.  
  28. // Colors (g_pCvarColors[] array indexes)
  29. enum
  30. {
  31.     Red = 0,
  32.     Green,
  33.     Blue
  34. }
  35.  
  36. // Variables
  37. new g_iAliveHumansNum,
  38.     g_iAliveZombiesNum,
  39.     g_iRoundTime,
  40.     g_iCountDown,
  41.     g_iReleaseNotice,
  42.     g_iMaxClients,
  43.     g_iHumansScore,
  44.     g_iZombiesScore,
  45.     g_iRoundNum,
  46.     g_iHSpeedFactor[33],
  47.     g_iZSpeedSet[33],
  48.     bool:g_bGameStarted,
  49.     bool:g_bIsZombie[33],
  50.     bool:g_bIsZombieFrozen[33],
  51.     bool:g_bZombieFreezeTime,
  52.     bool:g_bIsRoundEnding,
  53.     bool:g_bHSpeedUsed[33],
  54.     bool:g_bZSpeedUsed[33],
  55.     bool:g_bEndCalled,
  56.     Float:g_flReferenceTime
  57.  
  58. // Cvars
  59. new g_pCvarHumanSpeedFactor,
  60.     g_pCvarHumanGravity,
  61.     g_pCvarHumanHealth,
  62.     g_pCvarZombieSpeed,
  63.     g_pCvarZombieGravity,
  64.     g_pCvarZombieReleaseTime,
  65.     g_pCvarFreezeTime,
  66.     g_pCvarRoundTime,
  67.     g_pCvarReqPlayers,
  68.     g_pCvarZombieHealth,
  69.     g_pCvarFirstZombiesHealth,
  70.     g_pCvarZombieKnockback,
  71.     g_pCvarScoreMessageType,
  72.     g_pCvarColors[3],
  73.     g_pCvarRoundEndDelay
  74.  
  75. public plugin_natives()
  76. {
  77.     register_native("ze_is_user_zombie", "native_ze_is_user_zombie", 1)
  78.     register_native("ze_is_game_started", "native_ze_is_game_started", 1)
  79.     register_native("ze_is_zombie_frozen", "native_ze_is_zombie_frozen", 1)
  80.    
  81.     register_native("ze_get_round_number", "native_ze_get_round_number", 1)
  82.     register_native("ze_get_humans_number", "native_ze_get_humans_number", 1)
  83.     register_native("ze_get_zombies_number", "native_ze_get_zombies_number", 1)
  84.    
  85.     register_native("ze_set_user_zombie", "native_ze_set_user_zombie", 1)
  86.     register_native("ze_set_user_human", "native_ze_set_user_human", 1)
  87.     register_native("ze_set_human_speed_factor", "native_ze_set_human_speed_factor", 1)
  88.     register_native("ze_set_zombie_speed", "native_ze_set_zombie_speed", 1)
  89.    
  90.     register_native("ze_reset_human_speed", "native_ze_reset_human_speed", 1)
  91.     register_native("ze_reset_zombie_speed", "native_ze_reset_zombie_speed", 1)
  92. }
  93.  
  94. public plugin_init()
  95. {
  96.     register_plugin("[ZE] Core/Engine", ZE_VERSION, AUTHORS)
  97.    
  98.     // Hook Chains
  99.     RegisterHookChain(RG_CBasePlayer_TraceAttack, "Fw_TraceAttack_Pre", 0)
  100.     RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
  101.     RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
  102.     RegisterHookChain(RG_CSGameRules_CheckWinConditions, "Fw_CheckMapConditions_Post", 1)
  103.     RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
  104.     RegisterHookChain(RG_RoundEnd, "Event_RoundEnd_Pre", 0)
  105.    
  106.     // Events
  107.     register_event("HLTV", "New_Round", "a", "1=0", "2=0")
  108.     register_event("TextMsg", "Map_Restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in", "2=#Round_Draw")
  109.     register_logevent("Round_Start", 2, "1=Round_Start")
  110.     register_logevent("Round_End", 2, "1=Round_End")
  111.    
  112.     // Hams
  113.     RegisterHam(Ham_Item_PreFrame, "player", "Fw_RestMaxSpeed_Post", 1)
  114.    
  115.     // Create Forwards (All Return Values Ignored)
  116.     g_iForwards[FORWARD_ROUNDEND] = CreateMultiForward("ze_roundend", ET_IGNORE, FP_CELL)
  117.     g_iForwards[FORWARD_HUMANIZED] = CreateMultiForward("ze_user_humanized", ET_IGNORE, FP_CELL)
  118.     g_iForwards[FORWARD_PRE_INFECTED] = CreateMultiForward("ze_user_infected_pre", ET_CONTINUE, FP_CELL, FP_CELL)
  119.     g_iForwards[FORWARD_INFECTED] = CreateMultiForward("ze_user_infected", ET_IGNORE, FP_CELL, FP_CELL)
  120.     g_iForwards[FORWARD_ZOMBIE_APPEAR] = CreateMultiForward("ze_zombie_appear", ET_IGNORE)
  121.     g_iForwards[FORWARD_ZOMBIE_RELEASE] = CreateMultiForward("ze_zombie_release", ET_IGNORE)
  122.     g_iForwards[FORWARD_GAME_STARTED] = CreateMultiForward("ze_game_started", ET_IGNORE)
  123.    
  124.     // Hud Messages
  125.     g_iReleaseNotice = CreateHudSyncObj()
  126.    
  127.     // Sequential files (.txt)
  128.     register_dictionary("zombie_escape.txt")
  129.    
  130.     // Humans Cvars
  131.     g_pCvarHumanSpeedFactor = register_cvar("ze_human_speed_factor", "20.0")
  132.     g_pCvarHumanGravity = register_cvar("ze_human_gravity", "800")
  133.     g_pCvarHumanHealth = register_cvar("ze_human_health", "1000")
  134.    
  135.     // Zombie Cvars
  136.     g_pCvarZombieSpeed = register_cvar("ze_zombie_speed", "350.0")
  137.     g_pCvarZombieGravity = register_cvar("ze_zombie_gravity", "640")
  138.     g_pCvarZombieHealth = register_cvar("ze_zombie_health", "10000")
  139.     g_pCvarFirstZombiesHealth = register_cvar("ze_first_zombies_health", "20000")
  140.     g_pCvarZombieKnockback = register_cvar("ze_zombie_knockback", "300.0")
  141.    
  142.     // General Cvars
  143.     g_pCvarZombieReleaseTime = register_cvar("ze_release_time", "15")
  144.     g_pCvarFreezeTime = register_cvar("ze_freeze_time", "20")
  145.     g_pCvarRoundTime = register_cvar("ze_round_time", "9.0")
  146.     g_pCvarReqPlayers = register_cvar("ze_required_players", "2")
  147.     g_pCvarScoreMessageType = register_cvar("ze_score_message_type", "1")
  148.     g_pCvarColors[Red] = register_cvar("ze_score_message_red", "200")
  149.     g_pCvarColors[Green] = register_cvar("ze_score_message_green", "100")
  150.     g_pCvarColors[Blue] = register_cvar("ze_score_message_blue", "0")
  151.     g_pCvarRoundEndDelay = register_cvar("ze_round_end_delay", "5")
  152.    
  153.     // Default Values
  154.     g_bGameStarted = false
  155.    
  156.     // Static Values
  157.     g_iMaxClients = get_member_game(m_nMaxPlayers)
  158.    
  159.     // Check Round Time to Terminate it
  160.     set_task(1.0, "Check_RoundTimeleft", ROUND_TIME_LEFT, _, _, "b")
  161. }
  162.  
  163. public plugin_cfg()
  164. {
  165.     // Get our configiration file and Execute it
  166.     new szCfgDir[64]
  167.     get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir))
  168.     server_cmd("exec %s/zombie_escape.cfg", szCfgDir)
  169.    
  170.     // Set Game Name
  171.     new szGameName[64]
  172.     formatex(szGameName, sizeof(szGameName), "Premuim ZE v%s", ZE_VERSION)
  173.     set_member_game(m_GameDesc, szGameName)
  174.    
  175.     // Set Version
  176.     register_cvar("ze_version", ZE_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  177.     set_cvar_string("ze_version", ZE_VERSION)
  178. }
  179.  
  180. public Fw_CheckMapConditions_Post()
  181. {
  182.     // Block Game Commencing
  183.     set_member_game(m_bGameStarted, true)
  184.    
  185.     // Set Freeze Time
  186.     set_member_game(m_iIntroRoundTime, get_pcvar_num(g_pCvarFreezeTime))
  187.    
  188.     // Set Round Time
  189.     set_member_game(m_iRoundTime, floatround(get_pcvar_float(g_pCvarRoundTime) * 60.0))
  190. }
  191.  
  192. public Fw_PlayerKilled_Post(id)
  193. {
  194.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
  195.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  196.    
  197.     if (g_iAliveHumansNum == 0 && g_iAliveZombiesNum == 0)
  198.     {
  199.         // No Winner, All Players in one team killed Or Both teams Killed
  200.         client_print(0, print_center, "%L", LANG_PLAYER, "NO_WINNER")
  201.     }
  202. }
  203.  
  204. public Fw_RestMaxSpeed_Post(id)
  205. {
  206.     if (!g_bIsZombie[id])
  207.     {
  208.         static Float:flMaxSpeed
  209.         get_entvar(id, var_maxspeed, flMaxSpeed)
  210.        
  211.         if (flMaxSpeed != 1.0 && is_user_alive(id))
  212.         {
  213.             if (g_bHSpeedUsed[id])
  214.             {
  215.                 // Set New Human Speed Factor
  216.                 set_entvar(id, var_maxspeed, flMaxSpeed + float(g_iHSpeedFactor[id]))
  217.                 return HAM_IGNORED
  218.             }
  219.                
  220.             // Set Human Speed Factor, native not used
  221.             set_entvar(id, var_maxspeed, flMaxSpeed + get_pcvar_float(g_pCvarHumanSpeedFactor))
  222.             return HAM_IGNORED
  223.         }
  224.     }
  225.    
  226.     return HAM_SUPERCEDE
  227. }
  228.  
  229. public Fw_PlayerSpawn_Post(id)
  230. {  
  231.     if (!g_bGameStarted)
  232.     {
  233.         // Force All player to be Humans if Game not started yet
  234.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
  235.     }
  236.     else
  237.     {
  238.         if (get_member_game(m_bFreezePeriod))
  239.         {
  240.             // Respawn Him As human if we are in freeze time (Zombie Not Chosen yet)
  241.             Set_User_Human(id)
  242.             g_bIsZombieFrozen[id] = false
  243.         }
  244.         else
  245.         {
  246.             if (g_bZombieFreezeTime)
  247.             {
  248.                 // Zombie Chosen and zombies Frozen, Spawn him as zombie and Freeze Him
  249.                 Set_User_Zombie(id)
  250.                 g_bIsZombieFrozen[id] = true
  251.                 set_entvar(id, var_maxspeed, 1.0)
  252.             }
  253.             else
  254.             {
  255.                 // Respawn him as normal zombie
  256.                 Set_User_Zombie(id)
  257.                 g_bIsZombieFrozen[id] = false
  258.             }
  259.         }
  260.     }
  261. }
  262.  
  263. public New_Round()
  264. {
  265.     // Remove All tasks in the New Round
  266.     remove_task(TASK_COUNTDOWN)
  267.     remove_task(TASK_COUNTDOWN2)
  268.     remove_task(TASK_SCORE_MESSAGE)
  269.     remove_task(FREEZE_ZOMBIES)
  270.    
  271.     // Score Message Task
  272.     set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
  273.    
  274.     // 2 is Hardcoded Value, It's Fix for the countdown to work correctly
  275.     g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 2
  276.    
  277.     if (!g_bGameStarted)
  278.     {
  279.         // No Enough Players
  280.         ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
  281.         return // Block the execution of the blew code
  282.     }
  283.    
  284.     // Game Already started, Countdown now started
  285.     set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
  286.     ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
  287.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
  288.    
  289.     g_iRoundNum++
  290.    
  291.     // Round Starting
  292.     g_bIsRoundEnding = false
  293.     g_bEndCalled = false
  294. }
  295.  
  296. // Score Message Task
  297. public Score_Message(TaskID)
  298. {
  299.     switch(get_pcvar_num(g_pCvarScoreMessageType))
  300.     {
  301.         case 0: // Disabled
  302.         {
  303.             return
  304.         }
  305.         case 1: // DHUD
  306.         {
  307.             set_dhudmessage(0, 255, 0, 0.38, 0.01, 0, 0.0, 9.0)
  308.             show_dhudmessage(0, "Survivors")
  309.            
  310.             set_dhudmessage(255, 255, 255, -1.0, 0.01, 0, 0.0, 9.0)
  311.             show_dhudmessage(0, "[VS]")
  312.            
  313.             set_dhudmessage(255, 0, 0, 0.54, 0.01, 0, 0.0, 9.0)
  314.             show_dhudmessage(0, "Zombies")
  315.            
  316.             set_dhudmessage(255, 255, 255, -1.0, 0.045, 0, 0.0, 9.0)
  317.             show_dhudmessage(0, "[%i] --------- [%i]", g_iHumansScore, g_iZombiesScore)
  318.  
  319.             set_dhudmessage( .red = 0, .green = 255, .blue = 0, .x = -1.0, .y = 0.02, .effects = 0, .fxtime = 6.0, .holdtime = 2.0, .fadeintime = 1.0, .fadeouttime = 1.0);
  320.             show_dhudmessage( 0, "%L                        ", LANG_PLAYER, "SCORE_HUMANS", native_ze_get_humans_number() );
  321.             set_dhudmessage( .red = 100, .green = 100, .blue = 100, .x = -1.0, .y = 0.02, .effects = 0, .fxtime = 6.0, .holdtime = 2.0, .fadeintime = 1.0, .fadeouttime = 1.0);
  322.             show_dhudmessage( 0, "%L^n%L", LANG_PLAYER, "SCORE_ROUND", g_iRoundNum, LANG_PLAYER,  "SCORE_WINS", g_iHumansScore,  g_iZombiesScore );
  323.             set_dhudmessage( .red = 255, .green = 0, .blue = 0, .x = -1.0, .y = 0.02, .effects = 0, .fxtime = 6.0, .holdtime = 2.0, .fadeintime = 1.0, .fadeouttime = 1.0);
  324.             show_dhudmessage( 0, "                         %L", LANG_PLAYER, "SCORE_ZOMBIES", native_ze_get_zombies_number() );
  325.         }
  326.         case 2: // HUD
  327.         {
  328.             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)
  329.             show_hudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
  330.         }
  331.     }
  332. }
  333.  
  334. public Countdown_Start(TaskID)
  335. {
  336.     // Check if the players Disconnected and there is only one player then remove all messages, and stop tasks
  337.     if (!g_bGameStarted)
  338.         return
  339.    
  340.     if (!g_iCountDown)
  341.     {
  342.         Choose_Zombies()
  343.         remove_task(TASK_COUNTDOWN) // Remove the task
  344.         return // Block the execution of the blew code
  345.     }
  346.    
  347.     set_hudmessage(random(256), random(256), random(256), -1.0, 0.21, 0, 0.8, 0.8)
  348.     show_hudmessage(0, "%L", LANG_PLAYER, "RUN_NOTICE", g_iCountDown)
  349.  
  350.     g_iCountDown--
  351. }
  352.  
  353. public Choose_Zombies()
  354. {
  355.     new iZombies, id, iAliveCount
  356.     new iReqZombies
  357.    
  358.     // Get total alive players and required players
  359.     iAliveCount  = GetAllAlivePlayersNum()
  360.     iReqZombies = RequiredZombies()
  361.    
  362.     // Loop till we find req players
  363.     while(iZombies < iReqZombies)
  364.     {
  365.         id = GetRandomAlive(random_num(1, iAliveCount))
  366.        
  367.         if (!is_user_alive(id) || g_bIsZombie[id])
  368.             continue
  369.  
  370.         Set_User_Zombie(id)
  371.         set_entvar(id, var_health, get_pcvar_float(g_pCvarFirstZombiesHealth))
  372.         g_bIsZombieFrozen[id] = true
  373.         g_bZombieFreezeTime = true
  374.         set_entvar(id, var_maxspeed, 1.0)
  375.         set_task(0.1, "Freeze_Zombies", FREEZE_ZOMBIES, _, _, "b") // Better than PreThink
  376.         ExecuteForward(g_iForwards[FORWARD_ZOMBIE_APPEAR], g_iFwReturn)
  377.         iZombies++
  378.        
  379.         // Respawn Zombies to base
  380.         rg_round_respawn(id)
  381.     }
  382.    
  383.     // 2 is Hardcoded Value, It's Fix for the countdown to work correctly
  384.     g_iCountDown = get_pcvar_num(g_pCvarZombieReleaseTime) - 2
  385.    
  386.     set_task(1.0, "ReleaseZombie_CountDown", TASK_COUNTDOWN2, _, _, "b")
  387. }
  388.  
  389. public ReleaseZombie_CountDown(TaskID)
  390. {
  391.     if (!g_iCountDown)
  392.     {
  393.         ReleaseZombie()
  394.         remove_task(TASK_COUNTDOWN2)
  395.         return
  396.     }
  397.    
  398.     // Release Hud Message
  399.     set_hudmessage(255, 255, 0, -1.0, 0.21, 1, 2.0, 2.0)
  400.     ShowSyncHudMsg(0, g_iReleaseNotice, "%L", LANG_PLAYER, "ZOMBIE_RELEASE", g_iCountDown)
  401.    
  402.     g_iCountDown --
  403. }
  404.  
  405. public ReleaseZombie()
  406. {
  407.     ExecuteForward(g_iForwards[FORWARD_ZOMBIE_RELEASE], g_iFwReturn)
  408.    
  409.     for(new id = 1; id <= g_iMaxClients; id++)
  410.     {
  411.         if (is_user_alive(id) && g_bIsZombie[id])
  412.         {
  413.             g_bIsZombieFrozen[id] = false
  414.             g_bZombieFreezeTime = false
  415.         }
  416.     }
  417. }
  418.  
  419. public Freeze_Zombies(TaskID)
  420. {
  421.     for(new id = 1; id <= g_iMaxClients; id++)
  422.     {
  423.         if(!is_user_alive(id) || !g_bIsZombie[id])
  424.             continue
  425.        
  426.         if (g_bIsZombieFrozen[id])
  427.         {
  428.             // Zombie & Frozen, then Freeze him
  429.             set_entvar(id, var_maxspeed, 1.0)
  430.         }
  431.         else
  432.         {
  433.             if (g_bZSpeedUsed[id])
  434.             {
  435.                 // Zombie but Not Frozen the set his speed form .cfg
  436.                 set_entvar(id, var_maxspeed, float(g_iZSpeedSet[id]))
  437.                 continue;
  438.             }
  439.                
  440.             // Zombie but Not Frozen the set his speed form .cfg
  441.             set_entvar(id, var_maxspeed, get_pcvar_float(g_pCvarZombieSpeed))
  442.         }
  443.     }
  444. }
  445.  
  446. public Fw_TraceAttack_Pre(iVictim, iAttacker, Float:flDamage, Float:flDirection[3], iTracehandle, bitsDamageType)
  447. {
  448.     if (iVictim == iAttacker || !is_user_connected(iVictim) || !is_user_connected(iAttacker))
  449.         return HC_CONTINUE
  450.    
  451.     // Attacker and Victim is in same teams? Skip code blew
  452.     if (get_member(iAttacker, m_iTeam) == get_member(iVictim, m_iTeam))
  453.         return HC_CONTINUE
  454.    
  455.     // In freeze time? Skip all other plugins (Skip the real trace attack event)
  456.     if (g_bIsZombieFrozen[iVictim] || g_bIsZombieFrozen[iAttacker])
  457.         return HC_SUPERCEDE
  458.    
  459.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
  460.    
  461.     if (g_bIsZombie[iAttacker])
  462.     {
  463.         // Death Message with Infection style [Added here because of delay in Forward use]
  464.         SendDeathMsg(iAttacker, iVictim)
  465.        
  466.         ExecuteForward(g_iForwards[FORWARD_PRE_INFECTED], g_iFwReturn, iVictim, iAttacker)
  467.        
  468.         if (g_iFwReturn > 0)
  469.         {
  470.             return HC_CONTINUE
  471.         }
  472.        
  473.         Set_User_Zombie(iVictim)
  474.        
  475.         ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, iVictim, iAttacker)
  476.        
  477.         if (g_iAliveHumansNum == 1) // Check if this is Last Human, Because of Delay i can't check if it's 0 instead of 1
  478.         {
  479.             // End round event called one time
  480.             g_bEndCalled = true
  481.            
  482.             // Round is Ending
  483.             g_bIsRoundEnding = true
  484.            
  485.             // Zombie Win, Leave text blank so we use ours from ML
  486.             rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  487.            
  488.             // Show Our Message
  489.             client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  490.            
  491.             // This needed so forward work also to add +1 for Zombies
  492.             g_iTeam = 1 // ZE_TEAM_ZOMBIE
  493.             ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
  494.         }
  495.     }
  496.    
  497.     return HC_CONTINUE
  498. }
  499.  
  500. public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
  501. {
  502.     // Not Vaild Victim or Attacker so skip the event (Important to block out bounds errors)
  503.     if (!is_user_connected(iVictim) || !is_user_connected(iAttacker))
  504.         return HC_CONTINUE
  505.    
  506.     // Set Knockback here, So if we blocked damage in TraceAttack event player won't get knockback (Fix For Madness)
  507.     if (g_bIsZombie[iVictim] && !g_bIsZombie[iAttacker])
  508.     {
  509.         // Remove Shock Pain
  510.         set_member(iVictim, m_flVelocityModifier, 1.0)
  511.        
  512.         // Set Knockback
  513.         static Float:flOrigin[3]
  514.         get_entvar(iAttacker, var_origin, flOrigin)
  515.         Set_Knockback(iVictim, flOrigin, get_pcvar_float(g_pCvarZombieKnockback), 2)
  516.     }
  517.    
  518.     return HC_CONTINUE
  519. }
  520.  
  521. public Round_End()
  522. {
  523.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  524.    
  525.     if (g_iAliveZombiesNum == 0 && g_bGameStarted)
  526.     {
  527.         g_iTeam = 2 // ZE_TEAM_HUMAN
  528.         ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
  529.         client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
  530.         g_iHumansScore++
  531.         g_bIsRoundEnding = true
  532.         return // To block Execute the code blew
  533.     }
  534.    
  535.     g_iTeam = 1 // ZE_TEAM_ZOMBIE
  536.     g_iZombiesScore++
  537.     g_bIsRoundEnding = true
  538.    
  539.     // If it's already called one time, don't call it again
  540.     if (!g_bEndCalled)
  541.     {
  542.         ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
  543.     }
  544.    
  545.     client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  546. }
  547.  
  548. public Event_RoundEnd_Pre(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
  549. {
  550.     // The two unhandeld cases by rg_round_end() native in our Mod
  551.     if (event == ROUND_CTS_WIN || event == ROUND_TERRORISTS_WIN)
  552.     {
  553.         SetHookChainArg(3, ATYPE_FLOAT, get_pcvar_float(g_pCvarRoundEndDelay))
  554.     }
  555. }
  556.  
  557. public Round_Start()
  558. {
  559.     g_flReferenceTime = get_gametime()
  560.     g_iRoundTime = get_member_game(m_iRoundTime)
  561. }
  562.  
  563. public Check_RoundTimeleft()
  564. {
  565.     new Float:flRoundTimeLeft = (g_flReferenceTime + float(g_iRoundTime)) - get_gametime()
  566.    
  567.     if (floatround(flRoundTimeLeft) == 0)
  568.     {
  569.         // Round is Ending
  570.         g_bIsRoundEnding = true
  571.        
  572.         // If Time is Out then Terminate the Round
  573.         rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  574.        
  575.         // Show our Message
  576.         client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  577.     }
  578. }
  579.  
  580. public client_disconnected(id)
  581. {
  582.     // Delay Then Check Players to Terminate The round (Delay needed)
  583.     set_task(0.1, "Check_AlivePlayers")
  584.    
  585.     // Reset speed for this dropped id
  586.     g_bHSpeedUsed[id] = false
  587.     g_bZSpeedUsed[id] = false
  588. }
  589.  
  590. // This check done when player disconnect
  591. public Check_AlivePlayers()
  592. {
  593.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  594.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
  595.    
  596.     // Game Started? (There is at least 2 players Alive?)
  597.     if (g_bGameStarted)
  598.     {
  599.         // We are in freeze time?
  600.         if (get_member_game(m_bFreezePeriod))
  601.         {
  602.             // Humans alive number = 1 and no zombies?
  603.             if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers))
  604.             {
  605.                 // Game started false again
  606.                 g_bGameStarted = false
  607.             }
  608.         }
  609.         else // Not freeze time?
  610.         {
  611.             // Variables
  612.             new iAllZombiesNum = GetTeamPlayersNum(CsTeams:TEAM_TERRORIST),
  613.             iAllHumansNum = GetTeamPlayersNum(CsTeams:TEAM_CT),
  614.             iDeadZombiesNum = GetDeadPlayersNum(CsTeams:TEAM_TERRORIST),
  615.             iDeadHumansNum = GetDeadPlayersNum(CsTeams:TEAM_CT)
  616.    
  617.             // Alive humans number = 1 and no zombies at all, And no dead humans?
  618.             if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadHumansNum == 0 && iAllZombiesNum == 0)
  619.             {
  620.                 // Game started is false and humans wins (Escape Success)
  621.                 g_bGameStarted = false
  622.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
  623.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
  624.             }
  625.            
  626.             // Alive zombies number = 1 and no humans at all, And no dead zombies?
  627.             if (g_iAliveZombiesNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadZombiesNum == 0 && iAllHumansNum == 0)
  628.             {
  629.                 // Game started is false and zombies wins (Escape Fail)
  630.                 g_bGameStarted = false
  631.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  632.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  633.             }
  634.            
  635.             // Humans number more than 1 and no zombies?
  636.             if (g_iAliveHumansNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveZombiesNum == 0 && !g_bIsRoundEnding)
  637.             {
  638.                 // Then Escape success as there is no Zombies
  639.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
  640.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
  641.             }
  642.            
  643.             // Zombies number more than 1 and no humans?
  644.             if (g_iAliveZombiesNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveHumansNum == 0 && !g_bIsRoundEnding)
  645.             {
  646.                 // Then Escape Fail as there is no humans
  647.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  648.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  649.             }
  650.         }
  651.     }
  652. }
  653.  
  654. public client_putinserver(id)
  655. {
  656.     // Add Delay and Check Conditions To start the Game (Delay needed)
  657.     set_task(1.0, "Check_AllPlayersNumber", _, _, _, "b")
  658. }
  659.  
  660. public Check_AllPlayersNumber(TaskID)
  661. {
  662.     if (g_bGameStarted)
  663.     {
  664.         // If game started remove the task and block the blew Checks
  665.         remove_task(TaskID)
  666.         return
  667.     }
  668.    
  669.     if (GetAllAlivePlayersNum() >= get_pcvar_num(g_pCvarReqPlayers))
  670.     {
  671.         // Players In server == The Required so game started is true
  672.         g_bGameStarted = true
  673.        
  674.         // Restart the game
  675.         server_cmd("sv_restart 2")
  676.        
  677.         // Print Fake game Commencing Message
  678.         client_print(0, print_center, "%L", LANG_PLAYER, "START_GAME")
  679.        
  680.         // Remove the task
  681.         remove_task(TaskID)
  682.     }
  683. }
  684.  
  685. public Set_User_Human(id)
  686. {
  687.     if (!is_user_alive(id))
  688.         return
  689.    
  690.     g_bIsZombie[id] = false
  691.     set_entvar(id, var_health, get_pcvar_float(g_pCvarHumanHealth))
  692.     set_entvar(id, var_gravity, get_pcvar_float(g_pCvarHumanGravity)/800.0)
  693.     ExecuteForward(g_iForwards[FORWARD_HUMANIZED], g_iFwReturn, id)
  694.    
  695.     if (get_member(id, m_iTeam) != TEAM_CT)
  696.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
  697. }
  698.  
  699. public Set_User_Zombie(id)
  700. {
  701.     if (!is_user_alive(id))
  702.         return
  703.    
  704.     g_bIsZombie[id] = true
  705.     set_entvar(id, var_health, get_pcvar_float(g_pCvarZombieHealth))
  706.     set_entvar(id, var_gravity, get_pcvar_float(g_pCvarZombieGravity)/800.0)
  707.     rg_remove_all_items(id)
  708.     rg_give_item(id, "weapon_knife", GT_APPEND)
  709.     ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, id, 0)
  710.    
  711.     if (get_member(id, m_iTeam) != TEAM_TERRORIST)
  712.         rg_set_user_team(id, TEAM_TERRORIST, MODEL_UNASSIGNED)
  713. }
  714.  
  715. public Map_Restart()
  716. {
  717.     // Add Delay To help Rest Scores if player kill himself, and there no one else him so round draw (Delay needed)
  718.     set_task(0.1, "Reset_Score_Message")
  719. }
  720.  
  721. public Reset_Score_Message()
  722. {
  723.     g_iHumansScore = 0
  724.     g_iZombiesScore = 0
  725.     g_iRoundNum = 0
  726. }
  727.  
  728. // Natives
  729. public native_ze_is_user_zombie(id)
  730. {
  731.     if (!is_user_connected(id))
  732.     {
  733.         return -1;
  734.     }
  735.    
  736.     return g_bIsZombie[id]
  737. }
  738.  
  739. public native_ze_set_user_zombie(id)
  740. {
  741.     if (!is_user_connected(id))
  742.     {
  743.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  744.         return false;
  745.     }
  746.    
  747.     Set_User_Zombie(id)
  748.     return true;
  749. }
  750.  
  751. public native_ze_set_user_human(id)
  752. {
  753.     if (!is_user_connected(id))
  754.     {
  755.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  756.         return false;
  757.     }
  758.    
  759.     Set_User_Human(id)
  760.     return true;
  761. }
  762.  
  763. public native_ze_is_game_started()
  764. {
  765.     return g_bGameStarted
  766. }
  767.  
  768. public native_ze_is_zombie_frozen(id)
  769. {
  770.     if (!is_user_connected(id) || !g_bIsZombie[id])
  771.     {
  772.         return -1;
  773.     }
  774.    
  775.     return g_bIsZombieFrozen[id]
  776. }
  777.  
  778. public native_ze_get_round_number()
  779. {
  780.     if (!g_bGameStarted)
  781.     {
  782.         return -1;
  783.     }
  784.    
  785.     return g_iRoundNum
  786. }
  787.  
  788. public native_ze_get_humans_number()
  789. {
  790.     return GetAlivePlayersNum(CsTeams:TEAM_CT)
  791. }
  792.  
  793. public native_ze_get_zombies_number()
  794. {
  795.     return GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  796. }
  797.  
  798. public native_ze_set_human_speed_factor(id, iFactor)
  799. {
  800.     if (!is_user_connected(id))
  801.     {
  802.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  803.         return false;
  804.     }
  805.    
  806.     g_bHSpeedUsed[id] = true
  807.     g_iHSpeedFactor[id] = iFactor
  808.     ExecuteHamB(Ham_Item_PreFrame, id)
  809.     return true;
  810. }
  811.  
  812. public native_ze_reset_human_speed(id)
  813. {
  814.     if (!is_user_connected(id))
  815.     {
  816.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  817.         return false;
  818.     }
  819.    
  820.     g_bHSpeedUsed[id] = false
  821.     ExecuteHamB(Ham_Item_PreFrame, id)
  822.     return true;
  823. }
  824.  
  825. public native_ze_set_zombie_speed(id, iSpeed)
  826. {
  827.     if (!is_user_connected(id))
  828.     {
  829.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  830.         return false;
  831.     }
  832.    
  833.     g_bZSpeedUsed[id] = true
  834.     g_iZSpeedSet[id] = iSpeed
  835.     return true;
  836. }
  837.  
  838. public native_ze_reset_zombie_speed(id)
  839. {
  840.     if (!is_user_connected(id))
  841.     {
  842.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  843.         return false;
  844.     }
  845.    
  846.     g_bZSpeedUsed[id] = false
  847.     return true;
  848. }
Error :

Code: Select all

 register_native("ze_is_user_zombie", "native_ze_is_user_zombie", 1)
Explain what error you get?
He who fails to plan is planning to fail

User avatar
Amnesia
Member
Member
Posts: 27
Joined: 2 years ago
Contact:

#12

Post by Amnesia » 2 years ago

Raheem wrote: 2 years ago
Amnesia wrote: 2 years ago
Raheem wrote: 5 years ago
  1. #include <zombie_escape>
  2.  
  3. // Fowards
  4. enum _:TOTAL_FORWARDS
  5. {
  6.     FORWARD_NONE = 0,
  7.     FORWARD_ROUNDEND,
  8.     FORWARD_HUMANIZED,
  9.     FORWARD_PRE_INFECTED,
  10.     FORWARD_INFECTED,
  11.     FORWARD_ZOMBIE_APPEAR,
  12.     FORWARD_ZOMBIE_RELEASE,
  13.     FORWARD_GAME_STARTED
  14. }
  15.  
  16. new g_iForwards[TOTAL_FORWARDS], g_iFwReturn, g_iTeam
  17.  
  18. // Tasks IDs
  19. enum
  20. {
  21.     TASK_COUNTDOWN = 1100,
  22.     TASK_COUNTDOWN2,
  23.     TASK_SCORE_MESSAGE,
  24.     FREEZE_ZOMBIES,
  25.     ROUND_TIME_LEFT
  26. }
  27.  
  28. // Colors (g_pCvarColors[] array indexes)
  29. enum
  30. {
  31.     Red = 0,
  32.     Green,
  33.     Blue
  34. }
  35.  
  36. // Variables
  37. new g_iAliveHumansNum,
  38.     g_iAliveZombiesNum,
  39.     g_iRoundTime,
  40.     g_iCountDown,
  41.     g_iReleaseNotice,
  42.     g_iMaxClients,
  43.     g_iHumansScore,
  44.     g_iZombiesScore,
  45.     g_iRoundNum,
  46.     g_iHSpeedFactor[33],
  47.     g_iZSpeedSet[33],
  48.     bool:g_bGameStarted,
  49.     bool:g_bIsZombie[33],
  50.     bool:g_bIsZombieFrozen[33],
  51.     bool:g_bZombieFreezeTime,
  52.     bool:g_bIsRoundEnding,
  53.     bool:g_bHSpeedUsed[33],
  54.     bool:g_bZSpeedUsed[33],
  55.     bool:g_bEndCalled,
  56.     Float:g_flReferenceTime
  57.  
  58. // Cvars
  59. new g_pCvarHumanSpeedFactor,
  60.     g_pCvarHumanGravity,
  61.     g_pCvarHumanHealth,
  62.     g_pCvarZombieSpeed,
  63.     g_pCvarZombieGravity,
  64.     g_pCvarZombieReleaseTime,
  65.     g_pCvarFreezeTime,
  66.     g_pCvarRoundTime,
  67.     g_pCvarReqPlayers,
  68.     g_pCvarZombieHealth,
  69.     g_pCvarFirstZombiesHealth,
  70.     g_pCvarZombieKnockback,
  71.     g_pCvarScoreMessageType,
  72.     g_pCvarColors[3],
  73.     g_pCvarRoundEndDelay
  74.  
  75. public plugin_natives()
  76. {
  77.     register_native("ze_is_user_zombie", "native_ze_is_user_zombie", 1)
  78.     register_native("ze_is_game_started", "native_ze_is_game_started", 1)
  79.     register_native("ze_is_zombie_frozen", "native_ze_is_zombie_frozen", 1)
  80.    
  81.     register_native("ze_get_round_number", "native_ze_get_round_number", 1)
  82.     register_native("ze_get_humans_number", "native_ze_get_humans_number", 1)
  83.     register_native("ze_get_zombies_number", "native_ze_get_zombies_number", 1)
  84.    
  85.     register_native("ze_set_user_zombie", "native_ze_set_user_zombie", 1)
  86.     register_native("ze_set_user_human", "native_ze_set_user_human", 1)
  87.     register_native("ze_set_human_speed_factor", "native_ze_set_human_speed_factor", 1)
  88.     register_native("ze_set_zombie_speed", "native_ze_set_zombie_speed", 1)
  89.    
  90.     register_native("ze_reset_human_speed", "native_ze_reset_human_speed", 1)
  91.     register_native("ze_reset_zombie_speed", "native_ze_reset_zombie_speed", 1)
  92. }
  93.  
  94. public plugin_init()
  95. {
  96.     register_plugin("[ZE] Core/Engine", ZE_VERSION, AUTHORS)
  97.    
  98.     // Hook Chains
  99.     RegisterHookChain(RG_CBasePlayer_TraceAttack, "Fw_TraceAttack_Pre", 0)
  100.     RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
  101.     RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
  102.     RegisterHookChain(RG_CSGameRules_CheckWinConditions, "Fw_CheckMapConditions_Post", 1)
  103.     RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
  104.     RegisterHookChain(RG_RoundEnd, "Event_RoundEnd_Pre", 0)
  105.    
  106.     // Events
  107.     register_event("HLTV", "New_Round", "a", "1=0", "2=0")
  108.     register_event("TextMsg", "Map_Restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in", "2=#Round_Draw")
  109.     register_logevent("Round_Start", 2, "1=Round_Start")
  110.     register_logevent("Round_End", 2, "1=Round_End")
  111.    
  112.     // Hams
  113.     RegisterHam(Ham_Item_PreFrame, "player", "Fw_RestMaxSpeed_Post", 1)
  114.    
  115.     // Create Forwards (All Return Values Ignored)
  116.     g_iForwards[FORWARD_ROUNDEND] = CreateMultiForward("ze_roundend", ET_IGNORE, FP_CELL)
  117.     g_iForwards[FORWARD_HUMANIZED] = CreateMultiForward("ze_user_humanized", ET_IGNORE, FP_CELL)
  118.     g_iForwards[FORWARD_PRE_INFECTED] = CreateMultiForward("ze_user_infected_pre", ET_CONTINUE, FP_CELL, FP_CELL)
  119.     g_iForwards[FORWARD_INFECTED] = CreateMultiForward("ze_user_infected", ET_IGNORE, FP_CELL, FP_CELL)
  120.     g_iForwards[FORWARD_ZOMBIE_APPEAR] = CreateMultiForward("ze_zombie_appear", ET_IGNORE)
  121.     g_iForwards[FORWARD_ZOMBIE_RELEASE] = CreateMultiForward("ze_zombie_release", ET_IGNORE)
  122.     g_iForwards[FORWARD_GAME_STARTED] = CreateMultiForward("ze_game_started", ET_IGNORE)
  123.    
  124.     // Hud Messages
  125.     g_iReleaseNotice = CreateHudSyncObj()
  126.    
  127.     // Sequential files (.txt)
  128.     register_dictionary("zombie_escape.txt")
  129.    
  130.     // Humans Cvars
  131.     g_pCvarHumanSpeedFactor = register_cvar("ze_human_speed_factor", "20.0")
  132.     g_pCvarHumanGravity = register_cvar("ze_human_gravity", "800")
  133.     g_pCvarHumanHealth = register_cvar("ze_human_health", "1000")
  134.    
  135.     // Zombie Cvars
  136.     g_pCvarZombieSpeed = register_cvar("ze_zombie_speed", "350.0")
  137.     g_pCvarZombieGravity = register_cvar("ze_zombie_gravity", "640")
  138.     g_pCvarZombieHealth = register_cvar("ze_zombie_health", "10000")
  139.     g_pCvarFirstZombiesHealth = register_cvar("ze_first_zombies_health", "20000")
  140.     g_pCvarZombieKnockback = register_cvar("ze_zombie_knockback", "300.0")
  141.    
  142.     // General Cvars
  143.     g_pCvarZombieReleaseTime = register_cvar("ze_release_time", "15")
  144.     g_pCvarFreezeTime = register_cvar("ze_freeze_time", "20")
  145.     g_pCvarRoundTime = register_cvar("ze_round_time", "9.0")
  146.     g_pCvarReqPlayers = register_cvar("ze_required_players", "2")
  147.     g_pCvarScoreMessageType = register_cvar("ze_score_message_type", "1")
  148.     g_pCvarColors[Red] = register_cvar("ze_score_message_red", "200")
  149.     g_pCvarColors[Green] = register_cvar("ze_score_message_green", "100")
  150.     g_pCvarColors[Blue] = register_cvar("ze_score_message_blue", "0")
  151.     g_pCvarRoundEndDelay = register_cvar("ze_round_end_delay", "5")
  152.    
  153.     // Default Values
  154.     g_bGameStarted = false
  155.    
  156.     // Static Values
  157.     g_iMaxClients = get_member_game(m_nMaxPlayers)
  158.    
  159.     // Check Round Time to Terminate it
  160.     set_task(1.0, "Check_RoundTimeleft", ROUND_TIME_LEFT, _, _, "b")
  161. }
  162.  
  163. public plugin_cfg()
  164. {
  165.     // Get our configiration file and Execute it
  166.     new szCfgDir[64]
  167.     get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir))
  168.     server_cmd("exec %s/zombie_escape.cfg", szCfgDir)
  169.    
  170.     // Set Game Name
  171.     new szGameName[64]
  172.     formatex(szGameName, sizeof(szGameName), "Premuim ZE v%s", ZE_VERSION)
  173.     set_member_game(m_GameDesc, szGameName)
  174.    
  175.     // Set Version
  176.     register_cvar("ze_version", ZE_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  177.     set_cvar_string("ze_version", ZE_VERSION)
  178. }
  179.  
  180. public Fw_CheckMapConditions_Post()
  181. {
  182.     // Block Game Commencing
  183.     set_member_game(m_bGameStarted, true)
  184.    
  185.     // Set Freeze Time
  186.     set_member_game(m_iIntroRoundTime, get_pcvar_num(g_pCvarFreezeTime))
  187.    
  188.     // Set Round Time
  189.     set_member_game(m_iRoundTime, floatround(get_pcvar_float(g_pCvarRoundTime) * 60.0))
  190. }
  191.  
  192. public Fw_PlayerKilled_Post(id)
  193. {
  194.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
  195.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  196.    
  197.     if (g_iAliveHumansNum == 0 && g_iAliveZombiesNum == 0)
  198.     {
  199.         // No Winner, All Players in one team killed Or Both teams Killed
  200.         client_print(0, print_center, "%L", LANG_PLAYER, "NO_WINNER")
  201.     }
  202. }
  203.  
  204. public Fw_RestMaxSpeed_Post(id)
  205. {
  206.     if (!g_bIsZombie[id])
  207.     {
  208.         static Float:flMaxSpeed
  209.         get_entvar(id, var_maxspeed, flMaxSpeed)
  210.        
  211.         if (flMaxSpeed != 1.0 && is_user_alive(id))
  212.         {
  213.             if (g_bHSpeedUsed[id])
  214.             {
  215.                 // Set New Human Speed Factor
  216.                 set_entvar(id, var_maxspeed, flMaxSpeed + float(g_iHSpeedFactor[id]))
  217.                 return HAM_IGNORED
  218.             }
  219.                
  220.             // Set Human Speed Factor, native not used
  221.             set_entvar(id, var_maxspeed, flMaxSpeed + get_pcvar_float(g_pCvarHumanSpeedFactor))
  222.             return HAM_IGNORED
  223.         }
  224.     }
  225.    
  226.     return HAM_SUPERCEDE
  227. }
  228.  
  229. public Fw_PlayerSpawn_Post(id)
  230. {  
  231.     if (!g_bGameStarted)
  232.     {
  233.         // Force All player to be Humans if Game not started yet
  234.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
  235.     }
  236.     else
  237.     {
  238.         if (get_member_game(m_bFreezePeriod))
  239.         {
  240.             // Respawn Him As human if we are in freeze time (Zombie Not Chosen yet)
  241.             Set_User_Human(id)
  242.             g_bIsZombieFrozen[id] = false
  243.         }
  244.         else
  245.         {
  246.             if (g_bZombieFreezeTime)
  247.             {
  248.                 // Zombie Chosen and zombies Frozen, Spawn him as zombie and Freeze Him
  249.                 Set_User_Zombie(id)
  250.                 g_bIsZombieFrozen[id] = true
  251.                 set_entvar(id, var_maxspeed, 1.0)
  252.             }
  253.             else
  254.             {
  255.                 // Respawn him as normal zombie
  256.                 Set_User_Zombie(id)
  257.                 g_bIsZombieFrozen[id] = false
  258.             }
  259.         }
  260.     }
  261. }
  262.  
  263. public New_Round()
  264. {
  265.     // Remove All tasks in the New Round
  266.     remove_task(TASK_COUNTDOWN)
  267.     remove_task(TASK_COUNTDOWN2)
  268.     remove_task(TASK_SCORE_MESSAGE)
  269.     remove_task(FREEZE_ZOMBIES)
  270.    
  271.     // Score Message Task
  272.     set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
  273.    
  274.     // 2 is Hardcoded Value, It's Fix for the countdown to work correctly
  275.     g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 2
  276.    
  277.     if (!g_bGameStarted)
  278.     {
  279.         // No Enough Players
  280.         ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
  281.         return // Block the execution of the blew code
  282.     }
  283.    
  284.     // Game Already started, Countdown now started
  285.     set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
  286.     ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
  287.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
  288.    
  289.     g_iRoundNum++
  290.    
  291.     // Round Starting
  292.     g_bIsRoundEnding = false
  293.     g_bEndCalled = false
  294. }
  295.  
  296. // Score Message Task
  297. public Score_Message(TaskID)
  298. {
  299.     switch(get_pcvar_num(g_pCvarScoreMessageType))
  300.     {
  301.         case 0: // Disabled
  302.         {
  303.             return
  304.         }
  305.         case 1: // DHUD
  306.         {
  307.             set_dhudmessage(0, 255, 0, 0.38, 0.01, 0, 0.0, 9.0)
  308.             show_dhudmessage(0, "Survivors")
  309.            
  310.             set_dhudmessage(255, 255, 255, -1.0, 0.01, 0, 0.0, 9.0)
  311.             show_dhudmessage(0, "[VS]")
  312.            
  313.             set_dhudmessage(255, 0, 0, 0.54, 0.01, 0, 0.0, 9.0)
  314.             show_dhudmessage(0, "Zombies")
  315.            
  316.             set_dhudmessage(255, 255, 255, -1.0, 0.045, 0, 0.0, 9.0)
  317.             show_dhudmessage(0, "[%i] --------- [%i]", g_iHumansScore, g_iZombiesScore)
  318.  
  319.             set_dhudmessage( .red = 0, .green = 255, .blue = 0, .x = -1.0, .y = 0.02, .effects = 0, .fxtime = 6.0, .holdtime = 2.0, .fadeintime = 1.0, .fadeouttime = 1.0);
  320.             show_dhudmessage( 0, "%L                        ", LANG_PLAYER, "SCORE_HUMANS", native_ze_get_humans_number() );
  321.             set_dhudmessage( .red = 100, .green = 100, .blue = 100, .x = -1.0, .y = 0.02, .effects = 0, .fxtime = 6.0, .holdtime = 2.0, .fadeintime = 1.0, .fadeouttime = 1.0);
  322.             show_dhudmessage( 0, "%L^n%L", LANG_PLAYER, "SCORE_ROUND", g_iRoundNum, LANG_PLAYER,  "SCORE_WINS", g_iHumansScore,  g_iZombiesScore );
  323.             set_dhudmessage( .red = 255, .green = 0, .blue = 0, .x = -1.0, .y = 0.02, .effects = 0, .fxtime = 6.0, .holdtime = 2.0, .fadeintime = 1.0, .fadeouttime = 1.0);
  324.             show_dhudmessage( 0, "                         %L", LANG_PLAYER, "SCORE_ZOMBIES", native_ze_get_zombies_number() );
  325.         }
  326.         case 2: // HUD
  327.         {
  328.             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)
  329.             show_hudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
  330.         }
  331.     }
  332. }
  333.  
  334. public Countdown_Start(TaskID)
  335. {
  336.     // Check if the players Disconnected and there is only one player then remove all messages, and stop tasks
  337.     if (!g_bGameStarted)
  338.         return
  339.    
  340.     if (!g_iCountDown)
  341.     {
  342.         Choose_Zombies()
  343.         remove_task(TASK_COUNTDOWN) // Remove the task
  344.         return // Block the execution of the blew code
  345.     }
  346.    
  347.     set_hudmessage(random(256), random(256), random(256), -1.0, 0.21, 0, 0.8, 0.8)
  348.     show_hudmessage(0, "%L", LANG_PLAYER, "RUN_NOTICE", g_iCountDown)
  349.  
  350.     g_iCountDown--
  351. }
  352.  
  353. public Choose_Zombies()
  354. {
  355.     new iZombies, id, iAliveCount
  356.     new iReqZombies
  357.    
  358.     // Get total alive players and required players
  359.     iAliveCount  = GetAllAlivePlayersNum()
  360.     iReqZombies = RequiredZombies()
  361.    
  362.     // Loop till we find req players
  363.     while(iZombies < iReqZombies)
  364.     {
  365.         id = GetRandomAlive(random_num(1, iAliveCount))
  366.        
  367.         if (!is_user_alive(id) || g_bIsZombie[id])
  368.             continue
  369.  
  370.         Set_User_Zombie(id)
  371.         set_entvar(id, var_health, get_pcvar_float(g_pCvarFirstZombiesHealth))
  372.         g_bIsZombieFrozen[id] = true
  373.         g_bZombieFreezeTime = true
  374.         set_entvar(id, var_maxspeed, 1.0)
  375.         set_task(0.1, "Freeze_Zombies", FREEZE_ZOMBIES, _, _, "b") // Better than PreThink
  376.         ExecuteForward(g_iForwards[FORWARD_ZOMBIE_APPEAR], g_iFwReturn)
  377.         iZombies++
  378.        
  379.         // Respawn Zombies to base
  380.         rg_round_respawn(id)
  381.     }
  382.    
  383.     // 2 is Hardcoded Value, It's Fix for the countdown to work correctly
  384.     g_iCountDown = get_pcvar_num(g_pCvarZombieReleaseTime) - 2
  385.    
  386.     set_task(1.0, "ReleaseZombie_CountDown", TASK_COUNTDOWN2, _, _, "b")
  387. }
  388.  
  389. public ReleaseZombie_CountDown(TaskID)
  390. {
  391.     if (!g_iCountDown)
  392.     {
  393.         ReleaseZombie()
  394.         remove_task(TASK_COUNTDOWN2)
  395.         return
  396.     }
  397.    
  398.     // Release Hud Message
  399.     set_hudmessage(255, 255, 0, -1.0, 0.21, 1, 2.0, 2.0)
  400.     ShowSyncHudMsg(0, g_iReleaseNotice, "%L", LANG_PLAYER, "ZOMBIE_RELEASE", g_iCountDown)
  401.    
  402.     g_iCountDown --
  403. }
  404.  
  405. public ReleaseZombie()
  406. {
  407.     ExecuteForward(g_iForwards[FORWARD_ZOMBIE_RELEASE], g_iFwReturn)
  408.    
  409.     for(new id = 1; id <= g_iMaxClients; id++)
  410.     {
  411.         if (is_user_alive(id) && g_bIsZombie[id])
  412.         {
  413.             g_bIsZombieFrozen[id] = false
  414.             g_bZombieFreezeTime = false
  415.         }
  416.     }
  417. }
  418.  
  419. public Freeze_Zombies(TaskID)
  420. {
  421.     for(new id = 1; id <= g_iMaxClients; id++)
  422.     {
  423.         if(!is_user_alive(id) || !g_bIsZombie[id])
  424.             continue
  425.        
  426.         if (g_bIsZombieFrozen[id])
  427.         {
  428.             // Zombie & Frozen, then Freeze him
  429.             set_entvar(id, var_maxspeed, 1.0)
  430.         }
  431.         else
  432.         {
  433.             if (g_bZSpeedUsed[id])
  434.             {
  435.                 // Zombie but Not Frozen the set his speed form .cfg
  436.                 set_entvar(id, var_maxspeed, float(g_iZSpeedSet[id]))
  437.                 continue;
  438.             }
  439.                
  440.             // Zombie but Not Frozen the set his speed form .cfg
  441.             set_entvar(id, var_maxspeed, get_pcvar_float(g_pCvarZombieSpeed))
  442.         }
  443.     }
  444. }
  445.  
  446. public Fw_TraceAttack_Pre(iVictim, iAttacker, Float:flDamage, Float:flDirection[3], iTracehandle, bitsDamageType)
  447. {
  448.     if (iVictim == iAttacker || !is_user_connected(iVictim) || !is_user_connected(iAttacker))
  449.         return HC_CONTINUE
  450.    
  451.     // Attacker and Victim is in same teams? Skip code blew
  452.     if (get_member(iAttacker, m_iTeam) == get_member(iVictim, m_iTeam))
  453.         return HC_CONTINUE
  454.    
  455.     // In freeze time? Skip all other plugins (Skip the real trace attack event)
  456.     if (g_bIsZombieFrozen[iVictim] || g_bIsZombieFrozen[iAttacker])
  457.         return HC_SUPERCEDE
  458.    
  459.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
  460.    
  461.     if (g_bIsZombie[iAttacker])
  462.     {
  463.         // Death Message with Infection style [Added here because of delay in Forward use]
  464.         SendDeathMsg(iAttacker, iVictim)
  465.        
  466.         ExecuteForward(g_iForwards[FORWARD_PRE_INFECTED], g_iFwReturn, iVictim, iAttacker)
  467.        
  468.         if (g_iFwReturn > 0)
  469.         {
  470.             return HC_CONTINUE
  471.         }
  472.        
  473.         Set_User_Zombie(iVictim)
  474.        
  475.         ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, iVictim, iAttacker)
  476.        
  477.         if (g_iAliveHumansNum == 1) // Check if this is Last Human, Because of Delay i can't check if it's 0 instead of 1
  478.         {
  479.             // End round event called one time
  480.             g_bEndCalled = true
  481.            
  482.             // Round is Ending
  483.             g_bIsRoundEnding = true
  484.            
  485.             // Zombie Win, Leave text blank so we use ours from ML
  486.             rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  487.            
  488.             // Show Our Message
  489.             client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  490.            
  491.             // This needed so forward work also to add +1 for Zombies
  492.             g_iTeam = 1 // ZE_TEAM_ZOMBIE
  493.             ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
  494.         }
  495.     }
  496.    
  497.     return HC_CONTINUE
  498. }
  499.  
  500. public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
  501. {
  502.     // Not Vaild Victim or Attacker so skip the event (Important to block out bounds errors)
  503.     if (!is_user_connected(iVictim) || !is_user_connected(iAttacker))
  504.         return HC_CONTINUE
  505.    
  506.     // Set Knockback here, So if we blocked damage in TraceAttack event player won't get knockback (Fix For Madness)
  507.     if (g_bIsZombie[iVictim] && !g_bIsZombie[iAttacker])
  508.     {
  509.         // Remove Shock Pain
  510.         set_member(iVictim, m_flVelocityModifier, 1.0)
  511.        
  512.         // Set Knockback
  513.         static Float:flOrigin[3]
  514.         get_entvar(iAttacker, var_origin, flOrigin)
  515.         Set_Knockback(iVictim, flOrigin, get_pcvar_float(g_pCvarZombieKnockback), 2)
  516.     }
  517.    
  518.     return HC_CONTINUE
  519. }
  520.  
  521. public Round_End()
  522. {
  523.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  524.    
  525.     if (g_iAliveZombiesNum == 0 && g_bGameStarted)
  526.     {
  527.         g_iTeam = 2 // ZE_TEAM_HUMAN
  528.         ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
  529.         client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
  530.         g_iHumansScore++
  531.         g_bIsRoundEnding = true
  532.         return // To block Execute the code blew
  533.     }
  534.    
  535.     g_iTeam = 1 // ZE_TEAM_ZOMBIE
  536.     g_iZombiesScore++
  537.     g_bIsRoundEnding = true
  538.    
  539.     // If it's already called one time, don't call it again
  540.     if (!g_bEndCalled)
  541.     {
  542.         ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
  543.     }
  544.    
  545.     client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  546. }
  547.  
  548. public Event_RoundEnd_Pre(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
  549. {
  550.     // The two unhandeld cases by rg_round_end() native in our Mod
  551.     if (event == ROUND_CTS_WIN || event == ROUND_TERRORISTS_WIN)
  552.     {
  553.         SetHookChainArg(3, ATYPE_FLOAT, get_pcvar_float(g_pCvarRoundEndDelay))
  554.     }
  555. }
  556.  
  557. public Round_Start()
  558. {
  559.     g_flReferenceTime = get_gametime()
  560.     g_iRoundTime = get_member_game(m_iRoundTime)
  561. }
  562.  
  563. public Check_RoundTimeleft()
  564. {
  565.     new Float:flRoundTimeLeft = (g_flReferenceTime + float(g_iRoundTime)) - get_gametime()
  566.    
  567.     if (floatround(flRoundTimeLeft) == 0)
  568.     {
  569.         // Round is Ending
  570.         g_bIsRoundEnding = true
  571.        
  572.         // If Time is Out then Terminate the Round
  573.         rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  574.        
  575.         // Show our Message
  576.         client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  577.     }
  578. }
  579.  
  580. public client_disconnected(id)
  581. {
  582.     // Delay Then Check Players to Terminate The round (Delay needed)
  583.     set_task(0.1, "Check_AlivePlayers")
  584.    
  585.     // Reset speed for this dropped id
  586.     g_bHSpeedUsed[id] = false
  587.     g_bZSpeedUsed[id] = false
  588. }
  589.  
  590. // This check done when player disconnect
  591. public Check_AlivePlayers()
  592. {
  593.     g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  594.     g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
  595.    
  596.     // Game Started? (There is at least 2 players Alive?)
  597.     if (g_bGameStarted)
  598.     {
  599.         // We are in freeze time?
  600.         if (get_member_game(m_bFreezePeriod))
  601.         {
  602.             // Humans alive number = 1 and no zombies?
  603.             if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers))
  604.             {
  605.                 // Game started false again
  606.                 g_bGameStarted = false
  607.             }
  608.         }
  609.         else // Not freeze time?
  610.         {
  611.             // Variables
  612.             new iAllZombiesNum = GetTeamPlayersNum(CsTeams:TEAM_TERRORIST),
  613.             iAllHumansNum = GetTeamPlayersNum(CsTeams:TEAM_CT),
  614.             iDeadZombiesNum = GetDeadPlayersNum(CsTeams:TEAM_TERRORIST),
  615.             iDeadHumansNum = GetDeadPlayersNum(CsTeams:TEAM_CT)
  616.    
  617.             // Alive humans number = 1 and no zombies at all, And no dead humans?
  618.             if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadHumansNum == 0 && iAllZombiesNum == 0)
  619.             {
  620.                 // Game started is false and humans wins (Escape Success)
  621.                 g_bGameStarted = false
  622.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
  623.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
  624.             }
  625.            
  626.             // Alive zombies number = 1 and no humans at all, And no dead zombies?
  627.             if (g_iAliveZombiesNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadZombiesNum == 0 && iAllHumansNum == 0)
  628.             {
  629.                 // Game started is false and zombies wins (Escape Fail)
  630.                 g_bGameStarted = false
  631.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  632.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  633.             }
  634.            
  635.             // Humans number more than 1 and no zombies?
  636.             if (g_iAliveHumansNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveZombiesNum == 0 && !g_bIsRoundEnding)
  637.             {
  638.                 // Then Escape success as there is no Zombies
  639.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
  640.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
  641.             }
  642.            
  643.             // Zombies number more than 1 and no humans?
  644.             if (g_iAliveZombiesNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveHumansNum == 0 && !g_bIsRoundEnding)
  645.             {
  646.                 // Then Escape Fail as there is no humans
  647.                 rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
  648.                 client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
  649.             }
  650.         }
  651.     }
  652. }
  653.  
  654. public client_putinserver(id)
  655. {
  656.     // Add Delay and Check Conditions To start the Game (Delay needed)
  657.     set_task(1.0, "Check_AllPlayersNumber", _, _, _, "b")
  658. }
  659.  
  660. public Check_AllPlayersNumber(TaskID)
  661. {
  662.     if (g_bGameStarted)
  663.     {
  664.         // If game started remove the task and block the blew Checks
  665.         remove_task(TaskID)
  666.         return
  667.     }
  668.    
  669.     if (GetAllAlivePlayersNum() >= get_pcvar_num(g_pCvarReqPlayers))
  670.     {
  671.         // Players In server == The Required so game started is true
  672.         g_bGameStarted = true
  673.        
  674.         // Restart the game
  675.         server_cmd("sv_restart 2")
  676.        
  677.         // Print Fake game Commencing Message
  678.         client_print(0, print_center, "%L", LANG_PLAYER, "START_GAME")
  679.        
  680.         // Remove the task
  681.         remove_task(TaskID)
  682.     }
  683. }
  684.  
  685. public Set_User_Human(id)
  686. {
  687.     if (!is_user_alive(id))
  688.         return
  689.    
  690.     g_bIsZombie[id] = false
  691.     set_entvar(id, var_health, get_pcvar_float(g_pCvarHumanHealth))
  692.     set_entvar(id, var_gravity, get_pcvar_float(g_pCvarHumanGravity)/800.0)
  693.     ExecuteForward(g_iForwards[FORWARD_HUMANIZED], g_iFwReturn, id)
  694.    
  695.     if (get_member(id, m_iTeam) != TEAM_CT)
  696.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
  697. }
  698.  
  699. public Set_User_Zombie(id)
  700. {
  701.     if (!is_user_alive(id))
  702.         return
  703.    
  704.     g_bIsZombie[id] = true
  705.     set_entvar(id, var_health, get_pcvar_float(g_pCvarZombieHealth))
  706.     set_entvar(id, var_gravity, get_pcvar_float(g_pCvarZombieGravity)/800.0)
  707.     rg_remove_all_items(id)
  708.     rg_give_item(id, "weapon_knife", GT_APPEND)
  709.     ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, id, 0)
  710.    
  711.     if (get_member(id, m_iTeam) != TEAM_TERRORIST)
  712.         rg_set_user_team(id, TEAM_TERRORIST, MODEL_UNASSIGNED)
  713. }
  714.  
  715. public Map_Restart()
  716. {
  717.     // Add Delay To help Rest Scores if player kill himself, and there no one else him so round draw (Delay needed)
  718.     set_task(0.1, "Reset_Score_Message")
  719. }
  720.  
  721. public Reset_Score_Message()
  722. {
  723.     g_iHumansScore = 0
  724.     g_iZombiesScore = 0
  725.     g_iRoundNum = 0
  726. }
  727.  
  728. // Natives
  729. public native_ze_is_user_zombie(id)
  730. {
  731.     if (!is_user_connected(id))
  732.     {
  733.         return -1;
  734.     }
  735.    
  736.     return g_bIsZombie[id]
  737. }
  738.  
  739. public native_ze_set_user_zombie(id)
  740. {
  741.     if (!is_user_connected(id))
  742.     {
  743.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  744.         return false;
  745.     }
  746.    
  747.     Set_User_Zombie(id)
  748.     return true;
  749. }
  750.  
  751. public native_ze_set_user_human(id)
  752. {
  753.     if (!is_user_connected(id))
  754.     {
  755.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  756.         return false;
  757.     }
  758.    
  759.     Set_User_Human(id)
  760.     return true;
  761. }
  762.  
  763. public native_ze_is_game_started()
  764. {
  765.     return g_bGameStarted
  766. }
  767.  
  768. public native_ze_is_zombie_frozen(id)
  769. {
  770.     if (!is_user_connected(id) || !g_bIsZombie[id])
  771.     {
  772.         return -1;
  773.     }
  774.    
  775.     return g_bIsZombieFrozen[id]
  776. }
  777.  
  778. public native_ze_get_round_number()
  779. {
  780.     if (!g_bGameStarted)
  781.     {
  782.         return -1;
  783.     }
  784.    
  785.     return g_iRoundNum
  786. }
  787.  
  788. public native_ze_get_humans_number()
  789. {
  790.     return GetAlivePlayersNum(CsTeams:TEAM_CT)
  791. }
  792.  
  793. public native_ze_get_zombies_number()
  794. {
  795.     return GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
  796. }
  797.  
  798. public native_ze_set_human_speed_factor(id, iFactor)
  799. {
  800.     if (!is_user_connected(id))
  801.     {
  802.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  803.         return false;
  804.     }
  805.    
  806.     g_bHSpeedUsed[id] = true
  807.     g_iHSpeedFactor[id] = iFactor
  808.     ExecuteHamB(Ham_Item_PreFrame, id)
  809.     return true;
  810. }
  811.  
  812. public native_ze_reset_human_speed(id)
  813. {
  814.     if (!is_user_connected(id))
  815.     {
  816.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  817.         return false;
  818.     }
  819.    
  820.     g_bHSpeedUsed[id] = false
  821.     ExecuteHamB(Ham_Item_PreFrame, id)
  822.     return true;
  823. }
  824.  
  825. public native_ze_set_zombie_speed(id, iSpeed)
  826. {
  827.     if (!is_user_connected(id))
  828.     {
  829.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  830.         return false;
  831.     }
  832.    
  833.     g_bZSpeedUsed[id] = true
  834.     g_iZSpeedSet[id] = iSpeed
  835.     return true;
  836. }
  837.  
  838. public native_ze_reset_zombie_speed(id)
  839. {
  840.     if (!is_user_connected(id))
  841.     {
  842.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  843.         return false;
  844.     }
  845.    
  846.     g_bZSpeedUsed[id] = false
  847.     return true;
  848. }
Error :

Code: Select all

 register_native("ze_is_user_zombie", "native_ze_is_user_zombie", 1)
Explain what error you get?
i have pic look at this mate : https://ibb.co/2sjvhsb

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#13

Post by sPe3doN » 2 years ago

Amnesia wrote: 2 years ago
Raheem wrote: 2 years ago
Amnesia wrote: 2 years ago

Error :

Code: Select all

 register_native("ze_is_user_zombie", "native_ze_is_user_zombie", 1)
Explain what error you get?
i have pic look at this mate : https://ibb.co/2sjvhsb
just download last compiler version from here https://www.escapers-zone.net/viewtopic.php?f=6&t=221
Plugin
ze_core.amxx
(13.54 KiB) Downloaded 206 times
ze_core.amxx
(13.54 KiB) Downloaded 206 times
Image

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 7 guests