|
发表于 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]
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|