搜索
查看: 2259|回复: 1

帮忙看下源码,谢谢!

[复制链接]
发表于 2008-10-17 17:26:32 | 显示全部楼层 |阅读模式 来自 中国–河南–漯河
我把VOTEMENU修改成投票踢人需要O权限,投票封禁需要P权限
如下
#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_LEVEL_C, "Shows Vote Kick Player Menu" )
register_clcmd( "amx_votebanmenu", "ShowVKMenu", ADMIN_LEVEL_D, "Shows Vote Ban Player Menu" )
register_menucmd( register_menuid("Vote Kick"), 1023, "MenuAction" )
register_menucmd( register_menuid("Vote Ban"), 1023, "MenuAction" )
}
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 )
if( nStart >= nNum )
  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
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/


可是为什么玩家还是需要J权限才能发起投票? 只有O和P权限还是不能发起投票,谢谢高手解答!
发表于 2008-10-17 19:42:18 | 显示全部楼层 来自 中国–福建–漳州

回复: 帮忙看下源码,谢谢!

因为这个插件是通过调用 amx_votekick  和 amx_voteban 这两上命令来实现投票踢人和BAN人的, 故你还需要修改 adminvote.sma。
回复

使用道具 举报

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

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