|
发表于 2007-7-17 09:01:43
|
显示全部楼层
来自 中国–广西–贵港
回复: 求高手帮忙改一下生化危机2.3a插件的属性.谢谢
这个是修改过的源代码,全亮模式,
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <fakemeta>
#define PLUGIN "Zombie Swarm"
#define VERSION "2.3a"
#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]
//Pcvars...
new zomb_switch, zomb_hp,zomb_ap,zomb_speed,zomb_leap,zomb_money,zomb_screen
new MODEL[256], zomb_model
//The old commands
new autoteam, buytime, freezetime, limitteams, roundtime
new hudsync
new nvg
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar(PLUGIN,VERSION,FCVAR_SERVER)
register_dictionary("zombie_swarm.txt")
register_logevent("round_start",2,"1=Round_Start")
register_event("ResetHUD","event_hud_reset", "be")
register_event("TextMsg","event_restart_attempt", "a", "2=#Game_will_restart_in")
register_event("CurWeapon","event_cur_weapon","be", "1=1")
register_event("Damage","event_damage_scream","be","2!0","3=0")
register_event("Damage", "event_damage", "be", "2!0","3=0","4!0")
register_event("StatusIcon", "event_status_icon", "be", "1=1", "1=2", "2=c4")
register_forward(FM_ClientUserInfoChanged,"fw_info")
register_forward(FM_PlayerPostThink,"fw_postthink")
register_forward(FM_Touch,"fw_Touch");
register_forward( FM_EmitSound, "fw_EmitSound" )
register_clcmd("fullupdate","clcmd_fullupdate")
register_concmd("zombie_swarm", "zsonoff", ADMIN_BAN, "<0/1> Disable/Enable Zombie Swarm")
zomb_switch = register_cvar("zs_enabled","1")
zomb_hp = register_cvar("zs_health","750")
zomb_ap = register_cvar("zs_armour","500")
zomb_speed = register_cvar("zs_speed","300")
zomb_leap = register_cvar("zs_leap","0")
zomb_money = register_cvar("zs_money","1500")
zomb_screen = register_cvar("zs_screen","55")
zomb_model = register_cvar("zs_model","zombie_swarm")
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")
set_task(1.0, "check_cvar", 977 , _ , _ , "b")
hudsync = CreateHudSyncObj()
nvg = get_user_msgid("NVGToggle")
}
public plugin_precache()
{
precache_model("models/player/zombie_swarm/zombie_swarm.mdl")
precache_model("models/v_knife_zombie.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 check_cvar()
{
if(get_pcvar_num(zomb_switch))
{
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 client_putinserver(id)
{
g_zombie[id] = false
g_restart_attempt[id] = false
client_cmd(id, "stopsound")
}
public zsonoff(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new szArg[5]
read_argv(1, szArg, 4)
if (equali(szArg,"1") || equali(szArg,"on"))
{
if (get_cvar_num("zombie_swarm") == 1)
{
console_print(id, "%s is already on!", PLUGIN)
return PLUGIN_HANDLED
}
zs_on()
set_hudmessage(255, 255, 255, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, -1)
show_hudmessage(0, "%s is now ON!", PLUGIN)
console_print(0, "%s has been turned ON!", PLUGIN)
client_print(0, print_chat, "%s has been turned ON!", PLUGIN)
return PLUGIN_HANDLED
}
if (equali(szArg,"0") || equali(szArg,"off"))
{
if (get_cvar_num("zs_enabled") == 0)
{
console_print(id, "%s is already off!", PLUGIN)
return PLUGIN_HANDLED
}
zs_off()
set_hudmessage(255, 255, 255, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, -1)
show_hudmessage(0, "%s has been turned OFF!", PLUGIN)
console_print(0, "%s has been turned OFF!", PLUGIN)
client_print(0, print_chat, "%s has been turned OFF!", PLUGIN)
return PLUGIN_HANDLED
}
console_print(id, "Invalid argument!")
client_print(id, print_chat, "Invalid argument!")
return PLUGIN_HANDLED
}
public zs_on()
{
new maxplayers = get_maxplayers()
for (new i = 1; i <= maxplayers; i++)
{
g_zombie = false
g_restart_attempt = false
}
set_cvar_num("zs_enabled", 1)
set_task(1.0, "lightning_effects")
set_task(1.0, "ambience_loop")
set_task(1.0, "check_cvar" ,977, _ , _ , "b")
server_cmd("sv_restartround 3")
}
public zs_off()
{
new maxplayers = get_maxplayers()
for (new i = 1; i <= maxplayers; i++)
{
g_zombie = false
g_restart_attempt = false
client_cmd(i, "stopsound")
}
set_cvar_num("zs_enabled", 0)
set_lights("#OFF")
remove_task(12175)
remove_task(977)
server_cmd("sv_restartround 3")
}
public round_start(id)
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
set_task (0.5 , "team_check")
set_task (5.0 , "StartMsg")
return PLUGIN_CONTINUE
}
public clcmd_fullupdate() return PLUGIN_HANDLED
public event_restart_attempt()
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
new players[32], num
get_players(players, num, "a")
for (new i; i < num; ++i)
g_restart_attempt[players] = true
return PLUGIN_CONTINUE
}
public event_hud_reset(id)
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
if (g_restart_attempt[id])
g_restart_attempt[id] = false
set_task(0.2,"event_player_spawn",id)
return PLUGIN_CONTINUE
}
public event_player_spawn(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
new CsTeams:team = cs_get_user_team(id)
new CsArmorType:ArmorType = CS_ARMOR_VESTHELM
if(team == CS_TEAM_T)
{
g_zombie[id] = true
set_task(random_float(0.1,0.5), "Reset_Weapons", id) //Strips zombies if they do have guns
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_UNRELIABLE, nvg, {0,0,0}, id)
write_byte(1)
message_end()
} else {
message_begin(MSG_ONE_UNRELIABLE, nvg, {0,0,0}, id)
write_byte(1)
message_end()
}
}
else if(team == CS_TEAM_CT)
{
g_zombie[id] = false
set_user_footsteps(id, 0)
cs_reset_user_model(id)
cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(zomb_money))
}
ShowHUD(id)
return PLUGIN_CONTINUE
}
public fw_info(id,buffer)
{
if (g_zombie[id])
return FMRES_SUPERCEDE
return FMRES_IGNORED
}
public fw_postthink(id)
{
if (!is_user_alive(id))
return FMRES_IGNORED
if (g_zombie[id])
{
new szModel[33]
get_pcvar_string(zomb_model, MODEL, 255)
cs_get_user_model(id, szModel, 32)
if (containi(szModel, MODEL) !=-1 )
return FMRES_IGNORED
new info = engfunc(EngFunc_GetInfoKeyBuffer, id)
engfunc(EngFunc_SetClientKeyValue, id, info, "model", MODEL)
return FMRES_IGNORED
}
return FMRES_IGNORED
}
public ShowHUD(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
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, 0.0, 0.3, 0.0, 0.0)
ShowSyncHudMsg(id, hudsync , "血: %d | 甲: %d", hp, ap)
}
set_task(0.1 , "ShowHUD" , id)
return PLUGIN_CONTINUE
}
public event_cur_weapon(id)
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
new weaponID = read_data(2)
if(!is_user_alive(id))
return PLUGIN_HANDLED
if(weaponID != CSW_KNIFE)
return PLUGIN_HANDLED
if ( g_zombie[id] )
{
set_user_maxspeed(id,(get_pcvar_float(zomb_speed)))
set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, "models/v_knife_zombie.mdl"))
}
return PLUGIN_CONTINUE
}
public event_status_icon(id)
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
engclient_cmd(id, "drop", "weapon_c4")
set_task(0.1, "delete_c4")
return PLUGIN_CONTINUE
}
public delete_c4()
{
new ent = find_ent_by_class(-1, "weaponbox")
while (ent > 0)
{
new model[33]
entity_get_string(ent, EV_SZ_model, model, 32)
if (equali(model, "models/w_backpack.mdl"))
{
remove_entity(ent)
return PLUGIN_CONTINUE
}
ent = find_ent_by_class(ent, "weaponbox")
}
return PLUGIN_CONTINUE
}
public Reset_Weapons(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
if(g_zombie[id])
{
strip_user_weapons(id)
give_item(id,"weapon_knife")
if (is_user_bot(id))
{
return PLUGIN_HANDLED
}
else if (get_pcvar_num(zomb_leap))
{
set_task(15.0,"cooldown_begin",id)
set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 6.0, 14.0)
show_hudmessage(id, "15 秒之后你可以跳跃")
}
}
return PLUGIN_CONTINUE
}
public cooldown_begin(id)
{
if (!is_user_alive(id))
return PLUGIN_HANDLED
if (g_zombie[id])
{
set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 6.0, 5.0)
show_hudmessage(id, "你现在可以跳")
give_item(id, "item_longjump")
}
return PLUGIN_CONTINUE
}
public team_check()
{
new players[32],num,i,id
get_players(players,num,"d")
for(i = 0; i < num; i++)
{
id = players
if (!g_zombie[id])
{
cs_set_user_team(id,CS_TEAM_T)
set_cvar_num("sv_restartround",1)
}
}
return PLUGIN_HANDLED
}
public StartMsg(id)
{
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 thunder_clap()
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
set_lights("p")
client_cmd(0,"speak ambience/thunder_clap.wav")
set_task(1.25,"lightning_effects",12175)
return PLUGIN_CONTINUE
}
public ambience_loop()
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
client_cmd(0,"spk zombie_swarm/ambience.wav")
set_task(17.0,"ambience_loop")
return PLUGIN_CONTINUE
}
public fw_Touch(pToucher, pTouched)
{
if(!get_pcvar_num(zomb_switch))
return FMRES_IGNORED
if ( !pev_valid(pToucher) || !pev_valid(pTouched) )
return FMRES_IGNORED
if ( !is_user_connected(pTouched) )
return FMRES_IGNORED
if ( !g_zombie[pTouched] )
return FMRES_IGNORED
new className[32]
pev(pToucher, pev_classname, className, 31)
if ( equal(className, "weaponbox") || equal(className, "armoury_entity" ) || equal(className, "weapon_shield" ) )
return FMRES_SUPERCEDE
return FMRES_IGNORED
}
public fw_EmitSound(id, channel, sample[])
{
if(!get_pcvar_num(zomb_switch))
return FMRES_IGNORED
if ( !is_user_alive(id) || !g_zombie[id] )
return FMRES_IGNORED
if ( sample[0] == 'w' && sample[1] == 'e' && sample[8] == 'k' && sample[9] == 'n' )
{
switch(sample[17])
{
case 'l': return FMRES_SUPERCEDE
case 's', 'w':
{
emit_sound(id, CHAN_WEAPON, miss_zombie[random_num(0, ZOMBIE_MISS - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
case 'b', '1', '2', '3', '4':
{
emit_sound(id, CHAN_WEAPON, hit_zombie[random_num(0, ZOMBIE_HIT - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
}
}
return FMRES_IGNORED
}
public event_damage_scream(id)
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
if(!is_user_alive(id))
return PLUGIN_HANDLED
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 {
emit_sound(id, CHAN_VOICE, pain_human[random_num(0, HUMAN_PAIN - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
}
return PLUGIN_HANDLED
}
public event_damage(id)
{
if(!get_pcvar_num(zomb_switch))
return PLUGIN_HANDLED
if(!is_user_alive(id))
return PLUGIN_HANDLED
new damage = read_data(2)
new AttakerWeapon, AttakerPartHit
new attacker = get_user_attacker(id, AttakerWeapon, AttakerPartHit)
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] && AttakerWeapon == CSW_KNIFE )
{
if(damage >= get_pcvar_num(zomb_screen))
{
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)
}
if ( current_hp >= max_hp )
{
set_user_health(attacker, max_hp)
} else {
set_user_health(attacker, current_hp)
}
}
return PLUGIN_HANDLED
}
stock Punch_View(id, Float:ViewAngle[3])
{
entity_set_vector(id, EV_VEC_punchangle, ViewAngle)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang5129\\ f0\\ fs16 \n\\ par }
*/ |
|