Hedgehog | Дата: Воскресенье, 20.12.2009, 22:11:43 | Сообщение # 5 |
Сержант
Группа: Пользователи
Сообщений: 28
Статус: Не в сети
| Вот весь Zombie exodus Code /* CREDITS: MeRcyLeZZ : Original Zombie Plague mod HoRRoR : Original idea and coding (exodus) MAPPERS: Per : zd_sTwn Hubert : zd_canal SPECIAL THANKS: PAHANCS : get_entity_origin stock MUSIC FROM: Killing Floor Silent Hill OST */
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> #include <fun> #include <csx> #include <zombieplague>
#define PLUGIN "Zombie Plague: Exodus" #define VERSION "0.6 (Beta 3)" #define AUTHOR "HoRRoR"
new g_maxplayers new is_round_started = 0 new g_is_must_change_map // ----------------------------------- // new is_despair_map = 0 new despair_surv_health new is_despair_started = 0 new g_dsp_survcount new is_nemesis_chance new despair_nemesis_first_chance new namesis_min_chance new despair_nemesis_health // ----------------------------------- // new is_survival_started = 0 new Float:g_SpawnVecs[60][3]; new is_survival_map = 0 new survival_hum_health new g_msgScreenFade const FFADE_IN = 0x0000 const FFADE_STAYOUT = 0x0004 const UNIT_SECOND = (1<<12) new infectionbomb_chance new nemesis_survival_chance new nemesis_kill_extra_ammo new friend_die_extra_hp new time_to_change_map new bot_survival_stupid new bot_survival_extrahp new survival_blind_players new nemesis_kill_extra_hp new nemesis_can_spawn new srv_zom_health_multiplier // ----------------------------------- // new swarm_human_health new cvar_despair_minplayers new cvar_survival_minplayers new survival_sp_exists new is_mode_activated = 0 new start_despair = 0 new start_survival = 0 new player_was_survivor[33] new maxcyclecount = 256 // ----------------------------------- //
new music_file[17][] = { "sound/zombie_plague/music/infection_1.mp3", //MODE_INFECTION "sound/zombie_plague/music/infection_1.mp3", //MODE_NEMESIS "sound/zombie_plague/music/infection_1.mp3", //MODE_SURVIVOR "sound/zombie_plague/music/infection_1.mp3", //MODE_SWARM "sound/zombie_plague/music/infection_1.mp3", //MODE_MULTI "sound/zombie_plague/music/plague_1.mp3", //MODE_PLAGUE "sound/zombie_plague/music/Survival/nemesis.mp3", //survival nemesis music "sound/zombie_plague/music/Despair/track01.mp3", //despair music 1 "sound/zombie_plague/music/Despair/track02.mp3", //despair music 2 "sound/zombie_plague/music/Despair/track03.mp3", //despair music 3 "sound/zombie_plague/music/Despair/track04.mp3", //despair music 4 "sound/zombie_plague/music/Despair/track05.mp3", //despair music 5 "sound/zombie_plague/music/Survival/track01.mp3", //survival music 1 "sound/zombie_plague/music/Survival/track02.mp3", //survival music 2 "sound/zombie_plague/music/Survival/track03.mp3", //survival music 3 "sound/zombie_plague/music/Survival/track04.mp3", //survival music 4 "sound/zombie_plague/music/Survival/track05.mp3" //survival music 5 }
new announce_snd[7][] = { "zombie_plague/exodus_announcer/startgame.wav", "zombie_plague/exodus_announcer/domination.wav", "zombie_plague/exodus_announcer/bloodbath.wav", "zombie_plague/exodus_announcer/maniac.wav", "zombie_plague/exodus_announcer/termination.wav", "zombie_plague/exodus_announcer/killingmachine.wav", "zombie_plague/exodus_announcer/flawlessvictory.wav" }
public plugin_precache() { new i for (i = 0; i < 17; i++) precache_generic(music_file[i]) for (i = 0; i < 7; i++) precache_sound(announce_snd[i]) }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_logevent("roundStart", 2, "1=Round_Start") register_event("DeathMsg", "event_player_death", "a") register_clcmd("say /stayhere", "no_change_map") register_clcmd("say_team /stayhere", "no_change_map") register_clcmd("say /restartround", "restartround") register_clcmd("say_team /restartround", "restartround") g_msgScreenFade = get_user_msgid("ScreenFade") g_maxplayers = get_maxplayers() //despair mode despair_surv_health = register_cvar("zp_ex_dsp_basesurvhealth", "200") despair_nemesis_health = register_cvar("zp_ex_dsp_nemhealth", "2000") despair_nemesis_first_chance = register_cvar("zp_ex_dsp_nemchance", "0") namesis_min_chance = register_cvar("zp_ex_dsp_nemminchance", "10") cvar_despair_minplayers = register_cvar("zp_ex_dsp_minplayers", "8") // survival mode survival_hum_health = register_cvar("zp_ex_srv_basehumhealth", "50") infectionbomb_chance = register_cvar("zp_ex_srv_bomb_chance", "2") nemesis_survival_chance = register_cvar("zp_ex_srv_nem_chance", "2") nemesis_kill_extra_ammo = register_cvar("zp_ex_srv_nemkill_ammo", "5") nemesis_kill_extra_hp = register_cvar("zp_ex_srv_nemkill_extrahp", "500") friend_die_extra_hp = register_cvar("zp_ex_srv_die_extrahp", "200") survival_blind_players = register_cvar("zp_ex_srv_blind", "1") cvar_survival_minplayers = register_cvar("zp_ex_srv_minplayers", "8") // other cvars srv_zom_health_multiplier = register_cvar("zp_ex_zomhealth_divider", "3") time_to_change_map = register_cvar("zp_exodus_time_to_change_map", "30.0") bot_survival_stupid = register_cvar("zp_exodus_bot_helper", "1") bot_survival_extrahp = register_cvar("zp_exodus_bot_helper_extrahp", "500") swarm_human_health = register_cvar("zp_swarm_hum_health", "500") }
public roundStart() { new mapname[3] get_mapname(mapname,3) remove_task(101) remove_task(295) is_round_started = 0 g_is_must_change_map = 0 nemesis_can_spawn = 1 for (new i = 1; i <= g_maxplayers; i++) remove_task(i) if (is_mode_activated == 0 && equal(mapname,"zd_")) { start_despair = 1 is_despair_map = 1 is_mode_activated = 1 set_task(1.0,"execute_config",201) } if (is_mode_activated == 0 && equal(mapname,"zs_")) { start_survival = 1 is_survival_map = 1 is_mode_activated = 1 set_task(5.0,"execute_config",202) } if (start_despair == 1) set_task(9.0,"start_despair_mode") if (start_survival == 1) { if (get_pcvar_num(survival_blind_players) == 1) for (new i = 1; i <= g_maxplayers; i++) MsgScreenFade(i,40,0,100) if (random_num(1,100) <= 1) { set_hudmessage(100, 0, 255, -1.0, 0.4, _, _, 7.0, _, _, -1) show_hudmessage(0, "Do you wanna see some street magic?") // joke! xD }else{ set_hudmessage(100, 0, 255, -1.0, 0.4, _, _, 7.0, _, _, -1) show_hudmessage(0, "Wait for starting the game...") } set_task(8.0,"start_survival_mode",295) } }
public execute_config(variant) { if (variant == 201) { server_cmd("exec addons/amxmodx/configs/exodus_despair.cfg") MsgColoredChat(0,"^x04[DEV]^x01 Executing config for^x04 DESPAIR") } if (variant == 202) { server_cmd("exec addons/amxmodx/configs/exodus_survival.cfg") MsgColoredChat(0,"^x04[DEV]^x01 Executing config for^x04 SURVIVAL") } }
/* ------------------------------------------- | Режим: DESPAIR | ------------------------------------------- */ public start_despair_mode() { if (get_pcvar_num(cvar_despair_minplayers) < 8) set_pcvar_num(cvar_despair_minplayers, 8) if (is_despair_map == 1 && get_playersnum() >= get_pcvar_num(cvar_despair_minplayers) && is_round_started == 0) { remove_task(101) remove_task(295) set_hudmessage(200, 100, 0, -1.0, 0.2, 0, 1.0, 3.0, 0.2, 0.2, -1) show_hudmessage(0, "Despair mode!") is_despair_started = 1 new randomplayer g_dsp_survcount = 1 is_round_started = 1 is_nemesis_chance = get_pcvar_num(despair_nemesis_first_chance) new health_multiplier = get_playersnum() new cyclecount = 0 // делаем сурвиворов while (g_dsp_survcount <= 4 && cyclecount < maxcyclecount) { cyclecount++ randomplayer = random_num(1,g_maxplayers) if (is_valid_ent(randomplayer) && is_user_alive(randomplayer) && !zp_get_user_survivor(randomplayer) && !player_was_survivor[randomplayer]) { // делаем сурвивора zp_make_user_survivor(randomplayer) g_dsp_survcount++ player_was_survivor[randomplayer]++ set_user_health(randomplayer, get_pcvar_num(despair_surv_health) * health_multiplier) } } for (new i = 1; i <= g_maxplayers; i++) { if (is_valid_ent(i) && zp_get_user_zombie(i)) player_was_survivor[i] = 0 } } if (get_playersnum() < get_pcvar_num(cvar_despair_minplayers)) { new cv_nextmap[32] get_cvar_string("amx_nextmap", cv_nextmap, 31) g_is_must_change_map = 1 set_hudmessage(255, 0, 0, -1.0, 0.35, 0, 3.0, 30.0, 0.2, 0.2, 2) show_hudmessage(0, ".: EXODUS :.^nDespair cannot be started, because %d players is needed!^nThe map will be changed to ^"%s^"^n^nIf you don't want to change map or if you want to wait other players, write /stayhere in chat.",get_pcvar_num(cvar_despair_minplayers),cv_nextmap) set_task(get_pcvar_float(time_to_change_map),"exodus_failed_and_change_map" ,101) for (new i = 1; i <= g_maxplayers; i++) MsgScreenFade(i,40,0,100,0) } }
public no_change_map(id) { if (g_is_must_change_map == 1) { MsgColoredChat(0,"^x04[EXODUS]^x01 Map will not changed.") remove_task(101) g_is_must_change_map = 0 set_hudmessage(255, 0, 0, -1.0, 0.35, 0, 3.0, 6.0, 0.2, 0.2, 2) show_hudmessage(0, ".: EXODUS :.^nMap will not changed in this round.") } }
public restartround(id) { if (g_is_must_change_map == 1) { MsgColoredChat(0,"^x04[EXODUS]^x01 Restarting round...") remove_task(101) g_is_must_change_map = 0 server_cmd("sv_restartround 1") } }
public exodus_failed_and_change_map() { new cv_nextmap[32] get_cvar_string("amx_nextmap", cv_nextmap, 31) server_cmd("changelevel %s",cv_nextmap) }
public zp_user_humanized_post(id) { if (is_despair_started == 1) { new health_multiplier = get_playersnum() if (zp_get_user_survivor(id)) set_user_health(id, get_pcvar_num(despair_surv_health) * health_multiplier) } if (is_survival_started == 1) { new health_multiplier = get_playersnum() set_user_health(id, get_pcvar_num(survival_hum_health) * health_multiplier) give_item(id,"item_kevlar") give_item(id,"weapon_usp") give_item(id,"ammo_45acp") give_item(id,"ammo_45acp") give_item(id,"ammo_45acp") if (is_user_bot(id) && get_pcvar_num(bot_survival_stupid) == 1 && is_valid_ent(id)) { set_user_health(id,get_user_health(id) + get_pcvar_num(bot_survival_extrahp)) ex_give_random_weapon(id) } } }
public event_player_death() { new killer = read_data(1) new victim = read_data(2) ex_announce(killer) if (is_despair_started == 1) set_task(2.0,"despeir_ressurect",victim) if (is_survival_started == 1) { set_task(2.0,"survival_ressurect",victim) if (zp_get_user_nemesis(victim)) { zp_set_user_ammo_packs(killer, zp_get_user_ammo_packs(killer) + get_pcvar_num(nemesis_kill_extra_ammo)) set_user_health(killer,get_user_health(killer) + get_pcvar_num(nemesis_kill_extra_hp)) client_cmd(0,"mp3 stop; mp3 loop %s",music_file[random_num(12,16)]) MsgScreenFade(killer,0,200,0,100,1) } if (!(zp_get_user_zombie(victim) || zp_get_user_nemesis(victim))) for (new i = 1; i < get_maxplayers(); i++) if ( !(zp_get_user_zombie(i) || zp_get_user_nemesis(i)) && is_valid_ent(i) && !is_user_alive(victim)) { set_user_health(i,get_user_health(i) + get_pcvar_num(friend_die_extra_hp)) MsgScreenFade(i,200,0,0,100,1) } } }
public despeir_ressurect(dinner) { new name[33] if ((is_user_alive(dinner) == 0) && zp_get_user_zombie(dinner)) { if (random_num(1,100) < is_nemesis_chance && is_nemesis_chance > get_pcvar_num(namesis_min_chance)) { zp_respawn_user(dinner, ZP_TEAM_ZOMBIE) zp_make_user_nemesis(dinner) set_user_health(dinner, get_pcvar_num(despair_nemesis_health)) get_user_name(dinner,name,32) is_nemesis_chance = 0 MsgColoredChat(0,"^x04[EXODUS]^x01 Player ^x04%s^x01 is a nemesis!",name) }else{ zp_respawn_user(dinner, ZP_TEAM_ZOMBIE) is_nemesis_chance++ if (is_nemesis_chance < get_pcvar_num(namesis_min_chance)) MsgColoredChat(0,"^x04[EXODUS]^x01 Chance to spawn nemesis: ^x04%d%",is_nemesis_chance) else { new text[100] format(text, 99, "^x04[EXODUS]^x01 Chance to spawn nemesis: ^x03%d%",is_nemesis_chance) message_begin(MSG_ALL, get_user_msgid("SayText"), _, dinner) write_byte(dinner) write_string(text) message_end() } } } }
/* Winner teams for zp_round_ended() { WIN_NO_ONE, WIN_ZOMBIES, WIN_HUMANS */ public zp_round_ended(winteam) { client_cmd(0,"mp3 stop") if (is_despair_map == 1 && zp_get_human_count() == 4) { client_cmd(0,"spk %s",announce_snd[6]) set_hudmessage(255, 0, 0, -1.0, 0.2, 0, 1.0, 1.0, 1.0, 1.0, -1) show_hudmessage(0, "Flawless victory!") } /* if (zp_is_plague_round() && winteam == WIN_HUMANS) { client_cmd(0,"stopsound; mp3 stop") client_cmd(0,"spk sound/zp_salvation.wav") } */
}
public zp_round_started(gamemode) { is_round_started = 1 if (is_despair_started == 1) { client_cmd(0,"stopsound; mp3 loop %s",music_file[random_num(7,11)]) client_cmd(0,"spk %s",announce_snd[0]) }else if (is_survival_started == 1) { client_cmd(0,"stopsound; mp3 loop %s",music_file[random_num(12,16)]) client_cmd(0,"spk %s",announce_snd[0]) }else{ switch (gamemode) { case MODE_INFECTION:client_cmd(0,"mp3 loop %s",music_file[0]) case MODE_NEMESIS:client_cmd(0,"mp3 loop %s",music_file[1]) case MODE_SURVIVOR:client_cmd(0,"mp3 loop %s",music_file[2]) case MODE_SWARM:client_cmd(0,"mp3 loop %s",music_file[3]) case MODE_MULTI:client_cmd(0,"mp3 loop %s",music_file[4]) case MODE_PLAGUE:client_cmd(0,"mp3 loop %s",music_file[5]) } } // это вообще мааленькая надстройка к оригинальному ZP, влом было отдельный плагин писать if (zp_is_swarm_round() || zp_is_plague_round()) { for (new i = 1; i <= g_maxplayers; i++) { if (!(zp_get_user_zombie(i) || zp_get_user_nemesis(i) || zp_get_user_survivor(i)) && is_user_alive(i)) set_user_health(i,get_pcvar_num(swarm_human_health)) } } }
/* ------------------------------------------- | Режим: SURVIVAL | ------------------------------------------- */ public unblind() for (new i = 1; i <= g_maxplayers; i++) MsgScreenFade(i,40,0,100,0)
public start_survival_mode() { if (get_pcvar_num(cvar_survival_minplayers) < 8) set_pcvar_num(cvar_survival_minplayers, 8) survival_sp_exists = 0 readSpawns set_task(1.0,"unblind") if (is_survival_map == 1 && get_playersnum() >= get_pcvar_num(cvar_survival_minplayers) && is_round_started == 0) { remove_task(101) remove_task(295) set_hudmessage(200, 100, 0, -1.0, 0.2, 0, 1.0, 3.0, 0.2, 0.2, -1) show_hudmessage(0, "Survival mode!") is_survival_started = 1 new randomplayer new g_srv_humcount g_srv_humcount = 1 is_round_started = 1 new playernum = 1 new tempid[5] new cyclecount = 0 // делаем людей while (g_srv_humcount < 4 && cyclecount < maxcyclecount) { cyclecount++ randomplayer = random_num(1,get_playersnum()) if (is_valid_ent(randomplayer) && is_user_alive(randomplayer) && !zp_get_user_survivor(randomplayer) && !player_was_survivor[randomplayer]) { zp_make_user_survivor(randomplayer) // делаем сурвивора, чтобы не далать сварм раунд и не ебаться с количеством люди/зомби playernum = zp_get_human_count() g_srv_humcount = zp_get_human_count() tempid[zp_get_human_count()] = randomplayer if (survival_sp_exists == 1) entity_set_origin(randomplayer, g_SpawnVecs[playernum]) player_was_survivor[randomplayer]++ // client_print(0,print_console,"[DEV] Playernum++ = %d, Human count = %d",playernum,g_srv_humcount) } } for (new i = 1; i <= 4; i++) { zp_infect_user(tempid[i],_,1) zp_disinfect_user(tempid[i],1) // client_print(0,print_console,"[DEV] Player [%d] turned to human. Cycle count = %d",tempid[i],i) } for (new i = 1; i <= g_maxplayers; i++) { if (is_valid_ent(i) && zp_get_user_zombie(i)) player_was_survivor[i] = 0 } if (survival_sp_exists == 0) { MsgColoredChat(0,"^x04[EXODUS]^x01 Spawn points for survival mode not found!") for (new i = 1; i <= g_maxplayers; i++) if(!is_user_bot(i) && is_user_alive(i) && is_valid_ent(i)) ex_give_random_weapon(i) } } if (get_playersnum() < get_pcvar_num(cvar_survival_minplayers)) { new cv_nextmap[32] get_cvar_string("amx_nextmap", cv_nextmap, 31) g_is_must_change_map = 1 set_hudmessage(255, 0, 0, -1.0, 0.35, 0, 3.0, 30.0, 0.2, 0.2, 2) show_hudmessage(0, ".: EXODUS :.^nSurvival cannot be started, because %d players is needed!^nThe map will be changed to ^"%s^"^n^nIf you don't want to change map or if you want to wait other players, write /stayhere in chat.",get_pcvar_num(cvar_survival_minplayers),cv_nextmap) set_task(get_pcvar_float(time_to_change_map),"exodus_failed_and_change_map ",101) for (new i = 1; i <= g_maxplayers; i++) MsgScreenFade(i,40,0,100,0) } }
public readSpawns() { new Float:temporigin[3] new i = 1 new ent = -1 new check[256] // для удобства мэпперов while((ent = find_ent_by_class(ent, "info_target")) != 0) { entity_get_string(ent, EV_SZ_targetname, check, 31) if(equal(check, ".survivorspawn")) { get_entity_origin(ent, temporigin) // client_print(0,print_console,"[DEV] %d %d %d",floatround(temporigin[0]),floatround(temporigin[1]),floatround(temporigin[2])) g_SpawnVecs[i] = temporigin i++ survival_sp_exists = 1 } } // client_print(0,print_console,"[DEV] Found %d ^"survivor spawn point^" entities.",i-1) }
public survival_ressurect(id) { if ((is_user_alive(id) == 0) && (zp_get_user_zombie(id) || zp_get_user_nemesis(id))) { new name[33] zp_respawn_user(id, ZP_TEAM_ZOMBIE) if (random_num(1,100) <= get_pcvar_num(infectionbomb_chance) && is_user_alive(id)) { get_user_name(id,name,31) MsgColoredChat(0,"^x04[EXODUS]^x01 Zombie ^x04%s^x01 spawn with ^x04Infection Bomb",name) give_item(id,"weapon_hegrenade") }else if(random_num(1,100) <= get_pcvar_num(nemesis_survival_chance) && is_user_alive(id) && zp_get_human_count() == 4 && nemesis_can_spawn == 1) { get_user_name(id,name,31) zp_make_user_nemesis(id) client_cmd(0,"mp3 stop; mp3 loop %s",music_file[6]) nemesis_can_spawn = 0 MsgColoredChat(0,"^x04[EXODUS]^x01 Zombie ^x04%s^x01 spawn as ^x04Nemesis",name) } } }
public zp_user_infected_post(id,infector) { if (is_survival_map || is_despair_map) set_user_health(id,get_user_health(id) / get_pcvar_num(srv_zom_health_multiplier))
ex_announce(infector) }
public ex_announce(activator) { new name[33] get_user_name(activator,name,32) set_hudmessage(255, 0, 0, -1.0, 0.2, 0, 1.0, 1.0, 1.0, 1.0, -1) switch (get_user_frags(activator)) { case 20: { client_cmd(0,"spk %s",announce_snd[1]) show_hudmessage(0, "%s is on domination!",name) } case 40: { client_cmd(0,"spk %s",announce_snd[2]) show_hudmessage(0, "%s is on blood bath!",name) } case 60: { client_cmd(0,"spk %s",announce_snd[3]) show_hudmessage(0, "%s is a maniac!",name) } case 80: { client_cmd(0,"spk %s",announce_snd[4]) show_hudmessage(0, "%s is on a termination!",name) } case 100: { client_cmd(0,"spk %s",announce_snd[5]) show_hudmessage(0, "%s is a killing machine!",name) } } }
public ex_give_random_weapon(id) { new randomweapon = random_num(1,4) switch (randomweapon) { case 1: { give_item(id,"weapon_m4a1") give_item(id,"ammo_556nato") give_item(id,"ammo_556nato") } case 2: { give_item(id,"weapon_mp5navy") give_item(id,"ammo_9mm") give_item(id,"ammo_9mm") } case 3: { give_item(id,"weapon_m3") give_item(id,"ammo_buckshot") give_item(id,"ammo_buckshot") } case 4: { give_item(id,"weapon_ak47") give_item(id,"ammo_556nato") give_item(id,"ammo_556nato") } } }
public client_putinserver(id) { player_was_survivor[id] = 0 } // ========================================================= // === STOCKS ============================================== // =========================================================
stock get_entity_origin(ent, Float:fEntOrigin[3]) { return pev(ent, pev_origin, fEntOrigin) }
stock MsgScreenFade(id, red=200, green=100, blue=0, alpha=255, type=0) { if (is_valid_ent(id)) { message_begin(MSG_ONE, g_msgScreenFade, _, id) if (!type) // if type = 0 - blind, else - fade out { write_short(4) write_short(0) write_short(FFADE_STAYOUT) }else{ write_short(UNIT_SECOND) write_short(0) w rite_short(FFADE_IN) } write_byte(red) write_byte(green) write_byte(blue) write_byte(alpha) message_end() } }
stock MsgColoredChat(id, const message[], any:...) { // From original ZP static buffer[512], i, argscount argscount = numargs() if (!id) { static player for (player = 1; player <= g_maxplayers; player++) { if (!is_valid_ent(player)) continue; // Remember changed arguments static changed[5], changedcount // [5] = max LANG_PLAYER occurencies changedcount = 0 // Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) { setarg(i, 0, player) changed[changedcount] = i changedcount++ } } vformat(buffer, charsmax(buffer), message, 3) message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, player) write_byte(player) write_string(buffer) message_end() // Replace back player id's with LANG_PLAYER for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER) } } // Send to specific target else { vformat(buffer, charsmax(buffer), message, 3) message_begin(MSG_ONE, get_user_msgid("SayText"), _, id) write_byte(id) write_string(buffer) message_end() } }
Добавлено (20.12.2009, 22:11:43) --------------------------------------------- Ну что никто не поможет?
мой сайт http://cs-mapping.ucoz.net
|
|
| |