搜索
查看: 4713|回复: 3

运行OP多枪插件,服务器就会崩溃(CS1.5)

[复制链接]
发表于 2014-12-19 10:49:02 | 显示全部楼层 |阅读模式 来自 中国–天津–天津
在网上找的插件,以下是源码,OP送枪弹出式菜单,只要一选择弹出式菜单选项就会导致服务器崩溃,这是哪里出错了呢?


[mw_shl_code=pawn,true]#include <amxmod>
#include <cstrike>   
#include <fun>   
#include <fakemeta>

#define INTERVAL                 1.0
#define CSW_PRIMARY 0x59FCF1A8
stock user_has_n_primary(id)
{
        if(is_user_alive(id))
        {
                new x = pev(id, pev_weapons);
                x &= CSW_PRIMARY;
                x = (x & 0x55555555) + ((x >> 1) & 0x55555555);
                x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
                x = (x & 0x0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F);
                x = (x & 0x00FF00FF) + ((x >> 8) & 0x00FF00FF);
                x = (x & 0x0000FFFF) + ((x >>16) & 0x0000FFFF);
                return x;
        }
        return 0;
}
public plugin_init()
{
register_plugin("God OP duo dai yi ba zhu qiang","1.0","Byxiaowei")
register_clcmd( "say /opqiang","ShowMenu", -1, "Shows The menu" )
register_event("ResetHUD", "ShowMenu", "abe")
register_menucmd(register_menuid("\r[Godop duo dai  zhu qiang cai dan]"), 1023, "MenuCommand" )
return PLUGIN_CONTINUE
}

public ShowMenu(id){
if(get_user_flags(id) & ADMIN_BAN){
new szMenuBody[256]
new keys
new nLen = format( szMenuBody, 255, "\r[Godop duo dai  zhu qiang cai dan]^n" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\y[\r1\y]\w duo dai yi ba AK47" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\y[\r2\y]\w duo dai yi ba M4A1" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\y[\r3\y]\w duo dai yi ba AWP" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. tui chu" )
keys = (1<<0|1<<1|1<<2|1<<9)
show_menu( id, keys, szMenuBody, -1 )
}
return PLUGIN_CONTINUE
}

public MenuCommand( id, key ){
switch( key )
{
case 0: set_task(INTERVAL,"AK47",id)
case 1: set_task(INTERVAL,"M4A1",id)
case 2: set_task(INTERVAL,"AWP",id)
case 9: set_task(INTERVAL,"ts",id)
}

return PLUGIN_HANDLED
}
public ts(id){
client_color(id, id, "^x04[wen xin ti shi]^x03 an Y shu ru/opqiang ke yi chong xin da kai cai dan")
return PLUGIN_HANDLED
}

public AK47(id) {
  if(!cs_get_user_buyzone(id)){
  client_color(id, id, "^x04[wen xin ti shi]^x03hui jia mai qu,xia pao sha")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE
  }
  if (!cs_get_user_hasprim(id)){   
  client_color(id, id, "^x04[wen xin ti shi]^x03ni dei xian mai ba zhu qiang")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE
        }
  if(user_has_n_primary(id)==2){
  client_color(id, id, "^x04[wen xin ti shi]^x03you liang ba qiang le hai xiang yao,xian diu yi ba zai shuo")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE
  }
  else
  {
    give_item(id, "weapon_ak47")
    cs_set_user_bpammo(id,CSW_AK47,90)
  }
  return PLUGIN_CONTINUE
}

public M4A1(id) {
  if(!cs_get_user_buyzone(id)){
  client_color(id, id, "^x04[wen xin ti shi]^x03hui jia mai qu,xia pao sha")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE
  }
  if (!cs_get_user_hasprim(id)){   
  client_color(id, id, "^x04[wen xin ti shi]^x03ni dei xian mai ba zhu qiang")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE        
  }
  if(user_has_n_primary(id)==2){
  client_color(id, id, "^x04[wen xin ti shi]^x03you liang ba qiang le hai xiang yao,xian diu yi ba zai shuo")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE
  }
  else
  {
    give_item(id, "weapon_m4a1")
    cs_set_user_bpammo(id,CSW_M4A1,90)
  }
  return PLUGIN_CONTINUE
}

public AWP(id) {
  if(!cs_get_user_buyzone(id)){
  client_color(id, id, "^x04[wen xin ti shi]^x03hui jia mai qu,xia pao sha")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE
  }
  if (!cs_get_user_hasprim(id)){   
  client_color(id, id, "^x04[wen xin ti shi]^x03ni dei xian mai ba zhu qiang")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE        
  }
  if(user_has_n_primary(id)==2){
  client_color(id, id, "^x04[wen xin ti shi]^x03you liang ba qiang le hai xiang yao,xian diu yi ba zai shuo")
  set_task(INTERVAL,"ShowMenu",id)  
  return PLUGIN_CONTINUE
  }
  else
  {
    give_item(id, "weapon_awp")
    cs_set_user_bpammo(id,CSW_AWP,30)
  }
  return PLUGIN_CONTINUE
}


public client_color(playerid, colorid, msg[])   
{   
  message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)   
  write_byte(colorid)   
  write_string(msg)   
}[/mw_shl_code]

本帖子中包含更多资源

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

×
发表于 2014-12-19 13:49:50 来自手机 | 显示全部楼层 来自 中国–江西–南昌
QQ748849468
回复

使用道具 举报

发表于 2015-4-27 22:53:30 | 显示全部楼层 来自 中国–广东–佛山
早解决了....源代码的颜色那里有问题
回复

使用道具 举报

发表于 2015-7-23 08:16:35 | 显示全部楼层 来自 中国–广东–佛山
public client_color(playerid, colorid, msg[])    {      message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)       write_byte(colorid)      write_string(msg)    }
这里错了
回复

使用道具 举报

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

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