搜索
查看: 5173|回复: 3

大神们,能否帮我帮我给捡血包插件加个b权限?

[复制链接]
发表于 2016-2-17 08:12:40 | 显示全部楼层 |阅读模式 来自 中国–吉林–长春

大神们,能否帮我帮我给捡血包插件加个b权限?

感激不尽~感激不尽~


#include <amxmod>

//----------------------------------------------------------------------------------------------

public plugin_init()
{
// Plugin Info
register_plugin("AMX Medkit","1.0","duper/Rockell & X-man")
register_cvar("amx_medkit", "1")
register_cvar("amx_medkithealth", "25")
register_event("ResetHUD", "newRound","b")
register_event("DeathMsg","deathevent","a")
}

//----------------------------------------------------------------------------------------------

public newRound()
{
new chocolate = find_ent_by_class(-1, "chocolate")
while(chocolate) {
remove_entity(chocolate)
chocolate = find_ent_by_class(chocolate, "chocolate")
}
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------

public deathevent()
{
if ( !get_cvar_num("amx_medkit") )
return PLUGIN_CONTINUE

new killer = read_data(1)
new victim = read_data(2)
if ( killer != victim )
{
createChocolate(victim)
}
if(is_user_connected(victim))
cs_reset_user_model(victim)
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------

public createChocolate(victim)
{
new Float:vAim[3], Float:vOrigin[3]
entity_get_vector(victim, EV_VEC_origin, vOrigin)
VelocityByAim(victim, random_num(2, 4), vAim)

vOrigin[0] += vAim[0]
vOrigin[1] += vAim[1]
vOrigin[2] += 30.0

new chocolate = create_entity("info_target")
entity_set_string(chocolate, EV_SZ_classname, "chocolate")
entity_set_model(chocolate, "models/w_medkit.mdl")
entity_set_size(chocolate, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})
entity_set_int(chocolate, EV_INT_solid, 2)
entity_set_int(chocolate, EV_INT_movetype, 6)
entity_set_vector(chocolate, EV_VEC_origin, vOrigin)
}

//----------------------------------------------------------------------------------------------

public plugin_precache() {
precache_model("models/w_medkit.mdl")
precache_sound( "weapons/c4_disarm.wav")
}

//----------------------------------------------------------------------------------------------

public pfn_touch(ptr, ptd){
if(!is_valid_ent(ptd) || !is_valid_ent(ptr))
return PLUGIN_CONTINUE

if(!is_user_connected(ptd) || !is_user_alive(ptd))
return PLUGIN_CONTINUE

new classname[32]
entity_get_string(ptr, EV_SZ_classname, classname, 31)
if(equal(classname, "chocolate"))
{
new gOrigHealth = get_user_health(ptd)
new health = gOrigHealth + get_cvar_num("amx_medkithealth")
set_user_health(ptd, health)
emit_sound(ptd,CHAN_VOICE,"weapons/c4_disarm.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
remove_entity(ptr)
}
return PLUGIN_CONTINUE
}

public client_death(killer, victim, wpnindex, hitplace, TK)
{
if(wpnindex == CSW_C4 && is_user_connected(victim))
cs_reset_user_model(victim)
}
 楼主| 发表于 2016-2-17 14:52:31 | 显示全部楼层 来自 中国–吉林–长春
yam 发表于 2016-2-17 08:32
在 pfn_touch函数下面

后面加上

感谢感谢,灰常感谢~~!!{:4_95:}
回复 0 1

使用道具 举报

发表于 2016-2-17 08:32:18 | 显示全部楼层 来自 中国–重庆–重庆
在 pfn_touch函数下面
  1. if(!is_user_connected(ptd) || !is_user_alive(ptd))
  2.         return PLUGIN_CONTINUE
复制代码

后面加上
  1. if(!(get_user_flags(ptd) & ADMIN_RESERVATION))
  2.         return PLUGIN_CONTINUE
复制代码
回复 1 0

使用道具 举报

发表于 2020-4-4 15:40:01 | 显示全部楼层 来自 中国–广东–江门
yam 发表于 2016-2-17 08:32
在 pfn_touch函数下面

后面加上

你代码 复制不了
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表