小白 发表于 2008-11-2 21:00:54

急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

服务器人满自动kick不动的玩家!
人满自动kick旁观玩家!
T拿C4的长时间不动自动丢出C4!(新增加)
当服务器人不满的情况下,会自动把玩家转移到旁观!!
插件里面有注释中文!
可以参照中文修改!
可以旁观的管理员权限!

源码如下,但发现在1.76b或1.76c下编译完,加载后不起作用.并且加载后.OP通道不能使用,进入时提示"Sorry, HLTV isn't allowed on the full server等"提示. 能不能修改成人不满时也起作用? 且不影响OP通道使用?/* AMX Mod X
*   Full Server Idler Kicker (+last AFK to Spec)
*
* (c) Copyright 2006 by VEN
*
* This file is provided as is (no warranties)
*
*   DESCRIPTION
*       The concept of this plugin is "don't clean the full server from idlers unless
*       new connection try". By idlers i mean HLTV/unassigned/spectator/AFK users.
*       I created this plugin because i don't like the goal of all other plugins that
*       deal with idelrs using the conditions which is strictly based on the idle time.
*       This plugin isn't using the idle time as primary condition. So how it work?
*       Let's say the new user is trying to connect to the full server. Normally he
*       would be kicked unless he have a slot reservation access, but this plugin
*       able to clean the slot for this user if it will find the idler on the server.
*       Firstly it will try to find and kick HLTV (this can be disabled). Secondly -
*       the most idle unassigned/spectator user. Though the plugin will never kick
*       a client with immunity access (this can be configured) or the user who is just
*       connected and still unassigned - it will "immune" him for a few seconds
*       (this can be configured). And lastly the plugin will try to find and kick
*       the most idle alive AFK player (min. idle time that required to mark a player
*       as AFK can be configured). Also as a bonus feature the plugin able to detect
*       when all alive players in the same team are AFK. Usually it would be just
*       a single AFK player who is the only one alive player in a team. In this case
*       to avoid waiting/seaching AFK player(s) by other player(s) the plugin will move
*       him/them to the spectators. Later such AFK users can be kicked from Spectators
*       following the steeps that listed above. Requirement for full server kicker are
*       at least one free reserverved slot (controlled by amx_reservation AMXX's CVAR).
*/

#include <amxmodx>

#define PLUGIN_NAME "Full Server Idler Kicker"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"

// OPTIONS BELOW

// 定义那些权限的人可以旁观
#define IMMUNE_SPEC_ACCESS ADMIN_VOTE

// connected user's unassigned kick immunity time
#define IMMUNE_TIME_AFTER_CONNECT 5
#define MIN_AFK_TIME 20                // I use this incase stupid admins accidentally set mp_afktime to something silly.
#define CHECK_FREQ 5

//不动的时间检测的间隔
#define AFK_CHECK_INTERVAL 8

// 最大允许不动时间(秒)
#define MAX_ALLOWED_AFK_TIME 60

// 是否开启对HLTV的检测
#define HLTV_KICK

#if defined HLTV_KICK
        new const g_hltv_kick_reason[] = "Sorry, HLTV isn't allowed on the full server"
#endif

// 被kick人显示的信息
new const g_spec_kick_reason[] = "不好意思,服务器已满,不可以有旁观的!"
new const g_afk_kick_reason[]= "你已经被kick,因为你在服务器人满的时候不动的时间超过所限制的时间!"

// 把玩家转换到旁观,显示信息
new const g_afktospec_reason[] = "\y你已经被转移^n 到旁观!"

// 显示的信息! 可以自己定义!
new const g_spec_kick_chat[] = " %s 已经被kick,因为他在服务器人满的时候旁观!"
new const g_afk_kick_chat[]= " %s 已经被kick,因为他在服务器人满的时候不动,超过服务器所限制的确时间!"
new const g_afktospec_chat[] = " %s 已经被转换到了旁观,因为他在服务器人满的时候不动,超过服务器所限制的确时间!"

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

new const g_teamname[] = {"TERRORIST", "CT"}

#define MAX_PLAYERS 32
new bool:g_connected
new g_origin
new g_afktime
new g_specgametime

new g_maxplayers
new g_pcvar_reservation

public plugin_init() {
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

        register_event("TeamInfo", "event_spectate", "a", "2=UNASSIGNED", "2=SPECTATOR")
        register_event("TeamInfo", "event_playteam", "a", "2=TERRORIST", "2=CT")
        register_cvar("mp_afktime", "10")        // 多长时间不动丢出C4.
        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")

        g_maxplayers = get_maxplayers()
        g_pcvar_reservation = get_cvar_pointer("amx_reservation")

        set_task(float(AFK_CHECK_INTERVAL), "task_afk_check", _, _, _, "b")
}

public client_connect(id) {
        g_connected = true

        if (get_playersnum(1) <= g_maxplayers - get_pcvar_num(g_pcvar_reservation))
                return

#if defined HLTV_KICK
        if (is_user_hltv(id)) {
                client_kick(id, g_hltv_kick_reason)
                return
        }
#endif

        static players, num, i, tchar
        new candidate, candidatetime
        get_players(players, num, "b")
        for (new x; x < num; ++x) {
                i = players

#if defined IMMUNE_SPEC_ACCESS
                if (get_user_flags(i) & IMMUNE_SPEC_ACCESS)
                        continue
#endif

                if (is_user_hltv(i)) {
#if defined HLTV_KICK
                        client_kick(i, g_hltv_kick_reason)
                        return
#else
                        continue
#endif
                }

                get_user_team(i, tchar, 1)
                if (((tchar == 'U' && get_user_time(i, 1) > IMMUNE_TIME_AFTER_CONNECT) || tchar == 'S') && (!candidatetime || g_specgametime < candidatetime)) {
                        candidatetime = g_specgametime
                        candidate = i
                }
        }

        if (candidate) {
                chat_msg(candidate, g_spec_kick_chat)
                client_kick(candidate, g_spec_kick_reason)
                return
        }

        static origin, afktime
        get_players(players, num, "a")
        for (new x; x < num; ++x) {
                i = players
                get_user_origin(i, origin)
                if (!is_user_afk(i, origin)) {
                        g_afktime = 0
                        g_origin = origin
                        continue
                }

                afktime = g_afktime
                if (afktime >= MAX_ALLOWED_AFK_TIME && afktime > candidatetime) {
                        candidatetime = afktime
                        candidate = i
                }
        }

        if (candidate) {
                chat_msg(candidate, g_afk_kick_chat)
                client_kick(candidate, g_afk_kick_reason)
        }
}
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) {
                        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
}
public task_afk_check() {
        static players, num, i, bool:allafk, origin
        for (new a; a < 2; ++a) {
                get_players(players, num, "ae", g_teamname)
                allafk = true
                for (new x; x < num; ++x) {
                        i = players
                        get_user_origin(i, origin)
                        if (is_user_afk(i, origin)) {
                                g_afktime += AFK_CHECK_INTERVAL
                                if (g_afktime < MAX_ALLOWED_AFK_TIME)
                                        allafk = false
                        }
                        else {
                                g_afktime = 0
                                g_origin = origin
                                allafk = false
                        }
                }

                if (!allafk)
                        continue

                for (new x; x < num; ++x) {
                        i = players
                        chat_msg(i, g_afktospec_chat)
                        user_to_spec(i, g_afktospec_reason)
                }
        }
}

public event_spectate() {
        new id = read_data(1)
        if (g_connected && !g_specgametime)
                g_specgametime = floatround(get_gametime())
}

public event_playteam() {
        new id = read_data(1)
        if (g_connected)
                clear_vars(id)
}

public client_disconnect(id) {
        g_connected = false
        clear_vars(id)
}

clear_vars(id) {
        g_origin = 0
        g_origin = 0
        g_origin = 0
        g_afktime = 0
        g_specgametime = 0
}

bool:is_user_afk(id, const origin) {
        return (origin == g_origin && origin == g_origin)
}

chat_msg(id, const text[]) {
        static name
        get_user_name(id, name, 31)
        client_print(0, print_chat, text, name)
}

stock client_kick(id, const reason[] = "") {
        server_cmd("kick #%d ^"%s^"", get_user_userid(id), reason)
        server_exec()
}

stock user_to_spec(id, const reason[] = "") {
        user_kill(id, 1)
        engclient_cmd(id, "jointeam", "6")
        show_menu(id, 1023, reason)
}



谁能帮一下忙.谢谢!

小白 发表于 2008-11-4 18:38:13

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

:confused:

Rulzy 发表于 2008-11-5 02:08:07

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

Sorry, HLTV isn't allowed on the full server 的原因是服务器的破解问题。部分服务器的破解会把所有盗版玩家的AUTHID认为是HLTV,从而出现这个问题。你可以把对HLTV的检测去掉,也可以找其它的破解版本。去掉HLTV检测的方法是把 #define HLTV_KICK 这一行注释掉,重新编译插件。

小白 发表于 2008-11-6 13:51:32

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

Post by Rulzy
Sorry, HLTV isn't allowed on the full server 的原因是服务器的破解问题。部分服务器的破解会把所有盗版玩家的AUTHID认为是HLTV,从而出现这个问题。你可以把对HLTV的检测去掉,也可以找其它的破解版本。去掉HLTV检测的方法是把 #define HLTV_KICK 这一行注释掉,重新编译插件。

按你说的做了,不再提示HLTV这行,但是插件没有明显效果啊? 在1.76b下.也不自动踢除不动玩家,20秒后也不会扔掉C4...都测试过了.无效啊..急需这个插件啊:sweat:

hezhijun22 发表于 2008-11-6 15:00:07

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动



试试这个吧!

hezhijun22 发表于 2008-11-6 15:05:05

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

无需任何参数~~~直接加载。好像不能T人但是能扔出c4~o(∩_∩)o...哈哈

小白 发表于 2008-11-6 23:46:24

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

Post by hezhijun22
http://www.dt-club.net/forum/attachment.php?aid=17936

试试这个吧!

这个和我发的一样样的嘛!不起作用....不能自动踢除不动者为观众,不能在人满的时候规定时间踢除不动者. 也没有相应提示:cold:

lxhshigege1234 发表于 2008-11-7 08:59:04

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

這個好象以前有人發過了

小白 发表于 2008-11-7 11:14:46

回复: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动

:cold:    找不到能用的啊
页: [1]
查看完整版本: 急需此插件,谁能帮一下,谢谢!服务器人满自动踢不动