|
发表于 2006-10-13 19:00:45
|
显示全部楼层
来自 中国–云南–昆明
回复: 求个丢拆弹器的插件
dropdefuser.amxx ;警察可以丢掉拆雷钳(需要开启engine和cstrike模块)
[php]/* Drop Defuser Kit 1.0 (for AMX Mod X 0.20 RC5 and above)
*
* by Damaged Soul
*
* This file is provided as is (no warranties)
*
* Description:
* This plugin allows the CT team to drop their defuser kits on the ground.
* Since defuser kits are dropped on death anyways, why not allow a CT to voluntarily
* drop it as well?
*
* Usage:
* Bind "dropdefuser" to any key or just type the command in the console.
*
* For example, by typing: bind v dropdefuser
* in the console, you will have bound the V key to drop the defuser kit
*
* Version History:
* 1.0
* - Initial release
*
*/
#include <amxmodx>
#include <engine>
#include <cstrike>
new bool:canpickup[33]
public plugin_init() {
register_plugin("Drop Defuser Kit", "1.0", "Damaged Soul")
register_clcmd("dropdefuser", "drop_defkit", 0, "- drops defuser kit if you have one")
register_touch("item_thighpack", "player", "defkit_touch")
register_event("ResetHUD", "defkit_cleanup", "b")
}
public plugin_modules() {
require_module("engine")
require_module("cstrike")
}
public drop_defkit(id) {
if (cs_get_user_team(id) == CS_TEAM_CT && cs_get_user_defuse(id)) {
canpickup[id] = false
cs_set_user_defuse(id, 0) // Get rid of player's defuser kit
new defkit = create_entity("info_target") // Create a new entity for the fake defuser kit
if (!defkit)
return PLUGIN_HANDLED_MAIN
new Float:origin[3]
entity_get_vector(id, EV_VEC_origin, origin)
new Float:velocity[3]
new Float:mins[3] = {-2.5, -2.5, -2.5}
new Float:maxs[3] = {2.5, 2.5, 2.5}
entity_set_string(defkit, EV_SZ_classname, "item_thighpack")
entity_set_model(defkit, "models/w_thighpack.mdl")
entity_set_vector(defkit, EV_VEC_mins, mins)
entity_set_vector(defkit, EV_VEC_maxs, maxs)
entity_set_origin(defkit, origin)
entity_set_int(defkit, EV_INT_effects, EF_NOINTERP)
entity_set_int(defkit, EV_INT_solid, SOLID_TRIGGER)
entity_set_int(defkit, EV_INT_movetype, MOVETYPE_TOSS)
entity_set_edict(defkit, EV_ENT_owner, id)
velocity_by_aim(id, 400, velocity)
entity_set_vector(defkit, EV_VEC_velocity, velocity)
new parm[1]
parm[0] = id
set_task(0.1, "safedrop", 3215862+ id, parm[0], 1)
}
return PLUGIN_HANDLED
}
public safedrop(parm[])
{
canpickup[parm[0]] = true
}
public defkit_touch(entid, userid) {
if (canpickup[userid] && cs_get_user_team(userid) == CS_TEAM_CT && !cs_get_user_defuse(userid)) {
remove_entity(entid) // Remove the defuser kit on the ground
cs_set_user_defuse(userid, 1) // Give player the defuser kit
client_print(userid, print_center, "#Got_defuser")
}
return PLUGIN_CONTINUE
}
/* Remove all spawned defuser kit entities on new rounds */
public defkit_cleanup() {
new defkit = find_ent_by_class(-1, "item_thighpack");
while (defkit) {
remove_entity(defkit)
defkit = find_ent_by_class(defkit, "item_thighpack");
}
return PLUGIN_CONTINUE
}[/php] |
|