引用 | 編輯
Mickeymouse.
2011-08-19 14:54 |
樓主
▼ |
||
x0
如題,請大大教我x0
|
引用 | 編輯
文♂
2011-10-23 13:25 |
4樓
▲ |
複製程式
public NeedRecovery(id) { if (!is_user_alive(id) || !zp_get_user_zombie(id)) return PLUGIN_CONTINUE; if (cumulative[id] >= 1) return PLUGIN_CONTINUE; new max_health max_health = zp_get_zombie_health(id) if (get_user_health(id) < max_health) { cumulative[id] += 1 new param[2] param[0] = id if (cumulative[id] == 1) { param[1] = 0 set_task(get_pcvar_float(g_Time), "RecoveryRate", id, param, 2, "b") } else { param[1] = 1 set_task(get_pcvar_float(g_Time), "RecoveryRate", Task_ID, param, 2) } } return PLUGIN_CONTINUE; } public RecoveryRate(param[2]) { new id = param[0] new deduct_times = param[1] if (!is_user_alive(id) || !zp_get_user_zombie(id)) return PLUGIN_CONTINUE; new health = get_user_health(id) new max_health max_health = zp_get_zombie_health(id) new need_health = max_health - health if (need_health <= get_pcvar_num(g_Amount)) { engfunc(EngFunc_EmitSound, id, CHAN_VOICE, "mychat/memberid_604597/post_in_mychat.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) set_user_health(id, max_health) remove_task(id) remove_task(Task_ID) cumulative[id] = 0 } else { set_user_health(id, health + get_pcvar_num(g_Amount)) if (deduct_times == 1) cumulative[id] = max(cumulative[id] - 1, 0) } return PLUGIN_CONTINUE; } public client_PreThink(id) { if (!is_user_alive(id) || !zp_get_user_zombie(id)) return PLUGIN_CONTINUE; if (get_gametime() - get_attack_time[id] < 0.5) { if (task_exists(id)) remove_task(id) if (task_exists(Task_ID)) remove_task(Task_ID) cumulative[id] = 0 return PLUGIN_CONTINUE; } new speed = fm_get_speed(id) if (speed > floatround(240 * 0.1)) { if (task_exists(id)) remove_task(id) if (task_exists(Task_ID)) remove_task(Task_ID) cumulative[id] = 0 return PLUGIN_CONTINUE; } if (!task_exists(id)) cumulative[id] = 0 new health = get_user_health(id); if (health >= 1) { new max_health max_health = zp_get_zombie_health(id) if (health < max_health && cumulative[id] == 0) NeedRecovery(id) } return PLUGIN_CONTINUE; } 我的方法就是這了 話說 可是樓主不是會寫插件的嗎? x0 |