|
楼主 |
发表于 2007-9-6 14:50:34
|
显示全部楼层
来自 中国–辽宁–沈阳
回复: 谁有wall插件改进?我的墙怎么只冲着一面?
最好改成 管理员能穿过,但是其他玩家不能穿过,原来的wall最不能用的地方就是只能立一个墙 哎 我把wall.sma也发过来吧 高手帮忙看看改下 可以多次立墙,墙的方向跟管理员头部方向一致,只有管理员能穿过,其他人不能穿过。谢谢了。 这2个sma哪个能修改成那样就帮忙改下。
#include <amxmod>
#include <amxmisc>
#include <engine>
new boom
new wall[33]
new smoke
new white
new fire
//----------------------------------------------------------------------------------------------
public plugin_init(){
register_plugin("wall","2.0","AssKicR")
register_clcmd("amx_wall","Ass_acc_wall",ADMIN_SLAY)
register_cvar("wall_radius", "0" )
register_cvar("wall_maxdamage", "0" )
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public plugin_precache() {
precache_model("models/wall.mdl")
smoke = precache_model("sprites/steam1.spr")
white = precache_model("sprites/white.spr")
fire = precache_model("sprites/explode1.spr")
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public Ass_acc_wall(id,level,cid) {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
Ass_wall(id)
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public Ass_wall(id) {
if (!is_user_alive(id)) {
client_print(id,print_chat,"**** Wall Placement Denied ****")
return PLUGIN_HANDLED
}
if (wall[id] != 0)
{
new Float:vExplodeAt[3]
entity_get_vector(wall[id], EV_VEC_origin, vExplodeAt)
blowUp(id, vExplodeAt)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3)
write_coord(floatround(vExplodeAt[0]))
write_coord(floatround(vExplodeAt[1]))
write_coord(floatround(vExplodeAt[2]))
write_short(boom)
write_byte(50)
write_byte(15)
write_byte(0)
message_end()
remove_entity(wall[id])
client_print(id,print_chat,"**** Wall Detonated ****")
wall[id] = false
return PLUGIN_CONTINUE
} else if (wall[id] == 0) {
wall[id] = create_entity("info_target")
if(wall[id] == 0) return PLUGIN_HANDLED_MAIN
entity_set_string(wall[id], EV_SZ_classname, "coool_wall")
entity_set_model(wall[id], "models/wall.mdl")
entity_set_float(wall[id], EV_FL_health, 1000.0)
new Float:PlayerOrigin[3]
entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
entity_set_origin(wall[id], PlayerOrigin)
entity_set_int(wall[id], EV_INT_solid, SOLID_BBOX)
entity_set_int(wall[id], EV_INT_movetype, MOVETYPE_FLY)
entity_set_edict(wall[id], EV_ENT_owner, id)
new Float:vRetVector[3]
entity_get_vector(id, EV_VEC_v_angle, vRetVector)
vRetVector[0]=float(0)
entity_set_vector(wall[id], EV_VEC_angles, vRetVector)
set_size(wall[id], Float:{-78.0,-5.0,-156.0}, Float:{78.0,5.0,156.0} )
client_print(id,print_chat,"**** Wall Placed ****")
}
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public blowUp( id, Float:vExplodeAt[3] )
{
new distanceBetween
new damage, multiplier
new name[32]
get_user_name(id,name,31)
set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
new FFOn= get_cvar_num("mp_friendlyfire")
new origin[3]
origin[0]=floatround(vExplodeAt[0])
origin[1]=floatround(vExplodeAt[1])
origin[2]=floatround(vExplodeAt[2])+37
explode(origin) // blowup even if dead
for(new a = 1; a <= 33; a++)
{
if( is_user_alive(a) && ( get_user_team(id) != get_user_team(a) || FFOn != 0 || a==id ) )
{
new origin1[3]
get_user_origin(a,origin1)
distanceBetween = get_distance(origin, origin1 )
if( distanceBetween < get_cvar_num("wall_radius") )
{
multiplier=(get_cvar_num("wall_maxdamage")*get_cvar_num("wall_maxdamage"))/get_cvar_num("wall_radius")
damage=(get_cvar_num("wall_radius")-distanceBetween)*multiplier
damage=sqrt(damage)
ExtraDamage(a, a, damage, "Admin Wall")
} // distance
} // alive target...
} // loop
}
//----------------------------------------------------------------------------------------------
public explode( vec1[3] )
{
// blast circles
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
write_byte( 21 )
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2] + 16)
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2] + 1936)
write_short( white )
write_byte( 0 ) // startframe
write_byte( 0 ) // framerate
write_byte( 2 ) // life 2
write_byte( 20 ) // width 16
write_byte( 0 ) // noise
write_byte( 188 ) // r
write_byte( 220 ) // g
write_byte( 255 ) // b
write_byte( 255 ) //brightness
write_byte( 0 ) // speed
message_end()
//Explosion2
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 12 )
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_byte( 188 ) // byte (scale in 0.1's) 188
write_byte( 10 ) // byte (framerate)
message_end()
//TE_Explosion
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
write_byte( 3 )
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_short( fire )
write_byte( 60 ) // byte (scale in 0.1's) 188
write_byte( 10 ) // byte (framerate)
write_byte( 0 ) // byte flags
message_end()
//Smoke
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
write_byte( 5 ) // 5
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_short( smoke )
write_byte( 10 ) // 2
write_byte( 10 ) // 10
message_end()
}
//----------------------------------------------------------------------------------------------
/* Do Exta Damage to a Player */
public ExtraDamage(id, attacker, damage, weaponDescription[] )
{
if ( is_user_alive(id) )
{
new userHealth=get_user_health(id)
set_user_health(id, userHealth - damage )
if ( userHealth - damage <= 0 )
{
logKill(attacker,id, weaponDescription)
if ( get_user_team(id) != get_user_team(attacker) )
{
// The person dying shouldn't get negative credit for this kill (so add it back)
set_user_frags( id, get_user_frags(id) + 1 )
// The killing should get credit for the frag
set_user_frags( attacker, get_user_frags(attacker)+ 1 )
}
else
{
// The person dying shouldn't get negative credit for this kill (so add it back)
set_user_frags( id, get_user_frags(id)+ 1 )
// The killer killed a teammember or self
// Engine gives credit for the kill so let's take away that + 1
set_user_frags( attacker, get_user_frags(attacker) - 2)
}
message_begin( MSG_BROADCAST, get_user_msgid("DeathMsg"),{0,0,0},0)
write_byte(attacker)
write_byte(id)
write_byte(0)
write_string(weaponDescription)
message_end()
}
}
}
//----------------------------------------------------------------------------------------------
/* Log a kill using standard HL-logging format */
public logKill(attacker, victim, weaponDescription[] )
{
//Save Hummiliation
new namea[24],namev[24],authida[20],authidv[20],teama[8],teamv[8]
//Info On Attacker
get_user_name(attacker,namea,23)
get_user_team(attacker,teama,7)
get_user_authid(attacker,authida,19)
//Info On Victim
get_user_name(victim,namev,23)
get_user_team(victim,teamv,7)
get_user_authid(victim,authidv,19)
//Log This Kill
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",
namea,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv, weaponDescription )
}
//----------------------------------------------------------------------------------------------
public sqrt(num)
{
// Cool - Newton's Method - Ludwig
new div = num
new result = 1
while (div > result)
{ // end when div == result, or just below
div = (div + result) / 2 // take mean value as new divisor
result = num / div
}
return div
}
//---------------------------------------------------------------------------------------------- |
|