Raised This Month: $ Target: $400
 0% 

[EDIT] ZP 3.59 Main Function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sl4y62
Junior Member
Join Date: Dec 2009
Old 05-17-2012 , 21:55   Re: [EDIT] ZP 3.59 Main Function
Reply With Quote #1

up !
This is a function that i need , "Make a Zombie" and disregarded the other functions (class , menus ...)
And i dont need the g_survround , only the normal infection

its possible?

PHP Code:
// Make Zombie Task
public make_zombie_task()
{
    
// Call make a zombie with playerid MAKEZOMBIE_TASK and no further args
    
make_a_zombie(MAKEZOMBIE_TASK0000);
}

// Make a Zombie Function
make_a_zombie(playeridnemsurvswarmmulti)
{    
    
// Get alive players count
    
static iPlayersnum
    iPlayersnum 
fnGetAlive()
    
    if (
iPlayersnum 1// not enough players
    
{
        
set_task(10.0"make_zombie_task"MAKEZOMBIE_TASK)
        return;
    }
    
    
g_models_i 0.0 // reset model change count
    
g_teams_i 0.0 // reset teams change count
    
    // round starting
    
g_newround false
    g_survround 
false
    g_nemround 
false
    g_swarmround 
false
    
    
static id
    
    
if ((playerid == MAKEZOMBIE_TASK && random_num(1get_pcvar_num(cvar_survchance)) == get_pcvar_num(cvar_surv)) || surv// Survival Chance
    
{        
        
g_survround true // survivor round
        
        
if (playerid == MAKEZOMBIE_TASK// choose player randomly?
            
id fnGetRandomAlive(random_num(1iPlayersnum))
        else
            
id playerid
        
        g_survivor
[id] = true // set var
        
        
if (get_pcvar_num(cvar_survleap)) // give survivor leap?
            
fm_give_item(id"item_longjump")
        
        
// Remove previous tasks
        
remove_task(id+TEAM_TASK)
        
        
// Switch to CT
        
if (fm_get_user_team(id) != CS_TEAM_CT// need to change team?
        
{        
            
fm_set_user_team(idCS_TEAM_CT)
            
fm_set_user_team_msg(id+TEAM_TASK)
        }
        
        
// Set Health [0 = auto]
        
if (!get_pcvar_num(cvar_survhp))
            
fm_set_user_health(idfnGetHumans()*get_pcvar_num(cvar_humanhp))
        else
            
fm_set_user_health(idget_pcvar_num(cvar_survhp))
        
        
// Set Gravity
        
set_pev(idpev_gravityget_pcvar_float(cvar_survgravity))
        
        
// glow?
        
if (get_pcvar_num(cvar_survglow))
        {
            
#if defined HANDLE_MODELS_ON_SEPARATE_ENT
            
fm_set_rendering(fm_find_ent_by_owner(-1"player_model"id), kRenderFxGlowShell00255kRenderNormal25)
            
#else
            
fm_set_rendering(idkRenderFxGlowShell00255kRenderNormal25)
            
#endif
        
}
        
        
fm_strip_user_weapons(id// strip player from weapons
        
fm_give_item(id"weapon_m249"// give M249 machinegun only
        
        // Turn off his flashlight
        
turn_off_flashlight(id)
        
set_task(3.0"turn_off_flashlight"id// bugfix
        
        // Give the survivor a bright light
        
set_pev(idpev_effectspev(idpev_effects) | EF_BRIGHTLIGHT)
        
        
// Survivor bots will also need nightvision to see in the dark
        
if (is_user_bot(id)) fm_set_bot_nvg(id1);
        
        
// Play survivor sound
        
PlaySound(sound_survivor[random_num(0sizeof sound_survivor -1)]);
        
        static 
name[32]
        
get_user_name(idnamesizeof name 1)
        
        
// show Survivor HUD notice
        
set_hudmessage(2020255, -1.00.2510.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"NOTICE_SURVIVOR"name)
    
        
// Turn the rest of players into zombies
        
for (id 1id <= g_maxplayersid++)
        {
            if (!
is_user_alive(id)) // skip dead
                
continue;
        
            if (
g_survivor[id]) // skip the survivor
                
continue;            
            
            
zombieme(id01// turn into a zombie
        
}
    }
    else if ((
playerid == MAKEZOMBIE_TASK && random_num(1get_pcvar_num(cvar_swarmchance)) == get_pcvar_num(cvar_swarm)) || swarm// Swarm Chance
    
{        
        
g_swarmround true // swarm round
        
        // Turn all the T into zombies
        
for (id 1id <= g_maxplayersid++)
        {            
            if (!
is_user_alive(id)) // not alive
                
continue;
            
            if (
fm_get_user_team(id) == CS_TEAM_T// only Terrorists
                
zombieme(id01// turn into a zombie
        
}
        
        
// Play swarm sound
        
PlaySound(sound_swarm[random_num(0sizeof sound_swarm -1)]);
        
        
// Show Swarm HUD notice
        
set_hudmessage(2025520, -1.00.2510.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"NOTICE_SWARM")
    }
    else if ((
playerid == MAKEZOMBIE_TASK && random_num(1get_pcvar_num(cvar_multichance)) == get_pcvar_num(cvar_multi) && floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil) > 1) || multi// Multi Infection Chance
    
{
        static 
iZombiesiMaxZombies
        
        
// iMaxZombies is rounded up, in case there aren't enough players
        
iMaxZombies floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil)
        
iZombies 0
        
        
// Randomly turn iMaxZombies players into zombies
        
while (iZombies iMaxZombies)
        {
            if (
id g_maxplayers)
                
id++
            else
                
id 1
            
            
if (!is_user_alive(id) || g_zombie[id]) // dead or already a zombie
                
continue;
            
            if (
random_num(01))
            {
                
zombieme(id01// turn into a zombie
                
iZombies++
            }
        }
        
        
// Turn the rest of players into humans
        
for (id 1id <= g_maxplayersid++)
        {            
            if (!
is_user_alive(id) || g_zombie[id]) // only those of them who arent zombies
                
continue
            
            
// remove previous tasks
            
remove_task(id+TEAM_TASK)
            
            
// Switch to CT
            
if (fm_get_user_team(id) != CS_TEAM_CT// need to change team?
            
{
                
fm_set_user_team(idCS_TEAM_CT)
                
set_task(0.1+g_teams_i"fm_set_user_team_msg"id+TEAM_TASK)
                
g_teams_i += 0.1// increase teams task count
            
}
        }
        
        
// Play multi infection sound
        
PlaySound(sound_multi[random_num(0sizeof sound_multi -1)]);
        
        
// Show Multi Infection HUD notice
        
set_hudmessage(200500, -1.00.2510.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"NOTICE_MULTI")
    }
    else
    {
        
// Infection mode (only 1 zombie)
        
        
if (playerid == MAKEZOMBIE_TASK// choose player randomly?
            
id fnGetRandomAlive(random_num(1iPlayersnum))
        else
            
id playerid
        
        
// Nemesis Chance
        
if ((playerid == MAKEZOMBIE_TASK && random_num(1get_pcvar_num(cvar_nemchance)) == get_pcvar_num(cvar_nem)) || nem)
        {
            
g_nemround true // nemesis round
            
zombieme(id10)
        }
        else
        {
            
zombieme(id00// boring first zombie
        
}
        
        
// Rest of players left as humans (CTs)
        
for (id 1id <= g_maxplayersid++)
        {
            if (!
is_user_alive(id)) // skip dead
                
continue;
                
            if (
g_zombie[id]) // skip our first zombie
                
continue;
            
            
// Remove previous tasks
            
remove_task(id+TEAM_TASK)
            
            
// Switch to CT
            
if (fm_get_user_team(id) != CS_TEAM_CT// need to change team?
            
{
                
fm_set_user_team(idCS_TEAM_CT)
                
set_task(0.1+g_teams_i"fm_set_user_team_msg"id+TEAM_TASK)
                
g_teams_i += 0.1// increase teams task count
            
}
        }
    }
    
    
// Last Zombie Check
    
set_task(0.1"fnCheckLastZombie")


Last edited by sl4y62; 05-17-2012 at 21:56.
sl4y62 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode