搜索
查看: 2299|回复: 3

请Rulzy版主再次帮助.

[复制链接]
发表于 2009-9-20 14:24:14 | 显示全部楼层 |阅读模式 来自 广东深圳
本帖最后由 702033080 于 2009-9-20 14:34 编辑

上面也写着1/2 证明还有第二页的..但是为什么按9却翻不了页..到底是什么问题呢?

本帖子中包含更多资源

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

×
 楼主| 发表于 2009-9-20 14:26:00 | 显示全部楼层 来自 广东深圳
以下是源码..请各位帮忙

#include <amxmodx>
#include <amxmisc>
#define MENU_SIZE    512
#define MENU_PLAYERS 8
new g_nMenuPosition[33]
new g_nMenuPlayers[33][32]
new g_votekick[33]={0,0,...}
public plugin_init()
{
register_plugin( "Vote Menu", "1.0", "skywalker" )
register_dictionary("common.txt")
register_dictionary("menufront.txt")
register_clcmd( "amx_votekickmenu", "ShowVKMenu", ADMIN_VOTE, "Shows Vote Kick Player Menu" )
register_clcmd( "amx_votebanmenu", "ShowVKMenu", ADMIN_VOTE, "Shows Vote Ban Player Menu" )
register_menucmd( register_menuid("Vote Kick"), 1023, "MenuAction" )
register_menucmd( register_menuid("Vote Ban"), 1023, "MenuAction" )
}
stock get_nosxei_players(players[32])
{
        new num = 0;
        new maxplayers = get_maxplayers();
        new name[32]
        for(new i=1;i<=maxplayers;i++)
        {
                if(!is_user_connected(i)&&!is_user_connecting(i)) continue;
                get_user_name(i, name, 31);
                if(equal(name, "[NO-sXe-I]", 10))
                        players[num++] = i;
        }
        return num;
}
public ShowVKMenu( id, lvl, cid )
{
if( cmd_access( id, lvl, cid, 1 ) )
{
  new cmd[32]
  read_argv(0,cmd,31)
  g_votekick[id] = equali(cmd,"amx_votekickmenu")
  ShowPlayerMenu( id, g_nMenuPosition[id] = 0 )
}
return PLUGIN_HANDLED
}
public MenuAction( id, key )
{
switch( key )
{
  case 8: ShowPlayerMenu( id, ++g_nMenuPosition[id] )
  case 9: ShowPlayerMenu( id, --g_nMenuPosition[id] )
  default:
  {
   new vID = g_nMenuPlayers[id][g_nMenuPosition[id] * MENU_PLAYERS + key]
   new userid = get_user_userid( vID )
   client_cmd(id,g_votekick[id]?"amx_votekick #%d":"amx_voteban #%d", userid )
  }
}
return PLUGIN_HANDLED
}
public ShowPlayerMenu( id, pos )
{
if( pos < 0 ) return
new i, j
new szMenuBody[MENU_SIZE]
new nCurrKey = 0
new szUserName[32]
new nStart = pos * MENU_PLAYERS
new nNum
get_players( g_nMenuPlayers[id], nNum, "f", "[NO-sXe-I]")
if( nNum = get_nosxei_players( g_nMenuPlayers[id] ) )
  nStart = pos = g_nMenuPosition[id] = 0
  
new nLen = format( szMenuBody, MENU_SIZE-1, g_votekick[id] ? "\y%L\R%d/%d^n\w^n" : "\y%L\R%d/%d^n\w^n", id, (g_votekick[id]?"VOTE_KICK":"VOTE_BAN"), pos+1, (nNum / MENU_PLAYERS + ((nNum % MENU_PLAYERS) ? 1 : 0 )) )
   
new nEnd = nStart + MENU_PLAYERS
new nKeys = MENU_KEY_0
if( nEnd > nNum )
  nEnd = nNum
for( i = nStart; i < nEnd; i++ )
{
  j = g_nMenuPlayers[id]
  get_user_name( j, szUserName, 31 )
  
  if( get_user_flags(j) & ADMIN_IMMUNITY )
  {
   nCurrKey++
   nLen += format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "\d%d. %s (%L)^n\w", nCurrKey, szUserName, id, "IMMU" )
  }else{
   nKeys |= (1<<nCurrKey++)
   if(is_user_admin(j))
    nLen += format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "%d. %s \r*\w^n", nCurrKey, szUserName )
   else
    nLen += format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "%d. %s^n", nCurrKey, szUserName )
  }
}
if( nEnd != nNum )
{
  format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n9. %L...^n0. %L", id , "MORE", id, (pos ? "BACK" : "EXIT" ))
  nKeys |= MENU_KEY_9
}
else
  format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n0. %L", id, (pos ? "BACK" : "EXIT" ))
show_menu( id, nKeys, szMenuBody, -1 , g_votekick[id]? "Vote Kick":"Vote Ban")
return
}
回复

使用道具 举报

发表于 2009-9-20 18:02:56 | 显示全部楼层 来自 福建漳州
  1. #include <amxmodx>
  2. #include <amxmisc>

  3. #define MENU_SIZE    512
  4. #define MENU_PLAYERS 8

  5. new g_nMenuPosition[33]
  6. new g_nMenuPlayers[33][32]
  7. new g_votekick[33]={0,0,...}

  8. public plugin_init()
  9. {
  10.         register_plugin( "Vote Menu", "1.0", "Rulzy" )
  11.         register_dictionary("common.txt")
  12.         register_dictionary("menufront.txt")
  13.         register_clcmd( "amx_votekickmenu", "ShowVKMenu", ADMIN_VOTE, "Shows Vote Kick Player Menu" )
  14.         register_clcmd( "amx_votebanmenu", "ShowVKMenu", ADMIN_VOTE, "Shows Vote Ban Player Menu" )
  15.         register_menucmd( register_menuid("Vote Kick"), 1023, "MenuAction" )
  16.         register_menucmd( register_menuid("Vote Ban"), 1023, "MenuAction" )
  17. }

  18. stock get_nosxei_players(players[32])
  19. {
  20.         new num = 0;
  21.         new maxplayers = get_maxplayers();
  22.         new name[32]
  23.         for(new i=1;i<=maxplayers;i++)
  24.         {
  25.                 if(!is_user_connected(i)&&!is_user_connecting(i)) continue;
  26.                 get_user_name(i, name, 31);
  27.                 if(equal(name, "[NO-sXe-I]", 10))
  28.                         players[num++] = i;
  29.         }
  30.         return num;
  31. }

  32. public ShowVKMenu( id, lvl, cid )
  33. {
  34.         if( cmd_access( id, lvl, cid, 1 ) )
  35.         {
  36.                 new cmd[32]
  37.                 read_argv(0,cmd,31)
  38.                 g_votekick[id] = equali(cmd,"amx_votekickmenu")
  39.                 ShowPlayerMenu( id, g_nMenuPosition[id] = 0 )
  40.         }

  41.         return PLUGIN_HANDLED
  42. }

  43. public MenuAction( id, key )
  44. {
  45.         switch( key )
  46.         {
  47.                 case 8: ShowPlayerMenu( id, ++g_nMenuPosition[id] )
  48.                 case 9: ShowPlayerMenu( id, --g_nMenuPosition[id] )
  49.                 default:
  50.                 {
  51.                         new vID = g_nMenuPlayers[id][g_nMenuPosition[id] * MENU_PLAYERS + key]
  52.                         new userid = get_user_userid( vID )
  53.                         client_cmd(id,g_votekick[id]?"amx_votekick #%d":"amx_voteban #%d", userid )
  54.                 }
  55.         }
  56.         return PLUGIN_HANDLED
  57. }

  58. public ShowPlayerMenu( id, pos )
  59. {
  60.         if( pos < 0 ) return

  61.         new i, j
  62.         new szMenuBody[MENU_SIZE]
  63.         new nCurrKey = 0
  64.         new szUserName[32]
  65.         new nStart = pos * MENU_PLAYERS

  66.         new nNum = get_nosxei_players( g_nMenuPlayers[id] )

  67.         if( nStart >= nNum )
  68.                 nStart = pos = g_nMenuPosition[id] = 0

  69.   
  70.         new nLen = format( szMenuBody, MENU_SIZE-1, "\y%L\R%d/%d^n\w^n", id, (g_votekick[id]?"VOTE_KICK":"VOTE_BAN"), pos+1, (nNum / MENU_PLAYERS + ((nNum % MENU_PLAYERS) ? 1 : 0 )) )
  71.    
  72.         new nEnd = nStart + MENU_PLAYERS
  73.         new nKeys = MENU_KEY_0

  74.         if( nEnd > nNum )
  75.                 nEnd = nNum

  76.         for( i = nStart; i < nEnd; i++ )
  77.         {
  78.                 j = g_nMenuPlayers[id][i]
  79.                 get_user_name( j, szUserName, 31 )

  80.                 if( get_user_flags(j) & ADMIN_IMMUNITY )
  81.                 {
  82.                         nCurrKey++
  83.                         nLen += format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "\d%d. %s (%L)^n\w", nCurrKey, szUserName, id, "IMMU" )
  84.                 }else
  85.                 {
  86.                         nKeys |= (1<<nCurrKey++)
  87.                         if(is_user_admin(j))
  88.                                 nLen += format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "%d. %s \r*\w^n", nCurrKey, szUserName )
  89.                         else
  90.                                 nLen += format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "%d. %s^n", nCurrKey, szUserName )
  91.                 }
  92.         }

  93.         if( nEnd != nNum )
  94.         {
  95.                 format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n9. %L...^n0. %L", id , "MORE", id, (pos ? "BACK" : "EXIT" ))
  96.                 nKeys |= MENU_KEY_9
  97.         }
  98.         else
  99.                 format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n0. %L", id, (pos ? "BACK" : "EXIT" ))
  100.         show_menu( id, nKeys, szMenuBody, -1 , g_votekick[id]? "Vote Kick":"Vote Ban")

  101.         return
  102. }
复制代码
回复

使用道具 举报

发表于 2011-12-1 06:32:39 | 显示全部楼层 来自 内蒙古赤峰
不错不错....
回复

使用道具 举报

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

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