引用 | 編輯
zdt
2011-01-14 12:18 |
樓主
▼ |
||||||||||||
x0
我有僵尸的sma,谁可以教我在sma档里的技能里加入冷却这东西......我搞的僵尸都没冷却的.....我试过很多次但都失败了!我搞了这么久,失败她的母还没出现......无语中
x0
|
引用 | 編輯
z1022001
2011-01-16 01:37 |
2樓
▲ ▼ |
也可以用 get_gametime 比較簡單
get_gametime 和 set_task 的時間不太一樣 不過沒超過30秒應該是看不出誤差的... 複製程式 static Float:gametime = get_gametime() // 取得現在時間 (單位為秒 if ( gametime > user_time[id] + cdtime ) // 計算時間差 user_time[id] = gametime // 更新用戶CD開始時間 else // CD中... x0 |
引用 | 編輯
zdt
2011-01-16 13:00 |
4樓
▲ ▼ |
下面是引用 z1022001 於 2011-01-16 01:37 發表的 : 详细点~~~ x0 |
引用 | 編輯
z1022001
2011-01-16 18:36 |
7樓
▲ ▼ |
複製程式
static Float:gametime = get_gametime() // 取得現在時間 (單位為秒 if ( gametime > user_time[id] + cdtime ) // 計算時間差 , 用戶CD開始時間+CD秒數 (得到結束時間) 是否小於現在時間 { user_time[id] = gametime // 更新用戶CD開始時間 //允許使用技能 } else { // CD中... // 不允許使用技能 } 複製程式 set_task(15.0,"MyFunction", id) public MyFunction( id ) { client_print( id, print_center, "ID : %d",id ) } MyFunction 則會在螢幕中央顯示自身的 ID http://www.amxmodx.org/doc/index.html?page=source%2Ffunctions%2Fcore%2Fset_task.htm x0 |
引用 | 編輯
z1022001
2011-01-16 19:44 |
14樓
▲ ▼ |
set_task要配合多個函數作用才行
如果要用get_gametime 那就在376行的 do_set_trap(id) 那邊修改 別忘了在檔案前面做user_time[33]的宣告 x0 |
引用 | 編輯
a7811311622
2011-01-16 19:52 |
15樓
▲ ▼ |
下面是引用 z1022001 於 2011-01-16 01:37 發表的 : 話說「gametime > user_time[id] + cdtime」中是該寫成「>」還是「>=」…? x0 |
引用 | 編輯
zdt
2011-01-18 15:38 |
19樓
▲ ▼ |
||||||||||
你可以顺便帮我看看这个么??我把sk@.@大的精准射击想和致命攻击道具合拼变成一个东西。转换AMXX时成功的,但是进游戏玩,怎么按都没反应。。帮忙看看怎么回事..
x0 |
引用 | 編輯
z1022001
2011-01-18 19:21 |
20樓
▲ ▼ |
這兩個應該不用我教要放在哪裡吧...
複製程式 new Float:user_time[33] register_cvar("zp_dasu_trap_cdtime", "10.0") 下面三個函數, 是從源碼裡複製出來修改過的, 找到對應的覆蓋下去就可以了 複製程式 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, "[憎恶屠夫] 你還有%d個鬼手陷阱可以設置.", user_has_traps[id]) return 1; } else { client_print(id, print_center, "CD時間尚未結束, 還剩 %d 秒....", floatround( user_time[id] + get_cvar_float( "zp_dasu_trap_cdtime" ) - gametime, floatround_ceil ) ) return 0; } } } return 0; } 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][i] = 0 } 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, "[憎惡屠夫] 你還有%d個鬼手陷阱可以設置.", 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 } 至於精準和致命是什麼樣的東西我不是很清楚 說明一下吧 x0 |
引用 | 編輯
zdt
2011-01-22 10:51 |
21樓
▲ ▼ |
||||||||||||||||||||
下面是引用 z1022001 於 2011-01-18 19:21 發表的 : 精准,就是在使用时间内,打哪里都算打头。(但肯定要打中人啦) 致命攻击.......说白了就是攻击力X3,我要是在使用时间里打哪里都算爆头不止,还要3倍攻击... 精准的源码我放上来了,帮帮我吧~~我会给钱你的 如果不够的话我可以把致命攻击放上来给你参考一下
x0 |
引用 | 編輯
zdt
2011-01-22 10:56 |
22樓
▲ ▼ |
register_cvar("zp_dasu_trap_cdtime", "10.0")
就这样可以了吗? 我见其他的都是: cvar_TrapSetTime = register_cvar("zp_dasu_trap_settime", "0.01") 的。 就这样可以了么... x0 |
引用 | 編輯
z1022001
2011-01-22 19:35 |
24樓
▲ ▼ |
下面是引用 zdt 於 2011-01-22 10:56 發表的 : 因為我是用 get_cvar_float 所以不需要在註冊CVAR的時候取CVAR的pointer (get_pcvar_float 的時候用的參數 另外出錯的部份 我已經更新過了,重新改一下吧... 另外那兩個插件的合併 zp_precision_shooting裏的 複製程式 RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack") 複製程式 public fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type) { if (precshoot_on[attacker]) { if (get_tr2(tracehandle, TR_iHitgroup) != HIT_HEAD) set_tr2(tracehandle, TR_iHitgroup, HIT_HEAD) } } 然後在 public _Debug(id) 裏面 新增 複製程式 RegisterHamFromEntity(Ham_TraceAttack, "player", "fw_TraceAttack") 這項攻擊效果應該就出來了... x0 |
引用 | 編輯
z1022001
2011-01-23 17:27 |
28樓
▲ ▼ |
20樓的code是陷阱重新改一次的debug版
24樓的東西放到zp_extra_more_damage裡面 然後去研究zp_extra_more_damage按了F5之後會做哪些條件的改變 好讓打身體也爆頭把那個條件加進fw_TraceAttack的code裏面就OK了 x1 |