重生插件源码
#include <amxmodx>#include <hamsandwich>
#include <zombieplague>
new bool:g_canRespawn
new time_s
new cvar_chongsheng,cvar_killdeath,cvar_vipdeath
public plugin_init()
{
register_plugin("[重生]", "6.0", "123")
register_event("DeathMsg", "Event_DeathMsg", "a")
register_event("DeathMsg", "Death", "a")
cvar_chongsheng = register_cvar("zp_chongsheng", "15")
cvar_killdeath = register_cvar("zp_killdeath", "10")
cvar_vipdeath = register_cvar("zp_vipdeath","5")
}
public Death()
{
new victim = read_data(2)
if(!g_canRespawn) {
time_s = get_pcvar_num(cvar_chongsheng)
set_task(0.0+get_pcvar_num(cvar_chongsheng),"respawn_player",victim)
read_times(victim)
}
}
public client_connect(id)
{
g_canRespawn = false
}
public client_disconnect(id)
{
g_canRespawn = false
}
public check_time(id)
{
if(get_user_flags(id) & ADMIN_USER && g_canRespawn) {
time_s = get_pcvar_num(cvar_killdeath)
read_times(id)
}
if(get_user_flags(id) & ADMIN_MENU && g_canRespawn) {
time_s = get_pcvar_num(cvar_vipdeath)
read_times(id)
}
}
public read_times(id) {
if(!is_user_alive(id)) {
client_print(id, print_center,"你将在 %i 秒后复活",time_s)
--time_s
if(time_s >= 1) {
set_task(1.0,"read_times",id)
} }
}
public Event_DeathMsg()
{
new attacker = read_data(1)
new victim = read_data(2)
if(!is_user_connected(attacker) || !is_user_connected(victim)) {
return PLUGIN_CONTINUE
}
if(attacker != victim)
{
if(get_user_flags(victim) & ADMIN_USER) {
set_task(get_pcvar_num(cvar_killdeath) + 0.0,"respawn_player",victim)
g_canRespawn = true
check_time(victim)
}
if(get_user_flags(victim) & ADMIN_MENU) {
set_task(get_pcvar_num(cvar_vipdeath) + 0.0,"respawn_player",victim)
g_canRespawn = true
check_time(victim)
}
}
return PLUGIN_CONTINUE
}
public respawn_player(id)
{
if(is_user_alive(id))
return PLUGIN_CONTINUE
ExecuteHamB(Ham_CS_RoundRespawn, id)
new name
get_user_name(id, name, 31)
if(!zp_is_nemesis_round() || !zp_is_plague_round()) {
server_cmd("zp_zombie %s", name)
}
g_canRespawn = false
return PLUGIN_CONTINUE
}
public client_putinserver(id) {
client_print(0, print_chat, "服务器采用无限重生插件")
} 复活带倒数秒数的 无法编译!?? ..................
我的都能编译啊...
这个是zp用的啊... 这个我想要 但是编辑不了,你能直接发插件吗 谢谢啊
页:
[1]