如果要在sma裏面設定玩家掉下武器,應該寫什麼?
我的錯誤:
我的sma:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
public plugin_init()
{
register_plugin("BuyMenu", "0.1", "2012die day")
register_clcmd("buygun", "buygun")
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|
(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|
(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
}
public plugin_cfg()
{
new cfgdir[32]
get_configsdir(cfgdir, charsmax(cfgdir))
/*
server_cmd("exec %s/weapon.cfg", cfgdir)
*/
}
public buygun(id)
{
if(!is_user_alive(id))
{
client_print(id, print_center, "死了不能買槍!")
return PLUGIN_HANDLED
}
if(!cs_get_user_buyzone(id))
{
client_print(id, print_center, "你要在購物區才能買!")
return PLUGIN_HANDLED
}
show_buymenu(id)
return PLUGIN_HANDLED
}
public show_buymenu(id)
{
new menu = menu_create("\y購買槍械 : ", "buymenu_handler")
menu_additem(menu, "\w手槍", "1", 0)
menu_additem(menu, "\w散彈槍", "2", 0)
menu_additem(menu, "\w衝鋒槍", "3", 0)
menu_additem(menu, "\w自動步槍", "4", 0)
menu_additem(menu, "\w機關槍", "5", 0)
menu_additem(menu, "\w其他武器", "6", 0)
menu_additem(menu, "\w裝備^n ", "7", 0)
menu_additem(menu, "\w購買主武器子彈", "8", 0)
menu_additem(menu, "\w購買副武器子彈", "9", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public buymenu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
cmd_111(id)
menu_destroy(menu)
return PLUGIN_HANDLED
}
case 2:{
cmd_222(id)
menu_destroy(menu)
return PLUGIN_HANDLED
}
case 3:{
cmd_333(id)
... ...(消失)
stock drop_weapons(id, dropwhat) // dropwhat: 1 = primary weapon , 2 = secondary weapon
{
// Get user weapons
static weapons[32], num, i, weaponid
num = 0 // reset passed weapons count (bugfix)
get_user_weapons(id, weapons, num)
// Loop through them and drop primaries or secondaries
for (i = 0; i < num; i++)
{
// Prevent re-indexing the array
weaponid = weapons
if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
{
// Get weapon name
static wname[32]
get_weaponname(weaponid, wname, charsmax(wname))
// Drop weapon
engclient_cmd(id, "drop", wname)
}
}
}