搜索
查看: 2033|回复: 2

有一个错误码率,版主主帮改一下

[复制链接]
发表于 2008-9-1 07:57:02 | 显示全部楼层 |阅读模式 来自 中国–广东–中山
我自已按照人家的去改的,有一个错误码!高人帮改一下

本帖子中包含更多资源

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

×
发表于 2008-9-1 09:36:47 | 显示全部楼层 来自 中国–广东–深圳

回复: 有一个错误码率,版主主帮改一下

[PHP]
/*
命令和参数说明:
amx_inform_freq <n>                    玩家进行举报时,相邻两次举报的最小时间间隔(秒),默认 15 秒
amx_clear_inform_items                 清除所有举报项目
amx_add_inform_item <title> <text>     增加举报项目,如:
amx_add_inform_item "举报玩家作弊" "%s 举报: 玩家 %s 作弊"
amx_add_inform_item "举报玩家可能作弊,请观察" "%s 举报: 玩家 %s 可能作弊,请观察"
amx_add_inform_item "举报玩家违反服务器规定,请处罚" "%s 举报: 玩家 %s 违反服务器规定,请处罚"
请按照此格式增加项目
say /inform                            打开举报玩家菜单
*/
#include <amxmodx>
#include <amxmisc>
#define MENU_SIZE    512
#define MENU_PLAYERS 8
#define MENU_ITEMS_PERPAGE 7
#define INFORM_ITEMS_MAXCOUNT 28
new Inform_Items_Count = 0
new g_nMenuPosition[33]
new g_nMenuPlayers[33][32]
new g_InformType[33]
new g_InformTarget[33]
new g_InformTime[33]
new g_InformMenuTitle[INFORM_ITEMS_MAXCOUNT][128]
new g_InformText[INFORM_ITEMS_MAXCOUNT][128]
new g_informer = 0 //举报者
public plugin_init()
{
register_plugin("Inform Player", "1.0", "Rulzy")
register_dictionary("common.txt")
register_cvar("amx_inform_freq","15")
register_clcmd("say /inform", "cmdInformMenu", ADMIN_ALL, "- display inform menu")
register_srvcmd("amx_clear_inform_items", "cmdClearInformItems", _, "- clear inform items")
register_srvcmd("amx_add_inform_item", "cmdAddInformItem", _, "<title> <text> - add a inform item")
register_menucmd( register_menuid("Inform Main"), 1023, "MainMenuAction" )
register_menucmd( register_menuid("Inform Player"), 1023, "InformMenuAction" )
register_menucmd( register_menuid("Inform Reply"), MENU_KEY_1|MENU_KEY_2, "ReplyMenuAction" )
Inform_Items_Count = 5
copy(g_InformMenuTitle[0], 127, "举报玩家是作弊猪")
copy(g_InformText[0], 127, "%s 举报: 玩家 %s 是作弊猪")

copy(g_InformMenuTitle[1], 127, "举报玩家可能是透视作弊,请观察")
copy(g_InformText[1], 127, "%s 举报: 玩家 %s 可能透视作弊,请观察")

copy(g_InformMenuTitle[2], 127, "举报玩家可能是TV,请观察")
copy(g_InformText[2], 127, "%s 举报: 玩家 %s 可能是TV,请观察")
        
        copy(g_InformMenuTitle[3], 127, "举报玩家多次满嘴喷粪,警告无效,请处罚")
copy(g_InformText[3], 127, "%s 举报: 玩家 %s 多次满嘴喷粪,警告无效,请处罚")
        
        copy(g_InformMenuTitle[4], 127, "举报玩家使用的ID相当不文明,请处罚")
copy(g_InformText[4], 127, "%s 举报: 玩家 %s 使用的ID相当不文明,请处罚")
}
public client_putinserver(id)
{
g_InformType[id] = -1
g_InformTarget[id] = 0
g_InformTime[id] = 0
new i, j
//防止玩家举报的玩家已离开,被新进入的玩家占用此id而导致举报对象错误
for(i=1;i<=32;i++)
{
  if(g_InformTarget==id) g_InformTarget = 0
  for(j=0;j<32;j++)
  {
   if(g_nMenuPlayers[j]==id)
    g_nMenuPlayers[j] = 0
  }
}
set_task(10.0, "show_hint", id)
}
public show_hint(id)
{
client_print(id, print_chat, "[AMXX] 按 Y 键后输入 /inform 可打开举报玩家菜单")
}
public cmdClearInformItems(id)
{
Inform_Items_Count = 0
return PLUGIN_HANDLED
}
public cmdAddInformItem(id)
{
if(read_argc()<5)
{
  server_print("Usage: amx_add_inform_item <title> <text> - add a inform item")  
  return PLUGIN_HANDLED
}
if(Inform_Items_Count>=INFORM_ITEMS_MAXCOUNT)
{
  server_print("Max inform items reached")
  return PLUGIN_HANDLED
}
read_argv(1, g_InformMenuTitle[Inform_Items_Count], 127)
read_argv(2, g_InformText[Inform_Items_Count], 127)
Inform_Items_Count++
return PLUGIN_HANDLED
}
public ReplyMenuAction(id, key)
{
if(key==0)
{
  new name[32], name2[32]
  get_user_name(id, name, 31)
  client_print(g_informer, print_chat, "[AMXX] 管理员 %s 收到你的举报。", name)
  client_cmd(g_informer,"spk misc/shoudao")
                get_user_name(g_informer, name2, 31)
  client_print(id, print_chat, "[AMXX] 你的回执已经发送给 %s。", name2)
}
}
public ShowInformReplyMenu(id, msg[])
{
new szMenuBody[MENU_SIZE]
new nLen = format(szMenuBody, MENU_SIZE-1, "\w%s^n^n\y请选择:\w^n^n", msg)
format(szMenuBody[nLen], MENU_SIZE-1-nLen,"1. 发送回执^n^n2. 不发送")
show_menu(id, MENU_KEY_1|MENU_KEY_2, szMenuBody, -1, "Inform Reply")
        client_cmd(id,"spk misc/opshoudao")
}
public ShowInformMsg(id, vid)
{

new curtime = get_user_time(id)
new inform_freq = get_cvar_num("amx_inform_freq")
if(curtime-g_InformTime[id]<inform_freq && g_InformTime[id]!=0)
{
  client_print(id, print_chat, "[AMXX] 对不起,你上次举报完没多久,请你稍后再举报。")
  client_print(id, print_chat, "[AMXX] 下次举报此玩家只需选择 '重复上次的举报' 即可。")
  return
}
g_InformTime[id]= curtime
if(vid==0 || !is_user_connected(vid))
{
  client_print(id, print_chat, "[AMXX] 对不起,此玩家已经离开服务器,无法举报。")
  return
}
new name[32], vname[32]
get_user_name(id, name, 31)
get_user_name(vid, vname, 31)
new OpCount = 0, flags, msg[256]
format(msg, 255, g_InformText[g_InformType[id]], name, vname)
new max_players = get_maxplayers()
g_informer = id
for(new i=1;i<=max_players;i++)
{
  if(!is_user_connected(i)) continue
  flags = get_user_flags(i)
  if(flags&ADMIN_BAN || flags&ADMIN_KICK)
  {
   OpCount++
   if(i!=id)
   {
    ShowInformReplyMenu(i, msg)
    console_print(i, msg)
   }
  }
}
format(msg, 255, g_InformText[g_InformType[id]], "你", vname)
client_print(id, print_chat, msg)
}
public InformMenuAction(id, key)
{
switch( key )
{
  case 8: ShowInformMenu( id, ++g_nMenuPosition[id] )
  case 9: ShowInformMenu( id, --g_nMenuPosition[id] )
  default:
  {
   g_InformTarget[id] = g_nMenuPlayers[id][g_nMenuPosition[id] * MENU_PLAYERS + key]
   ShowInformMsg(id, g_InformTarget[id])
  }
}
}
public ShowInformMenu(id, pos)
{
if( pos < 0 ) return
new i, j
new nCurrKey = 0
new szUserName[32]
new szMenuBody[MENU_SIZE]
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, "\y%s\R%d/%d^n\w^n",
  g_InformMenuTitle[g_InformType[id]], 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 || j == id)
  {
   nCurrKey++
   nLen += format( szMenuBody[nLen], (MENU_SIZE-1-nLen), "\d%d. %s^n\w", nCurrKey, szUserName)
  }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 , "Inform Player")
}
public ReInform(id)
{
if(g_InformTarget[id]==0 || g_InformType[id] == -1)
{
  client_print(id, print_chat, "[AMXX] 对不起,你还没有举报过,或者是你上次举报的玩家已经离开。")
  return
}
ShowInformMsg(id, g_InformTarget[id])
}
public MainMenuAction(id, key)
{
switch( key )
{
  case 7: ReInform(id)
  case 8: ShowInformMainMenu(id, ++g_nMenuPosition[id])
  case 9: ShowInformMainMenu(id, --g_nMenuPosition[id])
  default:{
    g_InformType[id] = g_nMenuPosition[id] * MENU_ITEMS_PERPAGE + key
    ShowInformMenu(id, g_nMenuPosition[id]=0)
   }
}
}
public ShowInformMainMenu(id, pos)
{
if( pos < 0 ) return

new szMenuBody[MENU_SIZE]
new nCurrKey = 0
new nStart = pos * MENU_ITEMS_PERPAGE
new nKeys = MENU_KEY_0

if( nStart >= Inform_Items_Count )
  nStart = pos = g_nMenuPosition[id] = 0
new nEnd = nStart + MENU_ITEMS_PERPAGE
if( nEnd > Inform_Items_Count )
  nEnd = Inform_Items_Count
new nLen = format( szMenuBody, MENU_SIZE-1, "\y举报玩家菜单\R%d/%d^n\w^n",
  pos+1, Inform_Items_Count/MENU_ITEMS_PERPAGE+((Inform_Items_Count % MENU_ITEMS_PERPAGE)?1:0) )
for(new i=nStart;i<nEnd;i++)
{
  nKeys |= 1<<nCurrKey++
  nLen += format( szMenuBody[nLen], MENU_SIZE-1-nLen, "%d. %s^n", nCurrKey, g_InformMenuTitle)
}
if(Inform_Items_Count>0)
{
  nLen += format( szMenuBody[nLen], MENU_SIZE-1-nLen, "^n8. 重复上次的举报^n")
  nKeys |= MENU_KEY_8
}
if( nEnd != Inform_Items_Count )
{
  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, "Inform Main")
}
public plugin_precache(){
precache_sound( "misc/shoudao.wav")
precache_sound( "misc/opshoudao.wav")
return PLUGIN_CONTINUE
}  
public cmdInformMenu(id)
{
ShowInformMainMenu(id, g_nMenuPosition[id]=0)
return PLUGIN_HANDLED
}
/* UTF-8 func by www.DT-Club.net */
[/PHP]
回复

使用道具 举报

 楼主| 发表于 2008-9-1 17:40:17 | 显示全部楼层 来自 中国–广东–中山

回复: 有一个错误码率,版主主帮改一下

楼上的,谢谢你的答复!插件可以编译,但有7个错误码!
回复

使用道具 举报

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

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