RSSy MYGO.pl Opublikowano Maj 6, 2020 o 22:55 RSSy Udostępnij Opublikowano Maj 6, 2020 o 22:55 Weapons Menu _____________________________________________ ___________________________ What does this do? You can add weapons very easy If you understand you can add more categories! Introduction: I maded this for someone who wants to make his own weapon menu, it's very easy to read, or well, it are just some enums, functions and that's all. If you have some idea to make it better, don't forget to tell me! Another thing is that I'm newbie in pawn, and if I have some error, don't forgot also to tell me any problem an I will fix this asap Code: Spoiler PHP Code: #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #include <api_chatcolor> #include <hamsandwich> #define PLUGIN "Menu de Armamento" #define VERSION "1.0" #define AUTHOR "Nazy.-" enum _:DATA_WEAPONS { NOMBRE[33], CSW, BALAS, WEAPON[25] } new const sz_iWeaponsPrim[][DATA_WEAPONS] = { { "M4A1 Carbine", CSW_M4A1, 200, "weapon_m4a1" }, { "AWP Magnum", CSW_AWP, 100, "weapon_awp" }, { "MP5 Navy", CSW_MP5NAVY, 200, "weapon_mp5navy" } } new const sz_iWeaponsSec[][DATA_WEAPONS] = { { "USP", CSW_USP, 100, "weapon_usp" }, { "Deagle", CSW_DEAGLE, 100, "weapon_deagle" }, { "Dual Beretta", CSW_ELITE, 100, "weapon_elite" } } new g_iWeaponSelected[33], cvar_autoabrir public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /weapons", "cmd_iWeapons") cvar_autoabrir = register_cvar("wpn_autoabrir", "1") RegisterHam(Ham_Spawn, "player", "fw_spawn", 1) } public fw_spawn(id) { if(get_pcvar_num(cvar_autoabrir) == 1) { g_iWeaponSelected[id] = 0 iMenu_Primaria(id) ColorChat(id, print_chat, "!g[ARMAS] !yThe weapon menu was !gre-actived!y!") return PLUGIN_HANDLED; } g_iWeaponSelected[id] = 0 ColorChat(id, print_chat, "!g[ARMAS] !yThe weapon menu was re-actived!y!") return PLUGIN_HANDLED; } public iMenu_Primaria(id) { new menu = menu_create("Pick your primary weapon!", "smw_iHandler") for(new i = 0; i < sizeof(sz_iWeaponsPrim); i++) menu_additem(menu, sz_iWeaponsPrim[i][NOMBRE]) menu_display(id, menu, 0) } public smw_iHandler(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } switch(item) { default: { g_iWeaponSelected[id] = 1 strip_user_weapons(id) give_item(id, "weapon_knife") give_item(id, sz_iWeaponsPrim[item][WEAPON]) cs_set_user_bpammo(id, sz_iWeaponsPrim[item][CSW], sz_iWeaponsPrim[item][BALAS]) iMenu_Secundaria(id) } } return PLUGIN_HANDLED; } public iMenu_Secundaria(id) { new menu = menu_create("Pick your secondary weapons!", "smw_iHandlerSec") for(new i = 0; i < sizeof(sz_iWeaponsSec); i++) menu_additem(menu, sz_iWeaponsSec[i][NOMBRE]) menu_display(id, menu, 0) } public smw_iHandlerSec(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } switch(item) { default: { g_iWeaponSelected[id] = 2 give_item(id, sz_iWeaponsSec[item][WEAPON]) cs_set_user_bpammo(id, sz_iWeaponsSec[item][CSW], sz_iWeaponsSec[item][BALAS]) } } return PLUGIN_HANDLED; } public cmd_iWeapons(id) { switch(g_iWeaponSelected[id]) { case 0: { iMenu_Primaria(id) return PLUGIN_HANDLED; } case 1: { iMenu_Secundaria(id) return PLUGIN_HANDLED; } case 2: { ColorChat(id, print_chat, "!g[ARMAS] !yYou already have weapons!") return PLUGIN_HANDLED; } } return PLUGIN_HANDLED; } How to add a new weapon Spoiler PHP Code: // Example: I want to add a secondary weapon: new const sz_iWeaponsPrim[][DATA_WEAPONS] = { { "M4A1 Carbine", CSW_M4A1, 200, "weapon_m4a1" }, { "AWP Magnum", CSW_AWP, 100, "weapon_awp" }, { "MP5 Navy", CSW_MP5NAVY, 200, "weapon_mp5navy" }, // MY NEW WEAPON: { "AK47", CSW_AK47, 100, "weapon_ak47" } } // Format: NAME, CSW_NAME, BULLETS, WEAPON_NAME // Example: "AUG", CSW_AUG, 200, "weapon_aug" // If you want to add a primary weapon do the same steps PSS: If you want a explication of what every thing do, and how it works tell me. Also: this was maded for spanish but i'm temporally banned of amxmodx-es, so if you see spanish functions don't lie me, if you don't understand anything bcuz all is spanish tell me and I will do all english! :oops: Attached Files Get Plugin or Get Source (menu_armas.sma - 3.2 KB) Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi