|
Junior Member
|

05-17-2012
, 21:55
Re: [EDIT] ZP 3.59 Main Function
|
#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_TASK, 0, 0, 0, 0); }
// Make a Zombie Function make_a_zombie(playerid, nem, surv, swarm, multi) { // 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(1, get_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(1, iPlayersnum)) 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(id, CS_TEAM_CT) fm_set_user_team_msg(id+TEAM_TASK) } // Set Health [0 = auto] if (!get_pcvar_num(cvar_survhp)) fm_set_user_health(id, fnGetHumans()*get_pcvar_num(cvar_humanhp)) else fm_set_user_health(id, get_pcvar_num(cvar_survhp)) // Set Gravity set_pev(id, pev_gravity, get_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), kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25) #else fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25) #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(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT) // Survivor bots will also need nightvision to see in the dark if (is_user_bot(id)) fm_set_bot_nvg(id, 1); // Play survivor sound PlaySound(sound_survivor[random_num(0, sizeof sound_survivor -1)]); static name[32] get_user_name(id, name, sizeof name - 1) // show Survivor HUD notice set_hudmessage(20, 20, 255, -1.0, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1) ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SURVIVOR", name) // Turn the rest of players into zombies for (id = 1; id <= g_maxplayers; id++) { if (!is_user_alive(id)) // skip dead continue; if (g_survivor[id]) // skip the survivor continue; zombieme(id, 0, 1) // turn into a zombie } } else if ((playerid == MAKEZOMBIE_TASK && random_num(1, get_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 = 1; id <= g_maxplayers; id++) { if (!is_user_alive(id)) // not alive continue; if (fm_get_user_team(id) == CS_TEAM_T) // only Terrorists zombieme(id, 0, 1) // turn into a zombie } // Play swarm sound PlaySound(sound_swarm[random_num(0, sizeof sound_swarm -1)]); // Show Swarm HUD notice set_hudmessage(20, 255, 20, -1.0, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1) ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SWARM") } else if ((playerid == MAKEZOMBIE_TASK && random_num(1, get_pcvar_num(cvar_multichance)) == get_pcvar_num(cvar_multi) && floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil) > 1) || multi) // Multi Infection Chance { static iZombies, iMaxZombies // 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(0, 1)) { zombieme(id, 0, 1) // turn into a zombie iZombies++ } } // Turn the rest of players into humans for (id = 1; id <= g_maxplayers; id++) { 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(id, CS_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(0, sizeof sound_multi -1)]); // Show Multi Infection HUD notice set_hudmessage(200, 50, 0, -1.0, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1) ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_MULTI") } else { // Infection mode (only 1 zombie) if (playerid == MAKEZOMBIE_TASK) // choose player randomly? id = fnGetRandomAlive(random_num(1, iPlayersnum)) else id = playerid // Nemesis Chance if ((playerid == MAKEZOMBIE_TASK && random_num(1, get_pcvar_num(cvar_nemchance)) == get_pcvar_num(cvar_nem)) || nem) { g_nemround = true // nemesis round zombieme(id, 1, 0) } else { zombieme(id, 0, 0) // boring first zombie } // Rest of players left as humans (CTs) for (id = 1; id <= g_maxplayers; id++) { 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(id, CS_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.
|
|