广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 2979 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
wongyin2010
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x0 鲜花 x3
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[1.6][插件] [求!!!]建造基地模组6.5僵尸问题 hlep!!!!!!  (建造基地模组6.5僵尸问题 hlep!!!!!!)
在建造基地模组6.5如何可以增加僵尸僵尸的HP,速度,跳高度表情
我玩来玩去只有4只僵尸表情,但别人有很多!!!!表情
我的场超闷的说!!!!表情

求大大教我表情



献花 x0 回到顶端 [楼 主] From:未知地址 | Posted:2011-08-08 14:14 |
Mickeymouse.
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x11 鲜花 x16
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

你想do D 咩,你比 雅币我help you do


献花 x0 回到顶端 [1 楼] From:香港城市电讯 | Posted:2011-08-19 12:31 |
qma
数位造型
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x16 鲜花 x43
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

吧 ZP的僵尸种类改过来不就OK了 给你们个示范


/*================================================================================
* Please don't change plugin register information.
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <basebuilder>
#include <xs>
#include <hamsandwich>

#define PLUGIN_NAME      "[ZP] Class: DaSu (2)"
#define PLUGIN_VERSION      "1.0"
#define PLUGIN_AUTHOR      "Jim"

#define SUPPORT_BOT_TO_USE            //支援BOT使用.(在最前面加上 // 即是取消对BOT的技援)

#define TASK_SET_TRAP            1234
#define TASK_REMOVE_TRAP      4321

// Zombie Attributes
new const zclass_name[] = { "陷阱僵尸" }
new const zclass_info[] = { "按R键设置捕捉陷阱" }
new const zclass_model[] = { "zombie_source" }
new const zclass_clawmodel[] = { "v_knife" }
const zclass_health = 4000
const zclass_speed = 250
const Float:zclass_gravity = 1.0


// Models
new const Trap_Model[] = { "models/zombie_plague/zombitrap.mdl"      }      //陷阱的模型

// Sounds
new const TrapTrigger_Sound[] = { "common/bodysplat.wav" }            //陷阱被触发时的声音
new const PlayerCatched_Sound[] = { "scientist/scream4.wav" }            //人类被陷阱捕捉到时发出的声音
new const CantPlantTrap_Sound[] = { "common/wpn_denyselect.wav" }      //无法设置陷阱时的警告声音

// Settings
const Max_Traps = 9999      //玩家每回合可设置陷阱的最大数量

// Weapons Offsets (win32)
const OFFSET_flNextPrimaryAttack = 46
const OFFSET_flNextSecondaryAttack = 47
const OFFSET_flTimeWeaponIdle = 48

// Linux diff's
const OFFSET_LINUX_WEAPONS = 4 // weapon offsets are only 4 steps higher on Linux

// Zombie id
new g_zclass_DaSu

// Vars
new cvar_TrapSetTime, cvar_TrapAffectTime
new g_TrapPromptSpr, g_PlayerCatchedSpr
new g_msgScreenShake, g_msgBarTime
new g_maxplayers
new user_has_traps[33]
new user_traps_ent[33][Max_Traps]
new bool:user_set_trap[33], set_trap_ent[33], Float:set_trap_origin[33][3]
new bool:user_be_catched[33], catched_trap_ent[33]
new Float:user_time[33]

#if defined SUPPORT_BOT_TO_USE
new Float:bot_next_check_time[33]
#endif

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
     

     cvar_TrapSetTime = register_cvar("zp_dasu_trap_settime", "0")            //设置陷阱所需要的时间长度(单位:秒)
     cvar_TrapAffectTime = register_cvar("zp_dasu_trap_affecttime", "5.0")      //陷阱被触发后作用的时间长度(单位:秒)(设定成 0.0 秒则代表不限制)
     
     register_cvar("zp_dasu_trap_cdtime", "10.0")
     register_forward(FM_CmdStart, "fw_CmdStart")
     register_forward(FM_StartFrame, "fw_StartFrame")
     register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
     register_forward(FM_Touch, "fw_Touch")
     register_forward(FM_Think, "fw_Think")
     
     register_event("ResetHUD", "event_NewSpawn", "be")
     register_event("DeathMsg", "event_Death", "a")
     register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
     
     RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawn_Post", 1)
     
     #if defined SUPPORT_BOT_TO_USE
     register_event("Damage", "event_Damage", "be", "2>0")
     #endif
     
     g_msgScreenShake = get_user_msgid("ScreenShake")
     g_msgBarTime = get_user_msgid("BarTime")
     g_maxplayers = get_maxplayers()
}

public plugin_precache()
{
     precache_model(Trap_Model)
     
     precache_sound(TrapTrigger_Sound)
     precache_sound(PlayerCatched_Sound)
     precache_sound(CantPlantTrap_Sound)
     
     g_TrapPromptSpr = precache_model("sprites/zombie_plague/trap_prompt.spr")
     g_PlayerCatchedSpr = precache_model("sprites/zombie_plague/trap!!!.spr")
     
     g_zclass_DaSu = bb_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity)
}

public ham_PlayerSpawn_Post(id)
{
     if (user_be_catched[id])
     {
           clear_user_sprite(id)
           set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
     }
     
     reset_vars(id)
     
     if (bb_get_user_zombie_class(id) == g_zclass_DaSu)
     {
           user_has_traps[id] = Max_Traps
           client_print(id, print_chat, "[陷阱僵尸] 你可以按'R'设置陷阱来捕捉人类.", Max_Traps)
     }
}

public fw_CmdStart(id, uc_handle, seed)
{
     if (!is_user_alive(id))
           return FMRES_IGNORED;
     
     if (!bb_is_user_zombie(id) || bb_get_user_zombie_class(id) != g_zclass_DaSu)
           return FMRES_IGNORED;
     
     #if defined SUPPORT_BOT_TO_USE
     if (is_user_bot(id))
     {
           bot_use_traps(id)
           return FMRES_IGNORED;
     }
     #endif
     
     static button, oldbutton
     button = get_uc(uc_handle, UC_Buttons)
     oldbutton = pev(id, pev_oldbuttons)
     
     if (!user_set_trap[id])
     {
           if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD))
           {
                 do_set_trap(id)
           }
     }
     else
     {
           static user_flags, Float:user_origin[3], Float:fdistance
           user_flags = pev(id, pev_flags)
           pev(id, pev_origin, user_origin)
           user_origin[2] -= (user_flags & FL_DUCKING) ? 18.0 : 36.0
           fdistance = get_distance_f(user_origin, set_trap_origin[id])
           
           if (!(button & IN_RELOAD) || fdistance > 18.0)
           {
                 stop_set_trap(id)
           }
     }
     
     return FMRES_HANDLED;
}

public fw_StartFrame()
{
     static Float:time, Float:next_check_time, id, i, classname[32], Float:origin1[3], Float:origin2[3]
     
     time = get_gametime()
     
     if (time >= next_check_time)
     {
           for (id = 1; id <= g_maxplayers; id++)
           {
                 if (!is_user_connected(id) || !is_user_alive(id))
                       continue;
                 
                 if (!bb_is_user_zombie(id) || bb_get_user_zombie_class(id) != g_zclass_DaSu)
                       continue;
                 
                 for (i = 0; i < Max_Traps; i++)
                 {
                       if (user_traps_ent[id] <= 0)
                             continue;
                       
                       if (!pev_valid(user_traps_ent[id]))
                       {
                             user_traps_ent[id] = 0
                             continue;
                       }
                       
                       pev(user_traps_ent[id], pev_classname, classname, charsmax(classname))
                       if (!equal(classname, "ZOMBIE_TRAP_ENT"))
                       {
                             user_traps_ent[id] = 0
                             continue;
                       }
                       
                       if (pev(user_traps_ent[id], pev_iuser3) == 1) //判断陷阱物件是否已经是在补捉到人类的状态
                             continue;
                       
                       pev(user_traps_ent[id], pev_origin, origin1)
                       xs_vec_copy(origin1, origin2)
                       origin2[2] += 30.0
                       if (fm_is_point_visible(id, origin1, 1) || fm_is_point_visible(id, origin2, 1))
                       {
                             origin1[2] += 30.0
                             create_user_sprite(id, origin1, g_TrapPromptSpr, 15)
                       }
                 }
           }
           
           next_check_time = time + 0.1
     }
     
     return FMRES_IGNORED;
}

public fw_PlayerPreThink(id)
{
     if (!is_user_alive(id))
           return FMRES_IGNORED;
     
     if (bb_is_user_zombie(id))
     {
           if (bb_get_user_zombie_class(id) != g_zclass_DaSu)
                 return FMRES_IGNORED;
           
           if (user_set_trap[id])
           {
                 freeze_user_attack(id)
           }
     }
     else
     {
           if (user_be_catched[id] && pev_valid(catched_trap_ent[id]))
           {
                 static classname[32]
                 pev(catched_trap_ent[id], pev_classname, classname, charsmax(classname))
                 if (!equal(classname, "ZOMBIE_TRAP_ENT"))
                       return FMRES_IGNORED;
                 
                 set_pev(id, pev_velocity, Float:{ 0.0, 0.0, -200.0 })
                 set_pev(id, pev_maxspeed, 1.0)
                 
                 static Float:user_origin[3], Float:ent_origin[3], Float:temp_origin[3]
                 pev(id, pev_origin, user_origin)
                 pev(catched_trap_ent[id], pev_origin, ent_origin)
                 xs_vec_copy(ent_origin, temp_origin)
                 temp_origin[2] += 18.0
                 if (get_distance_f(user_origin, temp_origin) > 18.0)
                 {
                       temp_origin[2] += ((pev(id, pev_flags) & FL_DUCKING) ? 0.0 : 18.0)
                       set_pev(id, pev_origin, temp_origin)
                 }
           }
     }
     
     return FMRES_IGNORED;
}

public fw_Touch(ptr, ptd)
{
     if (!pev_valid(ptr) || !pev_valid(ptd))
           return FMRES_IGNORED;
     
     static classname[32]
     pev(ptr, pev_classname, classname, charsmax(classname))
     if (!equal(classname, "ZOMBIE_TRAP_ENT"))
           return FMRES_IGNORED;
     
     if (!(1 <= ptd <= g_maxplayers) || !is_user_alive(ptd) || bb_is_user_zombie(ptd))
           return FMRES_IGNORED;
     
     if (pev(ptr, pev_iuser2) == 0) //判断陷阱物件是否是在可碰触的状态
           return FMRES_IGNORED;
     
     // 判断陷阱物件是否已经是在补捉到人类的状态,或是碰到陷阱的人类已经是处于被陷阱捉住的状态了,
     // 二者情况如其中一项成立的话,则不设定让陷阱触发作用.
     if (pev(ptr, pev_iuser3) == 0 && !user_be_catched[ptd])
     {
           PlaySound(ptd, TrapTrigger_Sound)
           engfunc(EngFunc_EmitSound, ptd, CHAN_VOICE, PlayerCatched_Sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
           user_screen_shake(ptd, 4, 2, 5)
           show_user_sprite(ptd, g_PlayerCatchedSpr)
           
           static Float:origin[3]
           pev(ptr, pev_origin, origin)
           origin[2] += ((pev(ptd, pev_flags) & FL_DUCKING) ? 18.0 : 36.0)
           set_pev(ptd, pev_origin, origin)
           set_pev(ptd, pev_velocity, Float:{ 0.0, 0.0, 0.0 })
           client_print(ptd, print_center, "你踩到了捕捉陷阱! 已经无法动弹了!")
           
           set_pev(ptr, pev_iuser3, 1)      //设定陷阱物件为已补捉到人类的flag数值
           set_pev(ptr, pev_iuser4, ptd)      //记录陷阱物件补捉到的人类的ID
           user_be_catched[ptd] = true      //设定碰到陷阱的人类为被补捉到的状态
           catched_trap_ent[ptd] = ptr      //记录所碰到陷阱物件的ID
           fm_set_rendering(ptr, kRenderFxNone, 0,0,0, kRenderNormal, 255)
           set_pev(ptr, pev_nextthink, get_gametime() + 0.05) //设定陷阱物件的 next think time
           
           static owner
           owner = pev(ptr, pev_iuser1)
           if (1 <= owner <= g_maxplayers) //判断放置陷阱的玩家是否还存在(如玩家已变成人类或死亡,会把放置的玩家ID记录设回成0)
                 client_print(owner, print_center, "你所设置的陷阱己补捉到人类.")
           
           static Float:trap_affect_time
           trap_affect_time = get_pcvar_float(cvar_TrapAffectTime)
           if (trap_affect_time > 0.0)
           {
                 static args[1]
                 args[0] = ptr
                 set_task(trap_affect_time, "remove_trap", TASK_REMOVE_TRAP, args, 1)
           }
     }
     
     return FMRES_IGNORED;
}

public fw_Think(ent)
{
     if (pev_valid(ent))
     {
           static classname[32]
           pev(ent, pev_classname, classname, charsmax(classname))
           if (equal(classname, "ZOMBIE_TRAP_ENT"))
           {
                 if (pev(ent, pev_sequence) != 1)
                 {
                       set_pev(ent, pev_sequence, 1)
                       set_pev(ent, pev_frame, 0.0)
                 }
                 else
                 {
                       if (pev(ent, pev_frame) > 241.0)
                             set_pev(ent, pev_frame, 20.0)
                       else
                             set_pev(ent, pev_frame, pev(ent, pev_frame) + 1.0)
                 }
                 
                 static catched_player
                 catched_player = pev(ent, pev_iuser4)
                 if (!user_be_catched[catched_player] || catched_trap_ent[catched_player] != ent)
                 {
                       engfunc(EngFunc_RemoveEntity, ent)
                       return FMRES_IGNORED;
                 }
                 
                 set_pev(ent, pev_nextthink, get_gametime() + 0.05) //设定陷阱物件的 next think time
           }
     }
     
     return FMRES_IGNORED;
}

freeze_user_attack(id)
{
     new weapon, weapon_name[32], weapon_ent
     weapon = get_user_weapon(id)
     get_weaponname(weapon, weapon_name, charsmax(weapon_name))
     weapon_ent = fm_find_ent_by_owner(-1, weapon_name, id)
     
     if (get_weapon_next_pri_attack(weapon_ent) <= 0.1)
           set_weapon_next_pri_attack(weapon_ent, 0.5)
     
     if (get_weapon_next_sec_attack(weapon_ent) <= 0.1)
           set_weapon_next_sec_attack(weapon_ent, 0.5)
     
     if (weapon == CSW_XM1014 || weapon == CSW_M3)
     {
           if (get_weapon_idle_time(weapon_ent) <= 0.1)
                 set_weapon_idle_time(weapon_ent, 0.5)
     }
}



do_set_trap(id)
{
    if (!user_set_trap[id])
    {
        if (set_a_trap(id, set_trap_ent[id], set_trap_origin[id]) == 1)
        {
              new Float:gametime = get_gametime()   // 取得现在时间 (单位为秒
              if ( gametime > user_time[id] + get_cvar_float( "zp_dasu_trap_cdtime" ) )   // 计算时间差
              {
                  user_set_trap[id] = true
                 
                  new Float:velocity[3]
                  pev(id, pev_velocity, velocity)
                  velocity[0] = velocity[1] = 0.0
                  set_pev(id, pev_velocity, velocity)
                 
                  new Float:set_trap_time, task_time
                  set_trap_time = get_pcvar_float(cvar_TrapSetTime)
                  task_time = floatround(set_trap_time, floatround_floor) + (floatfract(set_trap_time) >= 0.5 ? 1 : 0)
                  set_task(set_trap_time, "trap_complete", (id + TASK_SET_TRAP))
                  show_user_taskbar(id, task_time)
                 
                  client_print(id, print_center, "你正在设置陷阱.")
                  client_print(id, print_chat, "", user_has_traps[id])
                 
                  return 1;
              }
              else
              {
                  client_print(id, print_center, "冷却时间尚未结束, 还剩 %d 秒....", floatround( user_time[id] + get_cvar_float( "zp_dasu_trap_cdtime" ) - gametime, floatround_ceil ) )
                  return 0;
              }
        }
    }
    return 0;
}

stop_set_trap(id)
{
     if (user_set_trap[id])
     {
           client_print(id, print_center, "")
           
           if (pev_valid(set_trap_ent[id]))
                 engfunc(EngFunc_RemoveEntity, set_trap_ent[id])
           
           user_set_trap[id] = false
           set_trap_ent[id] = 0
           remove_task(id + TASK_SET_TRAP)
           show_user_taskbar(id, 0)
     }
}

set_a_trap(id, &trap_entity, Float:trap_origin[3])
{
     if (user_has_traps[id] <= 0)
     {
           engfunc(EngFunc_EmitSound, id, CHAN_ITEM, CantPlantTrap_Sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
           client_print(id, print_center, "你已经没有陷阱可用来设置了.")
           return 0;
     }
     
     new user_flags = pev(id, pev_flags)
     if (!(user_flags & FL_ONGROUND))
     {
           engfunc(EngFunc_EmitSound, id, CHAN_ITEM, CantPlantTrap_Sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
           client_print(id, print_center, "必须站在地面上才能设置陷阱.")
           return 0;
     }
     
     new Float:origin[3]
     pev(id, pev_origin, origin)
     origin[2] -= (user_flags & FL_DUCKING) ? 18.0 : 36.0
     
     if (get_too_close_traps(origin)) //检查是否所在位置地点,是否有太靠近其它己放置好的陷阱存在
     {
           engfunc(EngFunc_EmitSound, id, CHAN_ITEM, CantPlantTrap_Sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
           client_print(id, print_center, "不可与其它已设置好的陷阱距离太近.")
           return 0;
     }
     
     client_print(id, print_center, "")
     
     new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
     if (!ent) return -1;
     
     // Set trap data
     set_pev(ent, pev_classname, "ZOMBIE_TRAP_ENT")
     set_pev(ent, pev_solid, SOLID_TRIGGER)
     set_pev(ent, pev_movetype, MOVETYPE_FLY)
     set_pev(ent, pev_sequence, 0)
     set_pev(ent, pev_frame, 0.0)
     set_pev(ent, pev_iuser1, id)      //记录设置陷阱的玩家ID
     set_pev(ent, pev_iuser2, 0)      //记录陷阱物件是否是可碰触的状态的flag数值 [1=可碰触,0=不可碰触]
     set_pev(ent, pev_iuser3, 0)      //记录陷阱物件是否已补捉到人类的flag数值 [1=是,0=不是]
     set_pev(ent, pev_iuser4, 0)      //记录陷阱物件补捉到的人类的ID (预设ID为0,代表未捕捉到目标)
     
     // Set trap size
     new Float:mins[3] = { -20.0, -20.0, 0.0 }
     new Float:maxs[3] = { 20.0, 20.0, 30.0 }
     engfunc(EngFunc_SetSize, ent, mins, maxs)
     
     // Set trap model
     engfunc(EngFunc_SetModel, ent, Trap_Model)
     
     // Make trap invisible
     fm_set_rendering(ent, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
     
     // Set trap position
     set_pev(ent, pev_origin, origin)
     
     // Return trap entity id
     trap_entity = ent
     
     // Return trap position
     xs_vec_copy(origin, trap_origin)
     
     return 1;
}

public trap_complete(taskid)
{
    new id = taskid - TASK_SET_TRAP
   
    show_user_taskbar(id, 0)
   
    if (pev_valid(set_trap_ent[id]))
    {
        set_pev(set_trap_ent[id], pev_iuser2, 1) //记录陷阱物件是否是可碰触的状态的flag数值 [1=可碰触,0=不可碰触]
        user_has_traps[id]--
        set_user_traps_data(id, set_trap_ent[id])
         
        client_print(id, print_center, "你已设置完成一个陷阱.")
         
        if (user_has_traps[id] > 0)
              client_print(id, print_chat, "", user_has_traps[id])
        else
              client_print(id, print_chat, "")
         
        user_time[id] = get_gametime()   // 更新用户CD开始时间
    }
   
    #if defined SUPPORT_BOT_TO_USE
    if (is_user_bot(id))
    {
        set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
        bot_next_check_time[id] = get_gametime() + 10.0     //设定BOT经过多少时间才会再检查是否进行设置陷阱(单位:秒)
    }
    #endif
   
    user_set_trap[id] = false
    set_trap_ent[id] = 0
}

public remove_trap(args[1])
{
     new ent = args[0]
     
     if (pev_valid(ent))
     {
           new classname[32]
           pev(ent, pev_classname, classname, charsmax(classname))
           if (!equal(classname, "ZOMBIE_TRAP_ENT"))
                 return;
           
           new catched_player = pev(ent, pev_iuser4)
           if (user_be_catched[catched_player] && catched_trap_ent[catched_player] == ent)
           {
                 clear_user_sprite(catched_player)
                 set_pev(catched_player, pev_flags, (pev(catched_player, pev_flags) & ~FL_FROZEN))
                 user_be_catched[catched_player] = false
                 catched_trap_ent[catched_player] = 0
           }
           
           engfunc(EngFunc_RemoveEntity, ent)
     }
}


public client_connect(id)
{
     reset_vars(id)
}

public client_disconnect(id)
{
     if (user_set_trap[id])
     {
           stop_set_trap(id)
           
           #if defined SUPPORT_BOT_TO_USE
           if (pev(id, pev_flags) & FL_FROZEN)
                 set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
           #endif
     }
     
     if (user_be_catched[id])
     {
           clear_user_sprite(id)
           set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
     }
     
     reset_vars(id)
}

public event_NewSpawn(id)
{
     if (user_set_trap[id])
     {
           stop_set_trap(id)
           
           #if defined SUPPORT_BOT_TO_USE
           if (pev(id, pev_flags) & FL_FROZEN)
                 set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
           #endif
     }
     
     if (user_be_catched[id])
     {
           clear_user_sprite(id)
           set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
     }
     
     reset_vars(id)
}

public event_Death()
{
     new id = read_data(2)
     if (!(1 <= id <= g_maxplayers))
           return;
     
     if (user_set_trap[id])
     {
           stop_set_trap(id)
           
           #if defined SUPPORT_BOT_TO_USE
           if (pev(id, pev_flags) & FL_FROZEN)
                 set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
           #endif
     }
     
     if (user_be_catched[id])
     {
           clear_user_sprite(id)
           set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
     }
     
     reset_traps_owner(id)
     reset_vars(id)
}

public event_RoundStart()
{
     remove_task(TASK_REMOVE_TRAP)
     remove_all_traps()
}

get_too_close_traps(const Float:origin[3])
{
     new bool:find, ent, Float:ent_origin[3]
     find = false
     ent = -1
     while ((ent = fm_find_ent_by_class(ent, "ZOMBIE_TRAP_ENT")))
     {
           if (pev(ent, pev_iuser2) == 1)
           {
                 pev(ent, pev_origin, ent_origin)
                 if (get_distance_f(origin, ent_origin) <= 50.0) //预设每个陷阱彼此间的间隔距离必需大于50.0
                       find = true
           }
     }
     
     if (!find) return 0;
     
     return 1;
}

set_user_traps_data(id, trap_ent)
{
     new bool:find = false
     
     for (new i = 0; i < Max_Traps; i++)
     {
           if (user_traps_ent[id] == 0)
           {
                 user_traps_ent[id] = trap_ent
                 find = true
                 break;
           }
     }
     
     if (!find) return 0;
     
     return 1;
}

reset_traps_owner(id)
{
     new classname[32], owner
     for (new i = 0; i < Max_Traps; i++)
     {
           if (user_traps_ent[id] > 0 && pev_valid(user_traps_ent[id]))
           {
                 pev(user_traps_ent[id], pev_classname, classname, charsmax(classname))
                 owner = pev(user_traps_ent[id], pev_iuser1)
                 
                 if (equal(classname, "ZOMBIE_TRAP_ENT") && owner == id)
                       set_pev(user_traps_ent[id], pev_iuser1, 0)
           }
     }
}

remove_all_traps()
{
     new ent = -1
     while ((ent = fm_find_ent_by_class(ent, "ZOMBIE_TRAP_ENT")))
     {
           engfunc(EngFunc_RemoveEntity, ent)
     }
}

reset_vars(id)
{
    user_has_traps[id] = 0
    user_set_trap[id] = false
    set_trap_ent[id] = 0
    user_be_catched[id] = false
    catched_trap_ent[id] = 0
   
    user_time[id] = 0.0 // 用户CD开始时间归零
   
    for (new i = 0; i < Max_Traps; i++)
        user_traps_ent[id] = 0
}

stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
     new Float:RenderColor[3];
     RenderColor[0] = float(r);
     RenderColor[1] = float(g);
     RenderColor[2] = float(b);
     
     set_pev(entity, pev_renderfx, fx);
     set_pev(entity, pev_rendercolor, RenderColor);
     set_pev(entity, pev_rendermode, render);
     set_pev(entity, pev_renderamt, float(amount));
     
     return 1;
}

stock fm_find_ent_by_class(index, const classname[])
{
     return engfunc(EngFunc_FindEntityByString, index, "classname", classname)
}

stock PlaySound(id, const sound[])
{
     if (equal(sound[strlen(sound)-4], ".mp3"))
           client_cmd(id, "mp3 play ^"sound/%s^"", sound)
     else
           client_cmd(id, "spk ^"%s^"", sound)
}

stock user_screen_shake(id, amplitude = 4, duration = 2, frequency = 10)
{
     message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, _, id)
     write_short((1<<12)*amplitude) // 振幅
     write_short((1<<12)*duration) // 时间
     write_short((1<<12)*frequency) // 频率
     message_end()
}

stock show_user_taskbar(id, time)
{
     message_begin(MSG_ONE_UNRELIABLE, g_msgBarTime, _, id)
     write_short(time) // time (second) [0=clear]
     message_end()
}

stock show_user_sprite(id, const sprite_index)
{
     message_begin(MSG_ALL, SVC_TEMPENTITY)
     write_byte(TE_PLAYERATTACHMENT) // TE_PLAYERATTACHMENT (124)
     write_byte(id) // player id
     write_coord(45) // vertical offset (attachment origin.z = player origin.z + vertical offset)
     write_short(sprite_index) // sprite entity index
     write_short(32767) // life (scale in 0.1's)
     message_end()
}

stock clear_user_sprite(id)
{
     message_begin(MSG_ALL, SVC_TEMPENTITY)
     write_byte(TE_KILLPLAYERATTACHMENTS) // TE_KILLPLAYERATTACHMENTS (125)
     write_byte(id) // player id
     message_end()
}

stock bool:fm_is_point_visible(index, const Float:point[3], ignoremonsters = 1)
{
     new Float:start[3], Float:dest[3];
     pev(index, pev_origin, start);
     pev(index, pev_view_ofs, dest);
     xs_vec_add(start, dest, start);
     
     engfunc(EngFunc_TraceLine, start, point, ignoremonsters, index, 0);
     
     new Float:fraction;
     get_tr2(0, TR_flFraction, fraction);
     if (fraction == 1.0)
           return true;
     
     get_tr2(0, TR_vecEndPos, dest);
     if ((dest[0] == point[0]) && (dest[1] == point[1]) && (dest[2] == point[2]))
           return true;
     
     return false;
}

stock create_user_sprite(id, const Float:originF[3], sprite_index, scale)
{
     // 在设定座标点产生一个 Sprite 物件
     message_begin(MSG_ONE, SVC_TEMPENTITY, _, id)
     write_byte(TE_SPRITE) // TE id (Additive sprite, plays 1 cycle)
     engfunc(EngFunc_WriteCoord, originF[0]) // x
     engfunc(EngFunc_WriteCoord, originF[1]) // y
     engfunc(EngFunc_WriteCoord, originF[2]) // z
     write_short(sprite_index) // sprite index
     write_byte(scale) // scale in 0.1's
     write_byte(200) // brightness
     message_end()
}

stock fm_find_ent_by_owner(entity, const classname[], owner)
{
     while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && (pev(entity, pev_owner) != owner)) {}
     
     return entity;
}

stock Float:get_weapon_next_pri_attack(entity)
{
     return get_pdata_float(entity, OFFSET_flNextPrimaryAttack, OFFSET_LINUX_WEAPONS)
}

stock set_weapon_next_pri_attack(entity, Float:time)
{
     set_pdata_float(entity, OFFSET_flNextPrimaryAttack, time, OFFSET_LINUX_WEAPONS)
}

stock Float:get_weapon_next_sec_attack(entity)
{
     return get_pdata_float(entity, OFFSET_flNextSecondaryAttack, OFFSET_LINUX_WEAPONS)
}

stock set_weapon_next_sec_attack(entity, Float:time)
{
     set_pdata_float(entity, OFFSET_flNextSecondaryAttack, time, OFFSET_LINUX_WEAPONS)
}

stock Float:get_weapon_idle_time(entity)
{
     return get_pdata_float(entity, OFFSET_flTimeWeaponIdle, OFFSET_LINUX_WEAPONS)
}

stock set_weapon_idle_time(entity, Float:time)
{
     set_pdata_float(entity, OFFSET_flTimeWeaponIdle, time, OFFSET_LINUX_WEAPONS)
}

#if defined SUPPORT_BOT_TO_USE
public bot_use_traps(id)
{
     //if (!is_user_alive(id))
     //      return;
     
     //if (!bb_is_user_zombie(id) || bb_get_user_zombie_class(id) != g_zclass_BrutalDaSu)
     //      return;
     
     static target, hitzone, distance
     target = get_valid_aim_target(id, hitzone, distance)
     
     if (!user_set_trap[id])
     {
           static Float:time
           time = get_gametime()
           
           // 设定当BOT若正瞄准某个有效目标,且目标在有效距离内,则检查是否进行设置陷阱
           if (target > 0 && (500 <= distance <= 1000) && time >= bot_next_check_time[id])
           {
                 if (random_num(1, 100) > 85) //设定BOT有15%机率会进行设置陷阱
                 {
                       if (do_set_trap(id)) //检查设置陷阱物件是否是成功完成
                             set_pev(id, pev_flags, (pev(id, pev_flags) | FL_FROZEN))
                 }
                 
                 bot_next_check_time[id] = time + 1.0      //设定BOT每隔多少时间检查一次是否进行设置陷阱(单位:秒)
           }
     }
     else
     {
           static Float:user_origin[3], Float:fdistance
           pev(id, pev_origin, user_origin)
           user_origin[2] = set_trap_origin[id][2]
           fdistance = get_distance_f(user_origin, set_trap_origin[id])
           
           // 设定当BOT若正瞄准某个有效目标,且目标在距离200的范围内时,或是本身超出了设置陷阱的有效范围,
           // 则让BOT中断设置陷阱
           if ((target > 0 && distance <= 200) || fdistance > 18.0)
           {
                 stop_set_trap(id)
                 set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
           }
     }
}

public event_Damage(id)
{
     new attacker, weapon, hitzone
     attacker = get_user_attacker(id, weapon, hitzone)
     
     if (!(1 <= attacker <= g_maxplayers) || !is_user_connected(attacker) || !is_user_alive(attacker)
     || attacker == id)
           return;
     
     new damage = read_data(2)
     
     if (is_user_bot(id) && damage > 0)
     {
           new Float:origin1[3], Float:origin2[3], distance
           pev(id, pev_origin, origin1)
           pev(attacker, pev_origin, origin2)
           distance = floatround(get_distance_f(origin1, origin2))
           
           if (distance < 500 || damage > 100)
           {
                 if (user_set_trap[id])
                 {
                       stop_set_trap(id)
                       set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN))
                 }
           }
     }
}

get_valid_aim_target(id, &hitzone, &distance)
{
     new target, aim_hitzone
     get_user_aiming(id, target, aim_hitzone)
     if (!(1 <= target <= g_maxplayers) || !is_user_alive(target) || bb_is_user_zombie(target))
           return 0;
     
     hitzone = aim_hitzone
     new Float:origin1[3], Float:origin2[3]
     pev(id, pev_origin, origin1)
     pev(target, pev_origin, origin2)
     distance = floatround(get_distance_f(origin1, origin2), floatround_round)
     
     return target;
}
#endif


献花 x0 回到顶端 [2 楼] From:上海 | Posted:2011-08-19 17:11 |
黑猫警长
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x0 鲜花 x2
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

真厉害 应该和LX一样的 用ZP的就可以了


献花 x0 回到顶端 [3 楼] From:没有资料 | Posted:2011-08-19 20:54 |
wongyin2010
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x0 鲜花 x3
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

要转Amxx ?建造基地模组6.5的SAM好象转不到〈就连没有改过的建造基地模组6.5的SAM都转不到


献花 x0 回到顶端 [4 楼] From:IANA | Posted:2011-08-20 22:28 |
0952854789
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x1 鲜花 x0
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

大大别贴这个吧= =


献花 x0 回到顶端 [5 楼] From:台湾中华电信股份有限公司 | Posted:2011-08-21 16:41 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.036840 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言