Remove Freeze Time, Make all humans run together + Respawn

Helping Topics
Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

Remove Freeze Time, Make all humans run together + Respawn

#1

Post by Raheem » 1 Month Ago

Hello,

In this topic you will learn how to remove freeze time, and make all players run together and when the countdown ends and zombies chosen they will be respawned.

*** This works for version >= 1.3 ***

First you will need to open ze_core.sma and find:
    1.     // Loop till we find req players
    2.     while(iZombies < iReqZombies)
    3.     {
    4.         id = GetRandomAlive(random_num(1, iAliveCount))
    5.        
    6.         if (!is_user_alive(id) || g_bIsZombie[id])
    7.             continue
    8.        
    9.         if (get_pcvar_num(g_pCvarSmartRandom))
    10.         {
    11.             // If player in the array, it means he chosen previous round so skip him this round
    12.             if (IsPlayerInArray(g_aChosenPlayers, id))
    13.                 continue
    14.         }
    15.  
    16.         Set_User_Zombie(id)
    17.         set_entvar(id, var_health, get_pcvar_float(g_pCvarFirstZombiesHealth))
    18.         g_bIsZombieFrozen[id] = true
    19.         g_bZombieFreezeTime = true
    20.         set_entvar(id, var_maxspeed, 1.0)
    21.         set_task(0.1, "Freeze_Zombies", FREEZE_ZOMBIES, _, _, "b") // Better than PreThink
    22.         ExecuteForward(g_iForwards[FORWARD_ZOMBIE_APPEAR], g_iFwReturn)
    23.         iZombies++
    24.     }
And just add rg_round_respawn(id) so it's:
    1.     // Loop till we find req players
    2.     while(iZombies < iReqZombies)
    3.     {
    4.         id = GetRandomAlive(random_num(1, iAliveCount))
    5.        
    6.         if (!is_user_alive(id) || g_bIsZombie[id])
    7.             continue
    8.        
    9.         if (get_pcvar_num(g_pCvarSmartRandom))
    10.         {
    11.             // If player in the array, it means he chosen previous round so skip him this round
    12.             if (IsPlayerInArray(g_aChosenPlayers, id))
    13.                 continue
    14.         }
    15.  
    16.         Set_User_Zombie(id)
    17.         set_entvar(id, var_health, get_pcvar_float(g_pCvarFirstZombiesHealth))
    18.         g_bIsZombieFrozen[id] = true
    19.         g_bZombieFreezeTime = true
    20.         set_entvar(id, var_maxspeed, 1.0)
    21.         set_task(0.1, "Freeze_Zombies", FREEZE_ZOMBIES, _, _, "b") // Better than PreThink
    22.         ExecuteForward(g_iForwards[FORWARD_ZOMBIE_APPEAR], g_iFwReturn)
    23.         iZombies++
    24.        
    25.         // Respawn Zombies to base
    26.         rg_round_respawn(id)
    27.     }
Find:
    1.     if (g_bGameStarted)
    2.     {
    3.         if (g_iRoundNum == 1)
    4.         {
    5.             // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
    6.             g_iCountDown = get_member_game(m_iIntroRoundTime) - 2
    7.         }
    8.         else
    9.         {
    10.             // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
    11.             g_iCountDown = get_member_game(m_iIntroRoundTime) - 3
    12.         }
    13.     }
And to edit it to:
    1.     if (g_bGameStarted)
    2.     {
    3.         if (g_iRoundNum == 1)
    4.         {
    5.             // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
    6.             g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 2
    7.         }
    8.         else
    9.         {
    10.             // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
    11.             g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 3
    12.         }
    13.     }
Find: Edit it to: Find:
    1. // Variables
    2. new g_iAliveHumansNum,
    3.     g_iAliveZombiesNum,
    4.     g_iRoundTime,
    5.     g_iCountDown,
    6.     g_iReleaseNotice,
    7.     g_iMaxClients,
    8.     g_iHumansScore,
    9.     g_iZombiesScore,
    10.     g_iRoundNum,
    11.     g_iHSpeedFactor[33],
    12.     g_iZSpeedSet[33],
    13.     g_iUserGravity[33],
    14.     bool:g_bGameStarted,
    15.     bool:g_bIsZombie[33],
    16.     bool:g_bIsZombieFrozen[33],
    17.     bool:g_bZombieFreezeTime,
    18.     bool:g_bIsRoundEnding,
    19.     bool:g_bHSpeedUsed[33],
    20.     bool:g_bZSpeedUsed[33],
    21.     bool:g_bEndCalled,
    22.     bool:g_bIsKnockBackUsed[33],
    23.     bool:g_bIsGravityUsed[33],
    24.     bool:g_bEnteredNotChoosed[33],
    25.     Float:g_flReferenceTime,
    26.     Float:g_flUserKnockback[33],
Edit to (only added Float:g_flReferenceTime2):
    1. // Variables
    2. new g_iAliveHumansNum,
    3.     g_iAliveZombiesNum,
    4.     g_iRoundTime,
    5.     g_iCountDown,
    6.     g_iReleaseNotice,
    7.     g_iMaxClients,
    8.     g_iHumansScore,
    9.     g_iZombiesScore,
    10.     g_iRoundNum,
    11.     g_iHSpeedFactor[33],
    12.     g_iZSpeedSet[33],
    13.     g_iUserGravity[33],
    14.     bool:g_bGameStarted,
    15.     bool:g_bIsZombie[33],
    16.     bool:g_bIsZombieFrozen[33],
    17.     bool:g_bZombieFreezeTime,
    18.     bool:g_bIsRoundEnding,
    19.     bool:g_bHSpeedUsed[33],
    20.     bool:g_bZSpeedUsed[33],
    21.     bool:g_bEndCalled,
    22.     bool:g_bIsKnockBackUsed[33],
    23.     bool:g_bIsGravityUsed[33],
    24.     bool:g_bEnteredNotChoosed[33],
    25.     Float:g_flReferenceTime,
    26.     Float:g_flUserKnockback[33],
    27.     Float:g_flReferenceTime2
Find:
    1. public Fw_PlayerSpawn_Post(id)
    2. {  
    3.     if (!g_bGameStarted)
    4.     {
    5.         // Force All player to be Humans if Game not started yet
    6.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
    7.     }
    8.     else
    9.     {
    10.         if (get_member_game(m_bFreezePeriod))
    11.         {
    12.             // Respawn Him As human if we are in freeze time (Zombie Not Chosen yet)
    13.             Set_User_Human(id)
    14.             g_bIsZombieFrozen[id] = false
    15.         }
    16.         else
    17.         {
    18.             if (g_bZombieFreezeTime)
    19.             {
    20.                 // Zombie Chosen and zombies Frozen, Spawn him as zombie and Freeze Him
    21.                 Set_User_Zombie(id)
    22.                 g_bIsZombieFrozen[id] = true
    23.                 set_entvar(id, var_maxspeed, 1.0)
    24.             }
    25.             else
    26.             {
    27.                 // Respawn him as normal zombie
    28.                 Set_User_Zombie(id)
    29.                 g_bIsZombieFrozen[id] = false
    30.             }
    31.         }
    32.     }
    33. }
Edit it to:
    1. public Fw_PlayerSpawn_Post(id)
    2. {  
    3.     if (!g_bGameStarted)
    4.     {
    5.         // Force All player to be Humans if Game not started yet
    6.         rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
    7.     }
    8.     else
    9.     {
    10.         if ((floatround(g_flReferenceTime2)+get_pcvar_num(g_pCvarFreezeTime)) > floatround(get_gametime())+2)
    11.         {
    12.             // Respawn Him As human if we are in freeze time (Zombie Not Chosen yet)
    13.             Set_User_Human(id)
    14.             g_bIsZombieFrozen[id] = false
    15.         }
    16.         else
    17.         {
    18.             if (g_bZombieFreezeTime)
    19.             {
    20.                 // Zombie Chosen and zombies Frozen, Spawn him as zombie and Freeze Him
    21.                 Set_User_Zombie(id)
    22.                 g_bIsZombieFrozen[id] = true
    23.                 set_entvar(id, var_maxspeed, 1.0)
    24.             }
    25.             else
    26.             {
    27.                 // Respawn him as normal zombie
    28.                 Set_User_Zombie(id)
    29.                 g_bIsZombieFrozen[id] = false
    30.             }
    31.         }
    32.     }
    33. }
Finally Edit:
    1. public New_Round()
    2. {
    3.     if (g_bGameStarted)
    4.     {
    5.         g_iRoundNum++
    6.     }
    7.    
    8.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED_PRE], g_iFwReturn)
    9.    
    10.     if (g_iFwReturn > 0)
    11.     {
    12.         return
    13.     }
    14.    
    15.     // Remove All tasks in the New Round
    16.     remove_task(TASK_COUNTDOWN)
    17.     remove_task(TASK_COUNTDOWN2)
    18.     remove_task(TASK_SCORE_MESSAGE)
    19.     remove_task(FREEZE_ZOMBIES)
    20.    
    21.     // Score Message Task
    22.     set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
    23.    
    24.     if (g_bGameStarted)
    25.     {
    26.         if (g_iRoundNum == 1)
    27.         {
    28.             // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
    29.             g_iCountDown = get_member_game(m_iIntroRoundTime) - 2
    30.         }
    31.         else
    32.         {
    33.             // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
    34.             g_iCountDown = get_member_game(m_iIntroRoundTime) - 3
    35.         }
    36.     }
    37.    
    38.     if (!g_bGameStarted)
    39.     {
    40.         // No Enough Players
    41.         ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
    42.         return // Block the execution of the blew code
    43.     }
    44.    
    45.     // Game Already started, Countdown now started
    46.     set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
    47.     ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
    48.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
    49.    
    50.     // Round Starting
    51.     g_bIsRoundEnding = false
    52.     g_bEndCalled = false
    53. }
TO (Only added: g_flReferenceTime2 = get_gametime()):
    1. public New_Round()
    2. {
    3.     g_flReferenceTime2 = get_gametime()
    4.    
    5.     if (g_bGameStarted)
    6.     {
    7.         g_iRoundNum++
    8.     }
    9.    
    10.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED_PRE], g_iFwReturn)
    11.    
    12.     if (g_iFwReturn > 0)
    13.     {
    14.         return
    15.     }
    16.    
    17.     // Remove All tasks in the New Round
    18.     remove_task(TASK_COUNTDOWN)
    19.     remove_task(TASK_COUNTDOWN2)
    20.     remove_task(TASK_SCORE_MESSAGE)
    21.     remove_task(FREEZE_ZOMBIES)
    22.    
    23.     // Score Message Task
    24.     set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
    25.    
    26.     if (g_bGameStarted)
    27.     {
    28.         if (g_iRoundNum == 1)
    29.         {
    30.             // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
    31.             g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 2
    32.         }
    33.         else
    34.         {
    35.             // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
    36.             g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 3
    37.         }
    38.     }
    39.    
    40.     if (!g_bGameStarted)
    41.     {
    42.         // No Enough Players
    43.         ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
    44.         return // Block the execution of the blew code
    45.     }
    46.    
    47.     // Game Already started, Countdown now started
    48.     set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
    49.     ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
    50.     ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
    51.    
    52.     // Round Starting
    53.     g_bIsRoundEnding = false
    54.     g_bEndCalled = false
    55. }
Now finally you will need to open zombie_escape.cfg and find mp_freezetime and make it zero. And find ze_freeze_time and make it any value, for example: ze_freeze_time 20. Also open server.cfg and make sure that mp_freezetime is set to zero.

That's it and Have fun, by the way i hate this idea but made it as TUT because it came in the ideas of our new mod version: #14
You don't know? Learn and you will know.

Mystic Viper
Senior Member
Senior Member
Romania
Posts: 104
Joined: 1 Year Ago
Has thanked: 1 time
Been thanked: 3 times
Contact:

#2

Post by Mystic Viper » 1 Month Ago

There is a bug in this

When the round begin is showing on chat a number randomly like this: 11406932

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#3

Post by Raheem » 1 Month Ago

Mystic Viper wrote:
1 Month Ago
There is a bug in this

When the round begin is showing on chat a number randomly like this: 11406932
Remove this line:
    1. client_print(0, print_chat, "%i", g_flReferenceTime2+get_pcvar_num(g_pCvarFreezeTime))
You don't know? Learn and you will know.

Mystic Viper
Senior Member
Senior Member
Romania
Posts: 104
Joined: 1 Year Ago
Has thanked: 1 time
Been thanked: 3 times
Contact:

#4

Post by Mystic Viper » 1 Month Ago

That line not exist in core

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#5

Post by Raheem » 1 Month Ago

Because i removed it, you won't face this issue again.
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest