bus1234
|
分享:
▼
x0
|
[1.6][插件] 高手幫助,看看我的SMA
(我第一個SMA)
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun>
public plugin_init() { register_plugin("Weapon Menu", "1.0", "ME") register_event("ResetHUD","event_hud_reset", "be") }
public event_hud_reset(id) { set_task(0.2,"event_player_spawn",id) }
public event_player_spawn(id) { new CsTeams:team = cs_get_user_team(id) if(!is_user_alive(id)) return PLUGIN_CONTINUE if(team == CS_TEAM_CT) { weaponmenu(id) } return PLUGIN_CONTINUE }
public weaponmenu(id) { new menu = menu_create("\y武器選單", "weaponmenu_handler") menu_additem(menu, "\r雷神激光破", "1", 0) menu_additem(menu, "\r白色STG44", "2", 0) menu_additem(menu, "\r雙子銀狼", "3", 0) menu_additem(menu, "\w雷霆終結者", "4", 0) menu_additem(menu, "\w霹靂悍將", "5", 0) menu_additem(menu, "\w霹靂戰警", "6", 0) menu_additem(menu, "\w繽紛瘋兔", "7", 0) menu_additem(menu, "\w白色K1a", "8", 0) menu_additem(menu, "\w閃靈獵手", "9", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0) }
public weaponmenu_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: { give_item(id, "weapon_galil") cs_set_user_bpammo(id , CSW_GALIL , 200) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 2:{ give_item(id, "weapon_xm1014") cs_set_user_bpammo(id , CSW_XM1014 , 54) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 3:{ give_item(id, "weapon_ak47") cs_set_user_bpammo(id , CSW_AK47 , 180) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 4:{ give_item(id, "weapon_m4a1") cs_set_user_bpammo(id , CSW_M4A1 , 200) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 5:{ give_item(id, "weapon_aug") cs_set_user_bpammo(id , CSW_AUG , 200) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 6:{ give_item(id, "weapon_ump45") cs_set_user_bpammo(id , CSW_UMP45 , 200) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 7:{ give_item(id, "weapon_p90") cs_set_user_bpammo(id , CSW_P90 , 180) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 8:{ give_item(id, "weapon_mp5navy") cs_set_user_bpammo(id , CSW_MP5NAVY , 180) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } case 9:{ give_item(id, "weapon_m3") cs_set_user_bpammo(id , CSW_M3 , 85) weaponmenuu(id) menu_destroy(menu) return PLUGIN_HANDLED } } menu_destroy(menu) return PLUGIN_HANDLED }
public weaponmenuu(id) { new menu = menu_create("\r手槍選單", "weaponmenu_handlerr") menu_additem(menu, "\w大嘴獵蜥", "1", 0) menu_additem(menu, "\w石破天驚", "2", 0) menu_additem(menu, "\w夜鷹Deagle", "3", 0) menu_additem(menu, "\w黃金夜鷹", "4", 0) menu_additem(menu, "\w玩命骷髏SKULL-1", "5", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0) }
public weaponmenu_handlerr(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: { give_item(id, "weapon_glock18") cs_set_user_bpammo(id , CSW_GLOCK18 , 200) give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") menu_destroy(menu) return PLUGIN_HANDLED } case 2:{ give_item(id, "weapon_usp") cs_set_user_bpammo(id , CSW_USP , 200) give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") menu_destroy(menu) return PLUGIN_HANDLED } case 3:{ give_item(id, "weapon_deagle") cs_set_user_bpammo(id, CSW_DEAGLE , 100) give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") menu_destroy(menu) return PLUGIN_HANDLED } case 4:{ give_item(id, "weapon_fiveseven") cs_set_user_bpammo(id, CSW_FIVESEVEN , 100) give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") menu_destroy(menu) return PLUGIN_HANDLED } case 5:{ give_item(id, "weapon_p228") cs_set_user_bpammo(id, CSW_P228 , 100) give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") menu_destroy(menu) return PLUGIN_HANDLED } } menu_destroy(menu) return PLUGIN_HANDLED }
幫我更正,這個不能篇做AMXX
|