火狼:下面出自基友孤独
#include <amxmod>
#include <fun>
//模块引用
new gmsgResetHUD//声明变量gmsgresetHUD
public death_msg()//death_msg事件
{
if (get_cvar_num("amx_respawn") == 1) //如果amx_respawn等于1,消息的发出一般amxx.cfg里键入
{
new vIndex = read_data(2)//声明变量vIndex等于被杀者
new svIndex[32] //声明数组svIndex并赋值大小32
num_to_str(vIndex,svIndex,32)//将整型数字vIndex转换为字符串并记入数组svindex,大小为32
set_task(2.0,"respawn",0,svIndex,32)//两秒后执行respawn事件,传递的数组是svIndex,数组长度为32
}
return PLUGIN_CONTINUE//返回,插件继续
}
public respawn(svIndex[])//respawn事件
{
new vIndex = str_to_num(svIndex)//申明变量vIndex并等于转换字符串的svIndex数组值
user_spawn(vIndex)//复活玩家,玩家索引id为vIndex
set_task(0.1,"a1",vIndex)
set_task(3.0,"a31",vIndex)
message_begin(MSG_ONE,gmsgResetHUD,{0,0,0},vIndex)
message_end()
}
public plugin_init()
{
gmsgResetHUD = get_user_msgid("ResetHUD") //变量gmsgResetHUD等于获取的开局事件值
register_plugin("amx_respawn","0.2","f117bomb")//注册插件
register_event("DeathMsg","death_msg","a")//杀人事件执行death_msg
register_cvar("amx_respawn","0")//注册cvar事件。。。 系统默认值为0
return PLUGIN_CONTINUE//插件返回,继续
}
public a1(vIndex)
{
set_user_godmode(vIndex, 1)
set_user_rendering(vIndex, kRenderFxGlowShell, 255, 127, 80, kRenderNormal, 15)
}
public a31(vIndex)
{
set_user_godmode(vIndex, 0)
set_user_rendering(vIndex, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
}