|
发表于 2009-8-13 23:28:28
|
显示全部楼层
|阅读模式
来自 中国–湖北–武汉–洪山区
本帖最后由 visa567 于 2009-8-13 23:54 编辑
僵尸F有个防护罩的插件
有效时间在哪里改?
这是源码
#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
#include <fun>
new campoforze
new bool:campodefuerza[33] = false
new stuck[33]
new const Float:size[][3] = {
{0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
{0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
{0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
{0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
{0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
}
public plugin_init()
{
register_plugin("Campo de fuerza", "1.0", "Capostrike")
campoforze = zp_register_extra_item("防护罩(20秒)", 15, ZP_TEAM_HUMAN)
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}
public zp_extra_item_selected(player, itemid)
{
// Not alive
if (!is_user_alive(player))
return;
if (itemid == campoforze) {
new name[32]
get_user_name(player, name, 31)
set_hudmessage(0, 255, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "%s 使用了防护罩,僵尸们小心啦!!", name)
set_user_rendering(player, kRenderFxGlowShell, 200, 200, 250, kRenderNormal, 300)
campodefuerza[player] = true
efects(player)
campofuerza(player)
set_task(20.0, "timeout", player)
}
}
public campofuerza(id1)
{
// Not alive
if (!is_user_alive(id1))
return;
if(!campodefuerza[id1])
return;
new maxplayers = get_maxplayers();
for (new id2; id2 <= maxplayers; id2++)
{
if (zp_get_user_zombie(id2))
{
campofuntion(id1, id2)
}
}
set_task(0.1, "campofuerza", id1)
}
public campofuntion(id1, id2)
{
// Not alive
if (!is_user_alive(id1))
return;
if (!is_user_alive(id2))
return;
if(!campodefuerza[id1])
return;
static Float:vOrigin[3], Float:vOrigin2[3]
pev(id1, pev_origin, vOrigin)
pev(id2, pev_origin, vOrigin2)
if(vector_distance(vOrigin, vOrigin2) < 180)
{
set_task(0.5,"checkstuck",0,"",0,"b")
if(vOrigin[1] > vOrigin2[1]) vOrigin2[1] -= 30.0
if(vOrigin[1] < vOrigin2[1]) vOrigin2[1] += 30.0
set_pev(id2, pev_origin, vOrigin2)
}
}
public efects(id)
{
// Not alive
if (!is_user_alive(id))
return;
if(!campodefuerza[id])
return;
// Get player origin
static Float:originF[3]
pev(id, pev_origin, originF)
// Colored Aura
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_DLIGHT) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
write_byte(30) // radius
write_byte(80) // r
write_byte(80) // g
write_byte(250) // b
write_byte(2) // life
write_byte(0) // decay rate
message_end()
set_task(0.1, "efects", id)
return;
}
public client_putinserver(id) {
campodefuerza [id] = false
}
public client_disconnect(id) {
campodefuerza[id] = false
}
public event_round_start()
{
new maxplayers = get_maxplayers();
for (new id; id <= maxplayers; id++)
{
campodefuerza[id] = false
}
}
public zp_user_infected_post(player, infector)
{
if (campodefuerza[player])
{
campodefuerza[player] = false
}
return PLUGIN_CONTINUE
}
public timeout(id)
{
// Not alive
if (!is_user_alive(id))
return;
if(!campodefuerza[id])
return;
campodefuerza[id] = false
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 20)
}
public checkstuck() {
static players[32], pnum, player
get_players(players, pnum)
static Float:origin[3]
static Float:mins[3], hull
static Float:vec[3]
static o,i
for(i=0; i<pnum; i++){
player = players
if (is_user_connected(player) && is_user_alive(player)) {
pev(player, pev_origin, origin)
hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
++stuck[player]
pev(player, pev_mins, mins)
vec[2] = origin[2]
for (o=0; o < sizeof size; ++o) {
vec[0] = origin[0] - mins[0] * size[o][0]
vec[1] = origin[1] - mins[1] * size[o][1]
vec[2] = origin[2] - mins[2] * size[o][2]
if (is_hull_vacant(vec, hull,player)) {
engfunc(EngFunc_SetOrigin, player, vec)
set_pev(player,pev_velocity,{0.0,0.0,0.0})
o = sizeof size
}
}
}
else
{
stuck[player] = 0
}
}
}
}
stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
static tr
engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
return true
return false
} |
|