搜索
查看: 1812|回复: 1

再谈预留通道问题

[复制链接]
发表于 2006-11-9 22:04:28 | 显示全部楼层 |阅读模式 来自 中国–辽宁–丹东
代码如下,是经过修正的,在AMXX 1.7下编译完之后放到windows平台上有效,拿到Linux下就不好用了,请达人指点。:burn:


  1. #include <amxmodx>
  2. #include <amxmisc>
  3. new g_cmdLoopback[16]
  4. public plugin_init() {
  5.   register_plugin("Slots Reservation",AMXX_VERSION_STR,"AMXX Dev Team")
  6.   register_dictionary("adminslots.txt")
  7.   register_dictionary("common.txt")
  8.   register_cvar("amx_reservation","0")
  9.   /* Provide server admin with cvar to hide slots, 0 or 1 */
  10.   register_cvar("amx_hideslots", "0")
  11.   format( g_cmdLoopback, 15, "amxres%c%c%c%c" ,
  12.     random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z')  )
  13.   register_clcmd( g_cmdLoopback, "ackSignal" )
  14. }
  15. public plugin_cfg() {
  16.   if ( get_cvar_num("amx_hideslots") == 1 ) {
  17.     new maxplayers = get_maxplayers()
  18.     new players = get_playersnum(1)
  19.     new limit = maxplayers - get_cvar_num("amx_reservation")
  20.     setVisibleSlots(players, maxplayers, limit)
  21.   }
  22. }
  23. public ackSignal(id) {
  24.   new lReason[64]
  25.   format(lReason,63,"%L",id,"DROPPED_RES")
  26.   server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason )
  27. }
  28. public client_authorized(id) {
  29.   new maxplayers = get_maxplayers()
  30.   new players = get_playersnum( 1 )
  31.   new limit = maxplayers - get_cvar_num("amx_reservation")
  32.   if ( access(id,ADMIN_RESERVATION) || (players <= limit) )
  33.   {
  34.     if ( get_cvar_num("amx_hideslots") == 1 )
  35.       setVisibleSlots( players , maxplayers, limit )
  36.     return PLUGIN_CONTINUE
  37.   }
  38.   client_cmd(id,g_cmdLoopback)
  39.   return PLUGIN_HANDLED
  40. }
  41. public client_disconnect(id)
  42. {
  43.   if ( get_cvar_num("amx_hideslots") == 1 ) {
  44.     new maxplayers = get_maxplayers()
  45.     setVisibleSlots( get_playersnum(1) - 1 , maxplayers , maxplayers - get_cvar_num("amx_reservation")  )
  46.   }
  47.   return PLUGIN_CONTINUE
  48. }
  49. setVisibleSlots( players , maxplayers , limit )
  50. {
  51.   new num = players + 1
  52.   if ( players == maxplayers )
  53.     num = maxplayers
  54.   else if ( players < limit )
  55.     num = limit
  56.   set_cvar_num( "sv_visiblemaxplayers" , num )
  57. }
复制代码
发表于 2006-11-10 01:03:55 | 显示全部楼层 来自 中国–陕西–西安

回复: 再谈预留通道问题

到官方下载一个最新的for Linux 的 1.76b 版本,然后再试试。你可以对它进行修改,但建议在 Linux 下编译它。
回复

使用道具 举报

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

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