visa567 发表于 2009-8-13 23:28:28

问个关于僵尸F 防护罩的问题

本帖最后由 visa567 于 2009-8-13 23:54 编辑

僵尸F有个防护罩的插件

有效时间在哪里改?

这是源码

#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
#include <fun>
new campoforze
new bool:campodefuerza = false
new stuck
new const Float:size[] = {
{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
   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 = true
            efects(player)
            campofuerza(player)
            set_task(20.0, "timeout", player)
      }
}
public campofuerza(id1)
{
   // Not alive
   if (!is_user_alive(id1))
return;
   if(!campodefuerza)
      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)
      return;
      static Float:vOrigin, Float:vOrigin2
      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 > vOrigin2) vOrigin2 -= 30.0
       if(vOrigin < vOrigin2) vOrigin2 += 30.0
       set_pev(id2, pev_origin, vOrigin2)
      }
}
public efects(id)
{
// Not alive
if (!is_user_alive(id))
return;
      if(!campodefuerza)
      return;

// Get player origin
static Float:originF
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) // x
engfunc(EngFunc_WriteCoord, originF) // y
engfunc(EngFunc_WriteCoord, originF) // 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 = false
}
public client_disconnect(id) {
campodefuerza = false
}
public event_round_start()
{
      new maxplayers = get_maxplayers();
for (new id; id <= maxplayers; id++)
{
campodefuerza = false
}
}
public zp_user_infected_post(player, infector)
{
if (campodefuerza)
{
campodefuerza = false
}
return PLUGIN_CONTINUE
}
public timeout(id)
{
// Not alive
if (!is_user_alive(id))
return;
      if(!campodefuerza)
      return;
      campodefuerza = false
      set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 20)
}
public checkstuck() {
         static players, pnum, player
get_players(players, pnum)
static Float:origin
static Float:mins, hull
static Float:vec
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
             pev(player, pev_mins, mins)
      vec = origin
      for (o=0; o < sizeof size; ++o) {
       vec = origin - mins * size
       vec = origin - mins * size
       vec = origin - mins * size
       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 = 0
    }
   }
}
}
stock bool:is_hull_vacant(const Float:origin, 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
}

TCMBW 发表于 2009-8-14 13:35:00

set_task(20.0, "timeout", player)

dongtianbao 发表于 2009-9-1 01:22:01

僵尸打来打去太无聊了
页: [1]
查看完整版本: 问个关于僵尸F 防护罩的问题