BTG 发表于 2005-10-20 09:36:49

持有C4的玩家不动30秒种 自动扔出C4


/*
*
*        Author:                BlackFlagg based on Cheesy Peteza generic AFK kicker
*        Date:                06-July-2004
*
*
*        Description:        Drop bomb when player is AFK for 30 secs
*
*        Cvars:
*                        mp_afktime 20                Time a player is allowed to be AFK in seconds before they drop bomb
*                                                They time is only accumulated while they are alive.
*                        mp_afkminplayers 1        Minimum number of players required .
*
*
*        Requirements:        AMXModX
*
*
*/

#include <amxmodx>

#define MIN_AFK_TIME 20                // I use this incase stupid admins accidentally set mp_afktime to something silly.
#define CHECK_FREQ 5                // This is also the warning message frequency.

new g_oldangles
new g_afktime
new bool:g_spawned = {true, ...}

public plugin_init() {
        register_plugin("AFK Bomb Drop","1.0","BlackFlagg")
        register_cvar("afk_version", "1.0a", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

        register_cvar("mp_afktime", "20")        // Drop bomb if AFK longer than this time
        register_cvar("mp_afkminplayers", "1")        // at least this many players on the server
        set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b")
        register_event("ResetHUD", "playerSpawned", "be")
}

public checkPlayers() {
        for (new i = 1; i <= get_maxplayers(); i++) {
                if (is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned) {
                        new newangle
                        get_user_origin(i, newangle)

                        if ( newangle == g_oldangles && newangle == g_oldangles && newangle == g_oldangles ) {
                                g_afktime += CHECK_FREQ
                                check_afktime(i)
                        } else {
                                g_oldangles = newangle
                                g_oldangles = newangle
                                g_oldangles = newangle
                                g_afktime = 0
                        }
                }
        }
        return PLUGIN_HANDLED
}

check_afktime(id) {
        new numplayers = get_playersnum()
        new minplayers = get_cvar_num("mp_afkminplayers")
                                       
        if (numplayers >= minplayers) {
                new maxafktime = get_cvar_num("mp_afktime")
                if (maxafktime < MIN_AFK_TIME) {
                        log_amx("cvar mp_afktime %i is too low. Minimum value is %i.", maxafktime, MIN_AFK_TIME)
                        maxafktime = MIN_AFK_TIME
                        set_cvar_num("mp_afktime", MIN_AFK_TIME)
                }

                if (g_afktime > maxafktime) {
                        new name
                        get_user_name(id, name, 31)
                        client_cmd(id,"drop weapon_c4 ")
                }
        }
}

public client_putinserver(id) {
        g_afktime = 0
        return PLUGIN_HANDLED
}

public playerSpawned(id) {
        g_spawned = false
        new sid
        sid = id
        set_task(0.75, "delayedSpawn",_, sid, 1)        // Give the player time to drop to the floor when spawning
        return PLUGIN_HANDLED
}

public delayedSpawn(sid[]) {
        get_user_origin(sid, g_oldangles])
        g_spawned] = true
        return PLUGIN_HANDLED
}

mp_afktime 30 //设订多少秒不动仍出C4
mp_afkminplayers 1 //最少需要几位玩家开启此功能

onlyyour 发表于 2005-10-20 10:29:48

回复: 持有C4的玩家不动30秒种 自动扔出C4

:d: 这个是个好东西 要不会被拿雷包的人急死 具体怎么使用? :mad:

BTG 发表于 2005-10-20 12:26:08

回复: 持有C4的玩家不动30秒种 自动扔出C4

我在AMXX1.0下使用 没问题 希望大家喜欢 ;)

litiankai 发表于 2005-10-21 01:14:32

回复: 持有C4的玩家不动30秒种 自动扔出C4

谢谢楼主,这绝对是好东西!!我顶啦

zgjsjylb 发表于 2005-10-21 10:29:15

回复: 持有C4的玩家不动30秒种 自动扔出C4

我在AMX0。99下编译,66行出现一个 undefined symbol log_amx,这个log_amx什么意思,怎么定义才好呢

stonelei 发表于 2005-10-21 20:34:39

回复: 持有C4的玩家不动30秒种 自动扔出C4

:p

太好了.

wb000 发表于 2005-10-22 01:49:52

回复: 持有C4的玩家不动30秒种 自动扔出C4

这个绝对是贴心的插件,哈哈哈,3Q

Ulu2005 发表于 2005-10-22 19:42:54

回复: 持有C4的玩家不动30秒种 自动扔出C4

Very Good :D

kila华少 发表于 2005-10-22 20:41:02

回复: 持有C4的玩家不动30秒种 自动扔出C4

哈哈...那么好笑!!! :boss:

pj001234 发表于 2005-11-1 13:44:25

回复: 持有C4的玩家不动30秒种 自动扔出C4

没下载地址!~ :cold:
页: [1] 2
查看完整版本: 持有C4的玩家不动30秒种 自动扔出C4