update ze core

Coding Help/Re-API Supported
Post Reply
czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 525
Joined: 2 Years Ago
Has thanked: 19 times
Been thanked: 1 time
Contact:

update ze core

#1

Post by czirimbolo » 3 Months Ago

I have custom ze_core, Raheem can you update my ze core to 1,4v? Or to 1.5 if you are going to make another updates

Code: Select all

#include <zombie_escape>
#include <ze_vip>

// SVIP configiration
#define HEALTH	VIP_F
#define HUMAN_INCREASE 200
#define ZOMBIE_INCREASE 5000

// Fowards
enum _:TOTAL_FORWARDS
{
    FORWARD_NONE = 0,
    FORWARD_ROUNDEND,
    FORWARD_HUMANIZED,
    FORWARD_PRE_INFECTED,
    FORWARD_INFECTED,
    FORWARD_ZOMBIE_APPEAR,
    FORWARD_ZOMBIE_RELEASE,
    FORWARD_GAME_STARTED
}
 
new g_iForwards[TOTAL_FORWARDS], g_iFwReturn, g_iTeam
 
// Tasks IDs
enum
{
    TASK_COUNTDOWN = 1100,
    TASK_COUNTDOWN2,
    TASK_SCORE_MESSAGE,
    FREEZE_ZOMBIES,
    ROUND_TIME_LEFT
}
 
// Colors (g_pCvarColors[] array indexes)
enum
{
    Red = 0,
    Green,
    Blue
}
 
// 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],
    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,
    Float:g_flReferenceTime
 
// Cvars
new g_pCvarHumanSpeedFactor,
    g_pCvarHumanGravity,
    g_pCvarHumanHealth,
    g_pCvarZombieSpeed,
    g_pCvarZombieGravity,
    g_pCvarZombieReleaseTime,
    g_pCvarFreezeTime,
    g_pCvarRoundTime,
    g_pCvarReqPlayers,
    g_pCvarZombieHealth,
    g_pCvarFirstZombiesHealth,
    g_pCvarZombieKnockback,
    g_pCvarScoreMessageType,
    g_pCvarColors[3],
    g_pCvarRoundEndDelay
   
// Dynamic
new Array:g_aChosenPlayers
 
public plugin_natives()
{
    register_native("ze_is_user_zombie", "native_ze_is_user_zombie", 1)
    register_native("ze_is_game_started", "native_ze_is_game_started", 1)
    register_native("ze_is_zombie_frozen", "native_ze_is_zombie_frozen", 1)
   
    register_native("ze_get_round_number", "native_ze_get_round_number", 1)
    register_native("ze_get_humans_number", "native_ze_get_humans_number", 1)
    register_native("ze_get_zombies_number", "native_ze_get_zombies_number", 1)
   
    register_native("ze_set_user_zombie", "native_ze_set_user_zombie", 1)
    register_native("ze_set_user_human", "native_ze_set_user_human", 1)
    register_native("ze_set_human_speed_factor", "native_ze_set_human_speed_factor", 1)
    register_native("ze_set_zombie_speed", "native_ze_set_zombie_speed", 1)
   
    register_native("ze_reset_human_speed", "native_ze_reset_human_speed", 1)
    register_native("ze_reset_zombie_speed", "native_ze_reset_zombie_speed", 1)
}
 
public plugin_init()
{
    register_plugin("[ZE] Core/Engine", ZE_VERSION, AUTHORS)
   
    // Hook Chains
    RegisterHookChain(RG_CBasePlayer_TraceAttack, "Fw_TraceAttack_Pre", 0)
    RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
    RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
    RegisterHookChain(RG_CSGameRules_CheckWinConditions, "Fw_CheckMapConditions_Post", 1)
    RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
    RegisterHookChain(RG_RoundEnd, "Event_RoundEnd_Pre", 0)
   
    // Events
    register_event("HLTV", "New_Round", "a", "1=0", "2=0")
    register_event("TextMsg", "Map_Restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in", "2=#Round_Draw")
    register_logevent("Round_Start", 2, "1=Round_Start")
    register_logevent("Round_End", 2, "1=Round_End")
   
    // Hams
    RegisterHam(Ham_Item_PreFrame, "player", "Fw_RestMaxSpeed_Post", 1)
   
    // Create Forwards (All Return Values Ignored)
    g_iForwards[FORWARD_ROUNDEND] = CreateMultiForward("ze_roundend", ET_IGNORE, FP_CELL)
    g_iForwards[FORWARD_HUMANIZED] = CreateMultiForward("ze_user_humanized", ET_IGNORE, FP_CELL)
    g_iForwards[FORWARD_PRE_INFECTED] = CreateMultiForward("ze_user_infected_pre", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL)
    g_iForwards[FORWARD_INFECTED] = CreateMultiForward("ze_user_infected", ET_IGNORE, FP_CELL, FP_CELL)
    g_iForwards[FORWARD_ZOMBIE_APPEAR] = CreateMultiForward("ze_zombie_appear", ET_IGNORE)
    g_iForwards[FORWARD_ZOMBIE_RELEASE] = CreateMultiForward("ze_zombie_release", ET_IGNORE)
    g_iForwards[FORWARD_GAME_STARTED] = CreateMultiForward("ze_game_started", ET_IGNORE)
   
    // Hud Messages
    g_iReleaseNotice = CreateHudSyncObj()
   
    // Sequential files (.txt)
    register_dictionary("zombie_escape.txt")
   
    // Humans Cvars
    g_pCvarHumanSpeedFactor = register_cvar("ze_human_speed_factor", "20.0")
    g_pCvarHumanGravity = register_cvar("ze_human_gravity", "800")
    g_pCvarHumanHealth = register_cvar("ze_human_health", "1000")
   
    // Zombie Cvars
    g_pCvarZombieSpeed = register_cvar("ze_zombie_speed", "350.0")
    g_pCvarZombieGravity = register_cvar("ze_zombie_gravity", "640")
    g_pCvarZombieHealth = register_cvar("ze_zombie_health", "10000")
    g_pCvarFirstZombiesHealth = register_cvar("ze_first_zombies_health", "20000")
    g_pCvarZombieKnockback = register_cvar("ze_zombie_knockback", "300.0")
   
    // General Cvars
    g_pCvarZombieReleaseTime = register_cvar("ze_release_time", "15")
    g_pCvarFreezeTime = register_cvar("ze_freeze_time", "20")
    g_pCvarRoundTime = register_cvar("ze_round_time", "9.0")
    g_pCvarReqPlayers = register_cvar("ze_required_players", "2")
    g_pCvarScoreMessageType = register_cvar("ze_score_message_type", "1")
    g_pCvarColors[Red] = register_cvar("ze_score_message_red", "200")
    g_pCvarColors[Green] = register_cvar("ze_score_message_green", "100")
    g_pCvarColors[Blue] = register_cvar("ze_score_message_blue", "0")
    g_pCvarRoundEndDelay = register_cvar("ze_round_end_delay", "5")
   
    // Default Values
    g_bGameStarted = false
   
    // Static Values
    g_iMaxClients = get_member_game(m_nMaxPlayers)
   
    // Check Round Time to Terminate it
    set_task(1.0, "Check_RoundTimeleft", ROUND_TIME_LEFT, _, _, "b")
   
    // Create our array to store SteamIDs in
    g_aChosenPlayers = ArrayCreate(34)
}
 
public plugin_cfg()
{
    // Get our configiration file and Execute it
    new szCfgDir[64]
    get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir))
    server_cmd("exec %s/zombie_escape.cfg", szCfgDir)
   
    // Set Game Name
    new szGameName[64]
    formatex(szGameName, sizeof(szGameName), "Zombie Escape v%s", ZE_VERSION)
    set_member_game(m_GameDesc, szGameName)
   
    // Set Version
    register_cvar("ze_version", ZE_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
    set_cvar_string("ze_version", ZE_VERSION)
}
 
public Fw_CheckMapConditions_Post()
{
    // Block Game Commencing
    set_member_game(m_bGameStarted, true)
   
    // Set Freeze Time
    set_member_game(m_iIntroRoundTime, get_pcvar_num(g_pCvarFreezeTime))
   
    // Set Round Time
    set_member_game(m_iRoundTime, floatround(get_pcvar_float(g_pCvarRoundTime) * 60.0))
}
 
public Fw_PlayerKilled_Post(id)
{
    g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
    g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
   
    if (g_iAliveHumansNum == 0 && g_iAliveZombiesNum == 0)
    {
        // No Winner, All Players in one team killed Or Both teams Killed
        client_print(0, print_center, "%L", LANG_PLAYER, "NO_WINNER")
    }
}
 
public Fw_RestMaxSpeed_Post(id)
{
    if (!g_bIsZombie[id])
    {
        static Float:flMaxSpeed
        get_entvar(id, var_maxspeed, flMaxSpeed)
       
        if (flMaxSpeed != 1.0 && is_user_alive(id))
        {
            if (g_bHSpeedUsed[id])
            {
                // Set New Human Speed Factor
                set_entvar(id, var_maxspeed, flMaxSpeed + float(g_iHSpeedFactor[id]))
                return HAM_IGNORED
            }
               
            // Set Human Speed Factor, native not used
            set_entvar(id, var_maxspeed, flMaxSpeed + get_pcvar_float(g_pCvarHumanSpeedFactor))
            return HAM_IGNORED
        }
    }
   
    return HAM_SUPERCEDE
}
 
public Fw_PlayerSpawn_Post(id)
{
    if (!is_user_alive(id))
        return
   
    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 New_Round()
{
    // 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")
   
    // 2 is Hardcoded Value, It's Fix for the countdown to work correctly
    g_iCountDown = get_member_game(m_iIntroRoundTime) - 2
   
    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)
   
    g_iRoundNum++
   
    // Round Starting
    g_bIsRoundEnding = false
    g_bEndCalled = false
}
 
// Score Message Task
public Score_Message(TaskID)
{
    switch(get_pcvar_num(g_pCvarScoreMessageType))
    {
        case 0: // Disabled
        {
            return
        }
        case 1: // DHUD
        {
            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)
            show_dhudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
        }
        case 2: // HUD
        {
            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)
            show_hudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
        }
    }
}
 
public Countdown_Start(TaskID)
{
    // Check if the players Disconnected and there is only one player then remove all messages, and stop tasks
    if (!g_bGameStarted)
        return
   
    if (!g_iCountDown)
    {
        Choose_Zombies()
        remove_task(TASK_COUNTDOWN) // Remove the task
        return // Block the execution of the blew code
    }
 
    g_iCountDown--
}
 
public Choose_Zombies()
{
    new iZombies, id, iAliveCount
    new iReqZombies
   
    // Get total alive players and required players
    iAliveCount  = GetAllAlivePlayersNum()
    iReqZombies = RequiredZombies()
   
    // Loop till we find req players
    while(iZombies < iReqZombies)
    {
        id = GetRandomAlive(random_num(1, iAliveCount))
       
        // If player in array (Players steamid), it means he has chosen the previous round so skip him
        if (!is_user_alive(id) || g_bIsZombie[id] || PlayerInArray(id))
            continue
 
        Set_User_Zombie(id)
		
		if (ze_get_vip_flags(id) & HEALTH)
		{
			set_entvar(id, var_health, float(get_pcvar_num(g_pCvarFirstZombiesHealth) + ZOMBIE_INCREASE))
		}
		else
		{
			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++
    }
   
    // After choose, we clear the array
    ArrayClear(g_aChosenPlayers)
   
    // Now we loop through all players and store the chosen zombies steamid so they not chosen the next round again
    // Using steamid will add reconnect support
    for(new id = 1; id <= g_iMaxClients; id++)
    {
        if(!is_user_connected(id) || !g_bIsZombie[id])
            continue
       
        new szAuthId[34];
       
        get_user_authid(id, szAuthId, charsmax(szAuthId));
       
        ArrayPushString(g_aChosenPlayers, szAuthId)
    }
   
    // 2 is Hardcoded Value, It's Fix for the countdown to work correctly
    g_iCountDown = get_pcvar_num(g_pCvarZombieReleaseTime) - 2
   
    set_task(1.0, "ReleaseZombie_CountDown", TASK_COUNTDOWN2, _, _, "b")
}
 
public ReleaseZombie_CountDown(TaskID)
{
    if (!g_iCountDown)
    {
        ReleaseZombie()
        remove_task(TASK_COUNTDOWN2)
        return
    }
   
    // Release Hud Message
    set_hudmessage(255, 255, 0, -1.0, 0.21, 1, 2.0, 2.0)
    ShowSyncHudMsg(0, g_iReleaseNotice, "%L", LANG_PLAYER, "ZOMBIE_RELEASE", g_iCountDown)
   
    g_iCountDown --
}
 
public ReleaseZombie()
{
    ExecuteForward(g_iForwards[FORWARD_ZOMBIE_RELEASE], g_iFwReturn)
   
    for(new id = 1; id <= g_iMaxClients; id++)
    {
        if (is_user_alive(id) && g_bIsZombie[id])
        {
            g_bIsZombieFrozen[id] = false
            g_bZombieFreezeTime = false
        }
    }
}
 
public Freeze_Zombies(TaskID)
{
    for(new id = 1; id <= g_iMaxClients; id++)
    {
        if(!is_user_alive(id) || !g_bIsZombie[id])
            continue
       
        if (g_bIsZombieFrozen[id])
        {
            // Zombie & Frozen, then Freeze him
            set_entvar(id, var_maxspeed, 1.0)
        }
        else
        {
            if (g_bZSpeedUsed[id])
            {
                // Zombie but Not Frozen the set his speed form .cfg
                set_entvar(id, var_maxspeed, float(g_iZSpeedSet[id]))
                continue;
            }
               
            // Zombie but Not Frozen the set his speed form .cfg
            set_entvar(id, var_maxspeed, get_pcvar_float(g_pCvarZombieSpeed))
        }
    }
}
 
public Fw_TraceAttack_Pre(iVictim, iAttacker, Float:flDamage, Float:flDirection[3], iTracehandle, bitsDamageType)
{
    if (iVictim == iAttacker || !is_user_connected(iVictim) || !is_user_connected(iAttacker))
        return HC_CONTINUE
   
    // Attacker and Victim is in same teams? Skip code blew
    if (get_member(iAttacker, m_iTeam) == get_member(iVictim, m_iTeam))
        return HC_CONTINUE
   
    // In freeze time? Skip all other plugins (Skip the real trace attack event)
    if (g_bIsZombieFrozen[iVictim] || g_bIsZombieFrozen[iAttacker])
        return HC_SUPERCEDE
   
    // Execute pre-infection forward
    ExecuteForward(g_iForwards[FORWARD_PRE_INFECTED], g_iFwReturn, iVictim, iAttacker, floatround(flDamage))
   
    if (g_iFwReturn > 0)
    {
        return HC_SUPERCEDE
    }
   
    g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
   
    if (g_bIsZombie[iAttacker])
    {
        // Death Message with Infection style [Added here because of delay in Forward use]
        SendDeathMsg(iAttacker, iVictim)
       
        Set_User_Zombie(iVictim)
       
        ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, iVictim, iAttacker)
       
        if (g_iAliveHumansNum == 1) // Check if this is Last Human, Because of Delay i can't check if it's 0 instead of 1
        {
            // End round event called one time
            g_bEndCalled = true
           
            // Round is Ending
            g_bIsRoundEnding = true
           
            // Zombie Win, Leave text blank so we use ours from ML
            rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
           
            // Show Our Message
            client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
           
            // This needed so forward work also to add +1 for Zombies
            g_iTeam = 1 // ZE_TEAM_ZOMBIE
            ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
        }
    }
   
    return HC_CONTINUE
}

public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
    // Not Vaild Victim or Attacker so skip the event (Important to block out bounds errors)
    if (!is_user_connected(iVictim) || !is_user_connected(iAttacker))
        return HC_CONTINUE
   
    // Set Knockback here, So if we blocked damage in TraceAttack event player won't get knockback (Fix For Madness)
    if (g_bIsZombie[iVictim] && !g_bIsZombie[iAttacker] && get_user_weapon(iAttacker) != CSW_KNIFE)
    {
        // Remove Shock Pain
        set_member(iVictim, m_flVelocityModifier, 1.0)

        // Set Knockback
        static Float:flOrigin[3]
        get_entvar(iAttacker, var_origin, flOrigin)
        Set_Knockback(iVictim, flOrigin, get_pcvar_float(g_pCvarZombieKnockback), 2)
    }
   
    return HC_CONTINUE
}
 
public Round_End()
{
    g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
   
    if (g_iAliveZombiesNum == 0 && g_bGameStarted)
    {
        g_iTeam = 2 // ZE_TEAM_HUMAN
        ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
        client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
        g_iHumansScore++
        g_bIsRoundEnding = true
        return // To block Execute the code blew
    }
   
    g_iTeam = 1 // ZE_TEAM_ZOMBIE
    g_iZombiesScore++
    g_bIsRoundEnding = true
   
    // If it's already called one time, don't call it again
    if (!g_bEndCalled)
    {
        ExecuteForward(g_iForwards[FORWARD_ROUNDEND], g_iFwReturn, g_iTeam)
    }
   
    client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
}
 
public Event_RoundEnd_Pre(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
    // The two unhandeld cases by rg_round_end() native in our Mod
    if (event == ROUND_CTS_WIN || event == ROUND_TERRORISTS_WIN)
    {
        SetHookChainArg(3, ATYPE_FLOAT, get_pcvar_float(g_pCvarRoundEndDelay))
    }
}
 
public Round_Start()
{
    g_flReferenceTime = get_gametime()
    g_iRoundTime = get_member_game(m_iRoundTime)
}
 
public Check_RoundTimeleft()
{
    new Float:flRoundTimeLeft = (g_flReferenceTime + float(g_iRoundTime)) - get_gametime()
   
    if (floatround(flRoundTimeLeft) == 0)
    {
        // Round is Ending
        g_bIsRoundEnding = true
       
        // If Time is Out then Terminate the Round
        rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
       
        // Show our Message
        client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
    }
}
 
public client_disconnected(id)
{
    // Delay Then Check Players to Terminate The round (Delay needed)
    set_task(0.1, "Check_AlivePlayers")
   
    // Reset speed for this dropped id
    g_bHSpeedUsed[id] = false
    g_bZSpeedUsed[id] = false
}
 
// This check done when player disconnect
public Check_AlivePlayers()
{
    g_iAliveZombiesNum = GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
    g_iAliveHumansNum = GetAlivePlayersNum(CsTeams:TEAM_CT)
   
    // Game Started? (There is at least 2 players Alive?)
    if (g_bGameStarted)
    {
        // We are in freeze time?
        if (get_member_game(m_bFreezePeriod))
        {
            // Humans alive number = 1 and no zombies?
            if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers))
            {
                // Game started false again
                g_bGameStarted = false
            }
        }
        else // Not freeze time?
        {
            // Variables
            new iAllZombiesNum = GetTeamPlayersNum(CsTeams:TEAM_TERRORIST),
            iAllHumansNum = GetTeamPlayersNum(CsTeams:TEAM_CT),
            iDeadZombiesNum = GetDeadPlayersNum(CsTeams:TEAM_TERRORIST),
            iDeadHumansNum = GetDeadPlayersNum(CsTeams:TEAM_CT)
   
            // Alive humans number = 1 and no zombies at all, And no dead humans?
            if (g_iAliveHumansNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadHumansNum == 0 && iAllZombiesNum == 0)
            {
                // Game started is false and humans wins (Escape Success)
                g_bGameStarted = false
                rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_CTS, ROUND_CTS_WIN, "")
                client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_SUCCESS")
            }
           
            // Alive zombies number = 1 and no humans at all, And no dead zombies?
            if (g_iAliveZombiesNum < get_pcvar_num(g_pCvarReqPlayers) && iDeadZombiesNum == 0 && iAllHumansNum == 0)
            {
                // Game started is false and zombies wins (Escape Fail)
                g_bGameStarted = false
                rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
                client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
            }
           
            // 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")
            }
           
            // Zombies number more than 1 and no humans?
            if (g_iAliveZombiesNum >= get_pcvar_num(g_pCvarReqPlayers) && g_iAliveHumansNum == 0 && !g_bIsRoundEnding)
            {
                // Then Escape Fail as there is no humans
                rg_round_end(get_pcvar_float(g_pCvarRoundEndDelay), WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, "")
                client_print(0, print_center, "%L", LANG_PLAYER, "ESCAPE_FAIL")
            }
        }
    }
}
 
public client_putinserver(id)
{
    // Add Delay and Check Conditions To start the Game (Delay needed)
    set_task(1.0, "Check_AllPlayersNumber", _, _, _, "b")
}
 
public Check_AllPlayersNumber(TaskID)
{
    if (g_bGameStarted)
    {
        // If game started remove the task and block the blew Checks
        remove_task(TaskID)
        return
    }
   
    if (GetAllAlivePlayersNum() >= get_pcvar_num(g_pCvarReqPlayers))
    {
        // Players In server == The Required so game started is true
        g_bGameStarted = true
       
        // Restart the game
        server_cmd("sv_restart 2")
       
        // Print Fake game Commencing Message
        client_print(0, print_center, "%L", LANG_PLAYER, "START_GAME")
       
        // Remove the task
        remove_task(TaskID)
    }
}
 
public Set_User_Human(id)
{
    if (!is_user_alive(id))
        return
   
    g_bIsZombie[id] = false
	
	
	if (ze_get_vip_flags(id) & HEALTH)
	{
		set_entvar(id, var_health, float(get_pcvar_num(g_pCvarHumanHealth) + HUMAN_INCREASE))
	}
	else
	{
		set_entvar(id, var_health, get_pcvar_float(g_pCvarHumanHealth))
	}
    
    set_entvar(id, var_gravity, get_pcvar_float(g_pCvarHumanGravity)/800.0)
    ExecuteForward(g_iForwards[FORWARD_HUMANIZED], g_iFwReturn, id)
   
    if (get_member(id, m_iTeam) != TEAM_CT)
        rg_set_user_team(id, TEAM_CT, MODEL_UNASSIGNED)
}
 
public Set_User_Zombie(id)
{
    if (!is_user_alive(id))
        return
   
    g_bIsZombie[id] = true
	
	if (ze_get_vip_flags(id) & HEALTH)
	{
		set_entvar(id, var_health, float(get_pcvar_num(g_pCvarZombieHealth) + ZOMBIE_INCREASE))
	}
	else
	{
		set_entvar(id, var_health, get_pcvar_float(g_pCvarZombieHealth))
	}
	
    set_entvar(id, var_gravity, get_pcvar_float(g_pCvarZombieGravity)/800.0)
    rg_remove_all_items(id)
    rg_give_item(id, "weapon_knife", GT_APPEND)
    ExecuteForward(g_iForwards[FORWARD_INFECTED], g_iFwReturn, id, 0)
   
    if (get_member(id, m_iTeam) != TEAM_TERRORIST)
        rg_set_user_team(id, TEAM_TERRORIST, MODEL_UNASSIGNED)
}
 
public Map_Restart()
{
    // Add Delay To help Rest Scores if player kill himself, and there no one else him so round draw (Delay needed)
    set_task(0.1, "Reset_Score_Message")
}
 
public Reset_Score_Message()
{
    g_iHumansScore = 0
    g_iZombiesScore = 0
    g_iRoundNum = 0
}
 
 
/*
*   Simple function to check if given player steamid in our array or not
*   This is used to save the previous users steamid so they not chosen again next round
*/
public PlayerInArray(id)
{
    new szAuthId[34], szSavedAuthId[34];
   
    get_user_authid(id, szAuthId, charsmax(szAuthId))
   
    for(new i = 0; i < ArraySize(g_aChosenPlayers); i++)
    {
        ArrayGetString(g_aChosenPlayers, i, szSavedAuthId, charsmax(szSavedAuthId))
       
        if (equal(szSavedAuthId, szAuthId))
        {
            return true;
        }
    }
   
    return false;
}
 
// Natives
public native_ze_is_user_zombie(id)
{
    if (!is_user_connected(id))
    {
        return -1;
    }
   
    return g_bIsZombie[id]
}
 
public native_ze_set_user_zombie(id)
{
    if (!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
        return false;
    }
   
    Set_User_Zombie(id)
    return true;
}
 
public native_ze_set_user_human(id)
{
    if (!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
        return false;
    }
   
    Set_User_Human(id)
    return true;
}
 
public native_ze_is_game_started()
{
    return g_bGameStarted
}
 
public native_ze_is_zombie_frozen(id)
{
    if (!is_user_connected(id) || !g_bIsZombie[id])
    {
        return -1;
    }
   
    return g_bIsZombieFrozen[id]
}
 
public native_ze_get_round_number()
{
    if (!g_bGameStarted)
    {
        return -1;
    }
   
    return g_iRoundNum
}
 
public native_ze_get_humans_number()
{
    return GetAlivePlayersNum(CsTeams:TEAM_CT)
}
 
public native_ze_get_zombies_number()
{
    return GetAlivePlayersNum(CsTeams:TEAM_TERRORIST)
}
 
public native_ze_set_human_speed_factor(id, iFactor)
{
    if (!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
        return false;
    }
   
    g_bHSpeedUsed[id] = true
    g_iHSpeedFactor[id] = iFactor
    ExecuteHamB(Ham_Item_PreFrame, id)
    return true;
}
 
public native_ze_reset_human_speed(id)
{
    if (!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
        return false;
    }
   
    g_bHSpeedUsed[id] = false
    ExecuteHamB(Ham_Item_PreFrame, id)
    return true;
}
 
public native_ze_set_zombie_speed(id, iSpeed)
{
    if (!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
        return false;
    }
   
    g_bZSpeedUsed[id] = true
    g_iZSpeedSet[id] = iSpeed
    return true;
}
 
public native_ze_reset_zombie_speed(id)
{
    if (!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
        return false;
    }
   
    g_bZSpeedUsed[id] = false
    return true;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
Image

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 609
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#2

Post by Mohamed Alaa » 3 Months Ago

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests