Remove Freeze Time, Make all humans run together + Respawn
Posted: 24 Aug 2019, 01:51
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:
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
Fixing restarting when player disconnect during countdown:
Firstly we change:
Fell free to report any bug you find.
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:
- // Loop till we find req players
- while(iZombies < iReqZombies)
- {
- id = GetRandomAlive(random_num(1, iAliveCount))
- if (!is_user_alive(id) || g_bIsZombie[id])
- continue
- if (get_pcvar_num(g_pCvarSmartRandom))
- {
- // If player in the array, it means he chosen previous round so skip him this round
- if (IsPlayerInArray(g_aChosenPlayers, id))
- continue
- }
- Set_User_Zombie(id)
- set_entvar(id, var_health, get_pcvar_float(g_pCvarFirstZombiesHealth))
- g_bIsZombieFrozen[id] = true
- g_bZombieFreezeTime = true
- set_entvar(id, var_maxspeed, 1.0)
- set_task(0.1, "Freeze_Zombies", FREEZE_ZOMBIES, _, _, "b") // Better than PreThink
- ExecuteForward(g_iForwards[FORWARD_ZOMBIE_APPEAR], g_iFwReturn)
- iZombies++
- }
rg_round_respawn(id)
so it's:
- // Loop till we find req players
- while(iZombies < iReqZombies)
- {
- id = GetRandomAlive(random_num(1, iAliveCount))
- if (!is_user_alive(id) || g_bIsZombie[id])
- continue
- if (get_pcvar_num(g_pCvarSmartRandom))
- {
- // If player in the array, it means he chosen previous round so skip him this round
- if (IsPlayerInArray(g_aChosenPlayers, id))
- continue
- }
- Set_User_Zombie(id)
- set_entvar(id, var_health, get_pcvar_float(g_pCvarFirstZombiesHealth))
- g_bIsZombieFrozen[id] = true
- g_bZombieFreezeTime = true
- set_entvar(id, var_maxspeed, 1.0)
- set_task(0.1, "Freeze_Zombies", FREEZE_ZOMBIES, _, _, "b") // Better than PreThink
- ExecuteForward(g_iForwards[FORWARD_ZOMBIE_APPEAR], g_iFwReturn)
- iZombies++
- // Respawn Zombies to base
- rg_round_respawn(id)
- }
- if (g_bGameStarted)
- {
- if (g_iRoundNum == 1)
- {
- // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
- g_iCountDown = get_member_game(m_iIntroRoundTime) - 2
- }
- else
- {
- // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
- g_iCountDown = get_member_game(m_iIntroRoundTime) - 3
- }
- }
- if (g_bGameStarted)
- {
- if (g_iRoundNum == 1)
- {
- // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
- g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 2
- }
- else
- {
- // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
- g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 3
- }
- }
- set_pcvar_num(pCvarFreezeTime, get_pcvar_num(g_pCvarFreezeTime))
- set_pcvar_num(pCvarFreezeTime, 0)
- // Variables
- new g_iAliveHumansNum,
- g_iAliveZombiesNum,
- g_iRoundTime,
- g_iCountDown,
- g_iReleaseNotice,
- g_iMaxClients,
- g_iHumansScore,
- g_iZombiesScore,
- g_iRoundNum,
- g_iHSpeedFactor[33],
- g_iZSpeedSet[33],
- g_iUserGravity[33],
- bool:g_bGameStarted,
- bool:g_bIsZombie[33],
- bool:g_bIsZombieFrozen[33],
- bool:g_bZombieFreezeTime,
- bool:g_bIsRoundEnding,
- bool:g_bHSpeedUsed[33],
- bool:g_bZSpeedUsed[33],
- bool:g_bEndCalled,
- bool:g_bIsKnockBackUsed[33],
- bool:g_bIsGravityUsed[33],
- bool:g_bEnteredNotChoosed[33],
- Float:g_flReferenceTime,
- Float:g_flUserKnockback[33],
- // Variables
- new g_iAliveHumansNum,
- g_iAliveZombiesNum,
- g_iRoundTime,
- g_iCountDown,
- g_iReleaseNotice,
- g_iMaxClients,
- g_iHumansScore,
- g_iZombiesScore,
- g_iRoundNum,
- g_iHSpeedFactor[33],
- g_iZSpeedSet[33],
- g_iUserGravity[33],
- bool:g_bGameStarted,
- bool:g_bIsZombie[33],
- bool:g_bIsZombieFrozen[33],
- bool:g_bZombieFreezeTime,
- bool:g_bIsRoundEnding,
- bool:g_bHSpeedUsed[33],
- bool:g_bZSpeedUsed[33],
- bool:g_bEndCalled,
- bool:g_bIsKnockBackUsed[33],
- bool:g_bIsGravityUsed[33],
- bool:g_bEnteredNotChoosed[33],
- Float:g_flReferenceTime,
- Float:g_flUserKnockback[33],
- Float:g_flReferenceTime2
- public Fw_PlayerSpawn_Post(id)
- {
- if (!g_bGameStarted)
- {
- // Force All player to be Humans if Game not started yet
- rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
- }
- else
- {
- if (get_member_game(m_bFreezePeriod))
- {
- // Respawn Him As human if we are in freeze time (Zombie Not Chosen yet)
- Set_User_Human(id)
- g_bIsZombieFrozen[id] = false
- }
- else
- {
- if (g_bZombieFreezeTime)
- {
- // Zombie Chosen and zombies Frozen, Spawn him as zombie and Freeze Him
- Set_User_Zombie(id)
- g_bIsZombieFrozen[id] = true
- set_entvar(id, var_maxspeed, 1.0)
- }
- else
- {
- // Respawn him as normal zombie
- Set_User_Zombie(id)
- g_bIsZombieFrozen[id] = false
- }
- }
- }
- }
- public Fw_PlayerSpawn_Post(id)
- {
- if (!g_bGameStarted)
- {
- // Force All player to be Humans if Game not started yet
- rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
- }
- else
- {
- if ((floatround(g_flReferenceTime2)+get_pcvar_num(g_pCvarFreezeTime)) > floatround(get_gametime())+2)
- {
- // Respawn Him As human if we are in freeze time (Zombie Not Chosen yet)
- Set_User_Human(id)
- g_bIsZombieFrozen[id] = false
- }
- else
- {
- if (g_bZombieFreezeTime)
- {
- // Zombie Chosen and zombies Frozen, Spawn him as zombie and Freeze Him
- Set_User_Zombie(id)
- g_bIsZombieFrozen[id] = true
- set_entvar(id, var_maxspeed, 1.0)
- }
- else
- {
- // Respawn him as normal zombie
- Set_User_Zombie(id)
- g_bIsZombieFrozen[id] = false
- }
- }
- }
- }
- public New_Round()
- {
- if (g_bGameStarted)
- {
- g_iRoundNum++
- }
- ExecuteForward(g_iForwards[FORWARD_GAME_STARTED_PRE], g_iFwReturn)
- if (g_iFwReturn > 0)
- {
- return
- }
- // Remove All tasks in the New Round
- remove_task(TASK_COUNTDOWN)
- remove_task(TASK_COUNTDOWN2)
- remove_task(TASK_SCORE_MESSAGE)
- remove_task(FREEZE_ZOMBIES)
- // Score Message Task
- set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
- if (g_bGameStarted)
- {
- if (g_iRoundNum == 1)
- {
- // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
- g_iCountDown = get_member_game(m_iIntroRoundTime) - 2
- }
- else
- {
- // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
- g_iCountDown = get_member_game(m_iIntroRoundTime) - 3
- }
- }
- if (!g_bGameStarted)
- {
- // No Enough Players
- ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
- return // Block the execution of the blew code
- }
- // Game Already started, Countdown now started
- set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
- ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
- ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
- // Round Starting
- g_bIsRoundEnding = false
- g_bEndCalled = false
- }
- public New_Round()
- {
- g_flReferenceTime2 = get_gametime()
- if (g_bGameStarted)
- {
- g_iRoundNum++
- }
- ExecuteForward(g_iForwards[FORWARD_GAME_STARTED_PRE], g_iFwReturn)
- if (g_iFwReturn > 0)
- {
- return
- }
- // Remove All tasks in the New Round
- remove_task(TASK_COUNTDOWN)
- remove_task(TASK_COUNTDOWN2)
- remove_task(TASK_SCORE_MESSAGE)
- remove_task(FREEZE_ZOMBIES)
- // Score Message Task
- set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
- if (g_bGameStarted)
- {
- if (g_iRoundNum == 1)
- {
- // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
- g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 2
- }
- else
- {
- // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
- g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 3
- }
- }
- if (!g_bGameStarted)
- {
- // No Enough Players
- ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
- return // Block the execution of the blew code
- }
- // Game Already started, Countdown now started
- set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
- ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
- ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
- // Round Starting
- g_bIsRoundEnding = false
- g_bEndCalled = false
- }
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
Fixing restarting when player disconnect during countdown:
Firstly we change:
- // Tasks IDs
- enum
- {
- TASK_COUNTDOWN = 1100,
- TASK_COUNTDOWN2,
- TASK_SCORE_MESSAGE,
- FREEZE_ZOMBIES,
- ROUND_TIME_LEFT
- }
- // Tasks IDs
- enum
- {
- TASK_COUNTDOWN = 1100,
- TASK_COUNTDOWN2,
- TASK_SCORE_MESSAGE,
- FREEZE_ZOMBIES,
- ROUND_TIME_LEFT,
- CHOOSED_TASK_ID
- }
bool:g_bZombieChosen
, so variables now:
- // Variables
- new g_iAliveHumansNum,
- g_iAliveZombiesNum,
- g_iRoundTime,
- g_iCountDown,
- g_iReleaseNotice,
- g_iMaxClients,
- g_iHumansScore,
- g_iZombiesScore,
- g_iRoundNum,
- g_iHSpeedFactor[33],
- g_iZSpeedSet[33],
- g_iUserGravity[33],
- bool:g_bGameStarted,
- bool:g_bIsZombie[33],
- bool:g_bIsZombieFrozen[33],
- bool:g_bZombieFreezeTime,
- bool:g_bIsRoundEnding,
- bool:g_bHSpeedUsed[33],
- bool:g_bZSpeedUsed[33],
- bool:g_bEndCalled,
- bool:g_bIsKnockBackUsed[33],
- bool:g_bIsGravityUsed[33],
- bool:g_bEnteredNotChoosed[33],
- Float:g_flReferenceTime,
- Float:g_flUserKnockback[33],
- Float:g_flReferenceTime2,
- bool:g_bZombieChosen
public New_Round()
, and edit it to be like:
- public New_Round()
- {
- g_flReferenceTime2 = get_gametime()
- if (g_bGameStarted)
- {
- g_iRoundNum++
- }
- ExecuteForward(g_iForwards[FORWARD_GAME_STARTED_PRE], g_iFwReturn)
- if (g_iFwReturn > 0)
- {
- return
- }
- // Remove All tasks in the New Round
- remove_task(TASK_COUNTDOWN)
- remove_task(TASK_COUNTDOWN2)
- remove_task(TASK_SCORE_MESSAGE)
- remove_task(FREEZE_ZOMBIES)
- remove_task(CHOOSED_TASK_ID)
- // Score Message Task
- set_task(10.0, "Score_Message", TASK_SCORE_MESSAGE, _, _, "b")
- if (g_bGameStarted)
- {
- if (g_iRoundNum == 1)
- {
- // 2 is Hardcoded Value, It's Fix for the countdown to work correctly first round
- g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 2
- }
- else
- {
- // 3 is Hardcoded Value, It's Fix for the countdown to work correctly after first round
- g_iCountDown = get_pcvar_num(g_pCvarFreezeTime) - 3
- }
- }
- if (!g_bGameStarted)
- {
- // No Enough Players
- ze_colored_print(0, "%L", LANG_PLAYER, "NO_ENOUGH_PLAYERS", get_pcvar_num(g_pCvarReqPlayers))
- return // Block the execution of the blew code
- }
- // Game Already started, Countdown now started
- set_task(1.0, "Countdown_Start", TASK_COUNTDOWN, _, _, "b")
- ze_colored_print(0, "%L", LANG_PLAYER, "READY_TO_RUN")
- ExecuteForward(g_iForwards[FORWARD_GAME_STARTED], g_iFwReturn)
- // Round Starting
- g_bIsRoundEnding = false
- g_bEndCalled = false
- g_bZombieChosen = false
- set_task(get_pcvar_float(g_pCvarFreezeTime)+1.0, "Choosed", CHOOSED_TASK_ID)
- }
- remove_task(CHOOSED_TASK_ID)
- g_bZombieChosen = false
- set_task(get_pcvar_float(g_pCvarFreezeTime)+1.0, "Choosed", CHOOSED_TASK_ID)
- public Choosed()
- {
- g_bZombieChosen = true
- }
- // Humans number more than 1 and no zombies?
- if (g_iAliveHumansNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveZombiesNum == 0 && !g_bIsRoundEnding)
- {
- // Then Escape success as there is no Zombies
- rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
- client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
- }
- // Humans number more than 1 and no zombies?
- if (g_iAliveHumansNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveZombiesNum == 0 && !g_bIsRoundEnding && g_bZombieChosen)
- {
- // Then Escape success as there is no Zombies
- rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
- client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
- }
Fell free to report any bug you find.