Resolved Dhud Escape Status

Unpaid Requests, Public Plugins
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 575
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

Dhud Escape Status

#1

Post by Spir0x » 6 Months Ago

Yo all :D
Who can made a plugin shows Dhud message on round end when zombies win or humans win. and Remove "Esacpe Success" & "Escape Failed" from zombie_escape.txt. and add Dhud escape status like: ZOMBIES WIN or HUMANS WIN with dhud and random Colors if possible.
thanks :)
I trynna make money, not friends.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 575
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#2

Post by Spir0x » 6 Months Ago

Up...
I trynna make money, not friends.

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 546
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 45 times
Age: 19
Contact:

#3

Post by Jack GamePlay » 6 Months Ago

Tomorrow.

[ Post made via Android ]
Not interested in CS/Pawn anymore.
Accepting web projects.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 575
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#4

Post by Spir0x » 6 Months Ago

then tomorrow it's too late now.
I trynna make money, not friends.

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 546
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 45 times
Age: 19
Contact:

#5

Post by Jack GamePlay » 6 Months Ago

Spir0x wrote:
6 Months Ago
then tomorrow it's too late now.
Had connection issues.

Replace client_print(.. Line with this this

Code: Select all

set_dhudmessage(175, 0, 0, -1.0, -0.19, 0, 0.8, 0.8)
	show_dhudmessage(0, "%L", LANG_PLAYER, "ZOMBIE_RELEASE", g_iCountDown)
Then replace edit your message as well as you need it.
Not interested in CS/Pawn anymore.
Accepting web projects.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 575
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#6

Post by Spir0x » 6 Months Ago

in ze_core ? then i said end round message not countdown or release.
I trynna make money, not friends.

User avatar
Muhammet20
Senior Member
Senior Member
Turkey
Posts: 101
Joined: 7 Months Ago
Has thanked: 10 times
Been thanked: 1 time
Contact:

#7

Post by Muhammet20 » 3 Months Ago

Spir0x wrote:
6 Months Ago
Yo all :D
Who can made a plugin shows Dhud message on round end when zombies win or humans win. and Remove "Esacpe Success" & "Escape Failed" from zombie_escape.txt. and add Dhud escape status like: ZOMBIES WIN or HUMANS WIN with dhud and random Colors if possible.
thanks :)
try this :
_________

Code: Select all

#include <zombie_escape>

public plugin_init()
{
	register_plugin("[ZE] Win Hud Message", "1.0", "Muhammet Kaya")
}
public ze_roundend(winteam)
{
	for(new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
	{
		if(winteam == ZE_TEAM_HUMAN)
		{
			set_hudmessage(0, 42, 255, -1.0, -1.0, 0, 6.0, 5.0)
			show_hudmessage(id, "Humans Win")
		}
		else
		{
			set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 5.0)
			show_hudmessage(id, "Zombies Win")
		}
	}
}
Don't Say This Is Impossible , Because Nothing Impossible.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1764
Joined: 2 Years Ago
Location: Egypt
Has thanked: 30 times
Been thanked: 87 times
Age: 21
Contact:

#8

Post by Raheem » 3 Months Ago

In ze_core.sma:

Change any: To:
    1. set_dhudmessage(0, 255, 0, -1.0, 0.35, 0, 0.0, get_pcvar_float(g_pCvarRoundEndDelay))
    2. show_dhudmessage(0, "%L", LANG_PLAYER, "NO_WINNER")
Change any: To:
    1. set_dhudmessage(0, 255, 0, -1.0, 0.35, 0, 0.0, get_pcvar_float(g_pCvarRoundEndDelay))
    2. show_dhudmessage(0, "%L", LANG_PLAYER, "ESCAPE_FAIL")
Change any: To:
    1. set_dhudmessage(0, 255, 0, -1.0, 0.35, 0, 0.0, get_pcvar_float(g_pCvarRoundEndDelay))
    2. show_dhudmessage(0, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
Change any: To:
    1. set_dhudmessage(0, 255, 0, -1.0, 0.35, 0, 0.0, 5.0)
    2. show_dhudmessage(0, "%L", LANG_PLAYER, "START_GAME")
So final code should be like:

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

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 575
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#9

Post by Spir0x » 2 Months Ago

Okay thanks but what's this : g_pCvarSmartRandom = register_cvar("ze_smart_random", "1") i don't have it in my ze_core did you updated it ?
I trynna make money, not friends.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1764
Joined: 2 Years Ago
Location: Egypt
Has thanked: 30 times
Been thanked: 87 times
Age: 21
Contact:

#10

Post by Raheem » 2 Months Ago

It's here: https://github.com/raheem-cs/Zombie-Esc ... /scripting
Will be in coming version 1.4
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: Yandex [Bot] and 2 guests