|
这是僵尸插件的原码 但是出问题了我在CS1。5下一超过6人他就自动刷新 而且超过6人之后进来别的玩家就无法选择警察和匪徒 求高手指点哪出错了
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <fakemeta>
#define PLUGIN "Zombie Swarm"
new VERSION[] = "2.1a"
#define AUTHOR "Mini_Midget"
#define MAX_PLAYERS 32
new bool:g_restart_attempt[MAX_PLAYERS + 1]
#define ZOMBIE_MISS 2
new miss_zombie[ZOMBIE_MISS][] = {"zombie/claw_miss1.wav", "zombie/claw_miss2.wav" }
#define ZOMBIE_HIT 3
new hit_zombie[ZOMBIE_HIT][] = {"zombie/claw_strike1.wav", "zombie/claw_strike2.wav","zombie/claw_strike3.wav" }
#define ZOMBIE_PAIN 2
new pain_zombie[ZOMBIE_PAIN][] = {"zombie_swarm/zombie_pain1.wav", "zombie_swarm/zombie_pain2.wav" }
#define HUMAN_PAIN 2
new pain_human[HUMAN_PAIN][] = {"zombie_swarm/human_pain1.wav", "zombie_swarm/human_pain2.wav" }
new bool:g_zombie[33]
new bool:g_human[33]
//Pcvars...
new zomb_hp,zomb_ap,zomb_speed,zomb_lightning
//The old commands
new autoteam, buytime, freezetime, limitteams, roundtime
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_dictionary("zombie_swarm.txt")
register_logevent("round_start",2,"1=Round_Start")
register_event("ResetHUD","event_hud_reset", "be")
register_clcmd("fullupdate","clcmd_fullupdate")
register_event("TextMsg","event_restart_attempt", "a", "2=#Game_will_restart_in")
register_event("CurWeapon","event_cur_weapon","be")
register_event("WeapPickup", "event_weap_pickup", "be", "1!29")
register_event("Damage","event_damage_pain","be","2!0","3=0")
register_event("Damage", "event_damage_camera", "be", "2!0","3=0","4!0")
register_event("Damage", "event_damage_lifesteal", "be", "2!0","3=0","4!0")
register_forward( FM_EmitSound, "fw_EmitSound" )
zomb_hp = register_cvar("zs_health","750")
zomb_ap = register_cvar("zs_armour","400")
zomb_speed = register_cvar("zs_speed","240")
zomb_lightning = register_cvar("zs_lightning","1")
buytime = get_cvar_num("mp_buytime")
freezetime = get_cvar_num("mp_freezetime")
limitteams = get_cvar_num("mp_limitteams")
roundtime = get_cvar_num("mp_roundtime")
set_task(1.0, "lightning_effects")
set_task(1.0, "ambience_loop")
}
public plugin_precache() {
precache_model("models/player/zombie_swarm/zombie_swarm.mdl")
precache_sound("zombie_swarm/ambience.wav")
new i
for (i = 0; i < ZOMBIE_MISS; i++)
precache_sound(miss_zombie)
for (i = 0; i < ZOMBIE_HIT; i++)
precache_sound(hit_zombie)
for (i = 0; i < ZOMBIE_PAIN; i++)
precache_sound(pain_zombie)
for (i = 0; i < HUMAN_PAIN; i++)
precache_sound(pain_human)
}
public client_connect(id)
{
g_human[id] = false
g_zombie[id] = false
}
public client_putinserver() {
if (get_playersnum() >= 1)
{
set_cvar_num("mp_autoteambalance",0)
set_cvar_float("mp_buytime", 0.5)
set_cvar_num("mp_freezetime",0)
set_cvar_num("mp_limitteams", 1)
set_cvar_float("mp_roundtime", 2.5)
} else {
set_cvar_num("mp_autoteambalance",autoteam)
set_cvar_num("mp_buytime", buytime)
set_cvar_num("mp_freezetime",freezetime)
set_cvar_num("mp_limitteams", limitteams)
set_cvar_num("mp_roundtime", roundtime)
}
}
public round_start(id) {
set_task(0.5,"team_check")
set_task(5.0,"StartMsg")
}
public clcmd_fullupdate() {
return PLUGIN_HANDLED
}
public event_restart_attempt() {
new players[32], num
get_players(players, num, "a")
for (new i; i < num; ++i)
g_restart_attempt[players] = true
}
public event_hud_reset(id) {
if (g_restart_attempt[id]) {
g_restart_attempt[id] = false
return
}
event_player_spawn(id)
}
public event_player_spawn(id) {
new CsTeams:team = cs_get_user_team(id)
new CsArmorType:ArmorType = CS_ARMOR_VESTHELM
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
if(team == CS_TEAM_T)
{
g_human[id] = false
g_zombie[id] = true
set_task(0.1, "RemovePickedWeapon", id) //Strips zombies if they do have guns
cs_set_user_model(id,"zombie_swarm")
set_user_health(id,get_pcvar_num(zomb_hp))
cs_set_user_armor(id,get_pcvar_num(zomb_ap),ArmorType)
set_user_footsteps(id, 1)
set_user_gravity(id,0.875)
set_user_maxspeed(id,(get_pcvar_float(zomb_speed)))
cs_set_user_money(id,0)
if (!cs_get_user_nvg(id))
{
cs_set_user_nvg(id,1)
message_begin(MSG_ONE, get_user_msgid("NVGToggle"), {0,0,0}, id)
write_byte(1)
message_end()
} else {
message_begin(MSG_ONE, get_user_msgid("NVGToggle"), {0,0,0}, id)
write_byte(1)
message_end()
}
}
else if(team == CS_TEAM_CT)
{
g_zombie[id] = false
g_human[id] = true
set_user_footsteps(id, 0)
cs_reset_user_model(id)
cs_set_user_money(id, cs_get_user_money(id) + 1200)
}
return PLUGIN_CONTINUE
}
public client_PreThink(id) {
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
if(g_human[id])
return PLUGIN_CONTINUE
if(g_zombie[id])
{
new hp = get_user_health(id)
new ap = get_user_armor(id)
set_hudmessage(255, 180, 0, 0.02, 0.90, 0, 6.0, 1.0)
show_hudmessage(id, "Health: %d Armour: %d", hp, ap)
}
return PLUGIN_CONTINUE
}
public event_cur_weapon(id) {
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
if(g_zombie[id])
{
set_user_maxspeed(id,(get_pcvar_float(zomb_speed)))
}
return PLUGIN_CONTINUE
}
public event_weap_pickup(id) {
set_task(0.1, "RemovePickedWeapon", id)
}
public RemovePickedWeapon(id) {
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
if(g_zombie[id])
{
strip_user_weapons(id)
give_item(id,"weapon_knife")
}
return PLUGIN_HANDLED
}
public team_check(players[])
{
new players[32],num,i,id
get_players(players,num)
for(i = 0; i < num; i++)
{
id = players
if (is_user_bot(id) && is_user_alive(id) && g_human[id])
{
cs_set_user_team(id,CS_TEAM_T)
cs_set_user_model(id,"zombie_swarm")
set_cvar_num("sv_restartround",1)
}
}
return PLUGIN_CONTINUE
}
public StartMsg()
{
client_print(0,print_chat,"%L",LANG_PLAYER,"WELCOME_MSG", VERSION)
client_print(0,print_chat,"%L",LANG_PLAYER,"ZOMBIE_MSG", get_pcvar_num(zomb_hp), get_pcvar_num(zomb_ap), get_pcvar_num(zomb_speed))
}
public lightning_effects() {
if(get_pcvar_num(zomb_lightning))
{
set_lights("a")
set_task(random_float(10.0,17.0),"thunder_clap",12175)
}
else if (!get_pcvar_num(zomb_lightning))
{
set_lights("b")
remove_task(12175)
set_task(20.0,"lightning_effects")
}
return PLUGIN_HANDLED
}
public thunder_clap() {
set_lights("s")
client_cmd(0,"speak ambience/thunder_clap.wav")
set_task(1.0,"lightning_effects",12175)
}
public ambience_loop() {
client_cmd(0,"spk zombie_swarm/ambience.wav")
set_task(19.7,"ambience_loop")
}
public fw_EmitSound( id, channel, sample[] ) {
if (!is_user_alive(id) || !is_user_connected(id))
return FMRES_IGNORED
new temp[2], weapon = get_user_weapon( id, temp[0], temp[1] )
if (weapon == CSW_KNIFE)
{
if (g_zombie[id])
{
if (equal(sample, "weapons/knife_hit1.wav"))
{
emit_sound( id, CHAN_WEAPON, hit_zombie[random_num(0, ZOMBIE_HIT - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
else if (equal(sample, "weapons/knife_hit2.wav" ))
{
emit_sound( id, CHAN_WEAPON, hit_zombie[random_num(0, ZOMBIE_HIT - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
else if (equal(sample, "weapons/knife_hit3.wav" ))
{
emit_sound( id, CHAN_WEAPON, hit_zombie[random_num(0, ZOMBIE_HIT - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
else if ( equal( sample, "weapons/knife_hit4.wav" ) )
{
emit_sound( id, CHAN_WEAPON, hit_zombie[random_num(0, ZOMBIE_HIT - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
else if ( equal( sample, "weapons/knife_stab.wav") )
{
emit_sound( id, CHAN_WEAPON, hit_zombie[random_num(0, ZOMBIE_HIT - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
else if ( equal( sample, "weapons/knife_slash1.wav") )
{
emit_sound( id, CHAN_WEAPON, miss_zombie[random_num(0, ZOMBIE_MISS - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
else if ( equal( sample, "weapons/knife_slash2.wav") )
{
emit_sound( id, CHAN_WEAPON, miss_zombie[random_num(0, ZOMBIE_MISS - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
else if ( equal( sample, "weapons/knife_hitwall1.wav") )
{
emit_sound( id, CHAN_WEAPON, miss_zombie[random_num(0, ZOMBIE_MISS - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
return FMRES_SUPERCEDE
}
}
}
return FMRES_IGNORED
}
public event_damage_pain(id)
{
if (!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
if ( g_zombie[id] )
{
emit_sound(id, CHAN_VOICE, pain_zombie[random_num(0, ZOMBIE_PAIN - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else if ( g_human[id] )
{
emit_sound(id, CHAN_VOICE, pain_human[random_num(0, HUMAN_PAIN - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
}
return PLUGIN_CONTINUE
}
public event_damage_camera(id)
{
if (!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
new damage = read_data(2)
new AttakerWeapon, AttakerPartHit
new attacker = get_user_attacker(id, AttakerWeapon, AttakerPartHit)
if (attacker > sizeof g_zombie)
return PLUGIN_CONTINUE
if( g_zombie[attacker] )
{
if(AttakerWeapon == CSW_KNIFE && damage >= 55)
{
new Float:Random_Float[3]
for(new i = 0; i < 3; i++) Random_Float = random_float(100.0, 125.0)
Punch_View(id, Random_Float)
}
}
return PLUGIN_CONTINUE
}
stock Punch_View(id, Float:ViewAngle[3])
{
entity_set_vector(id, EV_VEC_punchangle, ViewAngle)
}
public event_damage_lifesteal(id) {
new damage = read_data(2)
new attacker = get_user_attacker(id)
if ( ! is_user_alive(id) || ! is_user_connected(id) )
return PLUGIN_CONTINUE
new current_hp = get_user_health(attacker)
new max_hp = get_pcvar_num(zomb_hp)
current_hp += damage
if (attacker > sizeof g_zombie)
return PLUGIN_CONTINUE
if ( g_zombie[attacker] ) {
if ( current_hp >= max_hp )
set_user_health(attacker, max_hp)
else
set_user_health(attacker, current_hp)
}
return PLUGIN_CONTINUE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}{\\ f1\\ fnil Tahoma;}}\n{\\ colortbl ;\\ red0\\ green0\\ blue0;}\n\\ viewkind4\\ uc1\\ pard\\ cf1\\ lang5129\\ f0\\ fs16 blood thirst\n\\ par Bleeding\\ cf0\\ f1 \n\\ par }
*/ |
|