搜索
查看: 2572|回复: 4

[AMXX 带源码] 重生插件源码

[复制链接]
发表于 2010-9-15 23:21:25 | 显示全部楼层 |阅读模式 来自 中国–湖北–鄂州
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

new bool:g_canRespawn[33]
new time_s[33]
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[victim]) {
        time_s[victim] = 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[id] = false
}

public client_disconnect(id)
{
        g_canRespawn[id] = false
}


public check_time(id)
{
       if(get_user_flags(id) & ADMIN_USER && g_canRespawn[id]) {
       time_s[id] = get_pcvar_num(cvar_killdeath)
       read_times(id)
       }
       if(get_user_flags(id) & ADMIN_MENU && g_canRespawn[id]) {
       time_s[id] = 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[id])
       --time_s[id]
       if(time_s[id] >= 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[victim] = 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[victim] = 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[32]
        get_user_name(id, name, 31)
        if(!zp_is_nemesis_round() || !zp_is_plague_round()) {
        server_cmd("zp_zombie %s", name)
        }
        g_canRespawn[id] = false
        return PLUGIN_CONTINUE
}

public client_putinserver(id) {
client_print(0, print_chat, "服务器采用无限重生插件")
}
 楼主| 发表于 2010-9-15 23:23:11 | 显示全部楼层 来自 中国–湖北–鄂州
复活带倒数秒数的
回复

使用道具 举报

发表于 2010-9-18 09:14:34 | 显示全部楼层 来自 中国–内蒙古–巴彦淖尔
无法编译!??

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

 楼主| 发表于 2010-9-18 15:41:01 | 显示全部楼层 来自 中国–湖北–鄂州
..................
我的都能编译啊...
这个是zp用的啊...
回复

使用道具 举报

发表于 2010-9-19 20:08:44 | 显示全部楼层 来自 中国–辽宁
这个我想要 但是编辑不了,你能直接发插件吗 谢谢啊
回复

使用道具 举报

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

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