|
发表于 2008-6-30 12:57:11
|
显示全部楼层
来自 中国–北京–北京–海淀区
回复: 想请教个函数问题...(未解决问题)
- #include <amxmodx>
- #include <amxmisc>
- #define PLUGIN "Test"
- #define AUTHOR "Jim"
- #define VERSION "1.0"
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_clcmd("test", "test")
- }
- public test(id)
- {
- new ret = kick_the_worst()
- console_print(id, "[Test] return : %d", ret)
- return PLUGIN_HANDLED
- }
- public kick_the_worst()
- {
- new theworst
- new worstscore = cellmax
- new score
- new maxplayers = get_maxplayers()
-
- for(new i = 1; i <= maxplayers; ++i)
- {
- if(is_user_connected(i) && !(get_user_flags(i) & ADMIN_RESERVATION))
- {
- score = get_user_frags(i) - get_user_deaths(i)
- if(score < worstscore)
- {
- worstscore = score
- theworst = i
- }
- }
- }
-
- if(theworst)
- server_cmd("kick #%d^"你已被会员挤出,等下再试^"", get_user_userid(theworst))
- return theworst
- }
复制代码
这个放服务器里人多的时候敲命令"test"测试一下,看看效果 |
|