Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Furien Weapons Advanced
- * Copyright (C) 2014 Adventx
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- * ----------------
- * -*- Creadits -*-
- * ----------------
- *
- * * AMXX Dev Team: for all the hard work which made this possible
- * * HamletEagle: for help me using enum
- *
- *
- * -----------------
- * -*- Changelog -*-
- * -----------------
- *
- * * v0.0.2: (Dec 2014)
- * - Optimized code and rewritten again
- * - Small modifications to the code
- *
- */
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <hamsandwich>
- #include <fun>
- new const PLUGIN[] = "Furien: Weapons Advanced";
- new const VERSION[] = "0.0.2";
- new const AUTHOR[] = "Adventx";
- enum _:eData
- {
- szWeaponName[64],
- szWeaponEntity[64],
- szWeaponAmmo,
- szWeaponBpAmmo
- }
- enum
- {
- WEAPONS_PRIMARY = 0,
- WEAPONS_SECONDARY
- }
- new const g_szWeaponsPrimary[][eData] =
- {
- { "M4A1", "weapon_m4a1", CSW_M4A1, 90, },
- { "AK47", "weapon_ak47", CSW_AK47, 90, },
- { "AUG", "weapon_aug", CSW_AUG, 90, },
- { "SG552", "weapon_sg552", CSW_SG552, 90, },
- { "Galil", "weapon_galil", CSW_GALIL, 90, },
- { "Famas", "weapon_famas", CSW_FAMAS, 90, },
- { "MP5 Navy", "weapon_mp5navy", CSW_MP5NAVY, 120, },
- { "XM1014", "weapon_xm1014", CSW_XM1014, 32, },
- { "M3", "weapon_m3", CSW_M3, 32, },
- { "P90", "weapon_p90", CSW_P90, 100, },
- { "M249", "weapon_m249", CSW_M249, 200, },
- { "SG550", "weapon_sg550", CSW_SG550, 90, },
- { "G3SG1", "weapon_g3sg1", CSW_G3SG1, 90, }
- };
- new const g_szWeaponsSecondary[][eData] =
- {
- { "Deagle", "weapon_deagle", CSW_DEAGLE, 35 },
- { "USP", "weapon_usp", CSW_USP, 100 },
- { "Elite", "weapon_elite", CSW_ELITE, 120 }
- };
- // Customization Vars
- new bool:g_bChoosenWeaponsPrimary[33];
- new bool:g_bChoosenWeaponsSecondary[33];
- public plugin_init()
- {
- register_plugin
- (
- .plugin_name = PLUGIN,
- .version = VERSION,
- .author = AUTHOR
- )
- // Client command
- register_clcmd("say /weapons", "clcmd_weapons");
- register_clcmd("say_team /weapons", "clcmd_weapons");
- // Ham Forwards
- RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", true);
- }
- public fw_PlayerSpawn_Post(id)
- {
- if (!is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT)
- return;
- ShowWeaponsMenu(id, WEAPONS_PRIMARY);
- g_bChoosenWeaponsPrimary[id] = false;
- g_bChoosenWeaponsSecondary[id] = false;
- }
- public ShowWeaponsMenu(id, weapons)
- {
- switch (weapons)
- {
- case WEAPONS_PRIMARY:
- {
- new szMenu = menu_create("Weapons Primary", "WeaponsPrimaryHandler");
- for (new i = 0; i < sizeof g_szWeaponsPrimary; i++)
- menu_additem(szMenu, g_szWeaponsPrimary[i][szWeaponName], "");
- }
- case WEAPONS_SECONDARY:
- {
- new szMenu = menu_create("Weapons Secondary", "WeaponsSecondaryHandler");
- for (new i = 0; i < sizeof g_szWeaponsSecondary; i++)
- menu_additem(szMenu, g_szWeaponsSecondary[i][szWeaponName], "");
- }
- }
- menu_setprop(szMenu, MPROP_EXIT, MEXIT_ALL);
- menu_display(id, szMenu, 0);
- }
- public WeaponsPrimaryHandler(id, szMenu, item)
- {
- if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT)
- {
- menu_destroy(szMenu);
- return PLUGIN_HANDLED;
- }
- give_item(id, g_szWeaponsPrimary[item][szWeaponEntity]);
- cs_set_user_bpammo(id, g_szWeaponsPrimary[item][szWeaponAmmo], g_szWeaponsPrimary[item][szWeaponBpAmmo]);
- g_bChoosenWeaponsPrimary[id] = true;
- ShowWeaponsMenu(id, WEAPONS_SECONDARY);
- menu_destroy(szMenu);
- return PLUGIN_HANDLED;
- }
- public WeaponsSecondaryHandler(id, szMenu, item)
- {
- if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT)
- {
- menu_destroy(szMenu);
- return PLUGIN_HANDLED;
- }
- give_item(id, g_szWeaponsSecondary[item][szWeaponEntity]);
- cs_set_user_bpammo(id, g_szWeaponsSecondary[item][szWeaponAmmo], g_szWeaponsSecondary[item][szWeaponBpAmmo]);
- g_bChoosenWeaponsSecondary[id] = true;
- menu_destroy(szMenu);
- return PLUGIN_HANDLED;
- }
- public clcmd_weapons(id)
- {
- if (!is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT)
- return PLUGIN_HANDLED;
- if (g_bChoosenWeaponsPrimary[id] == false)
- ShowWeaponsMenu(id, WEAPONS_PRIMARY);
- if (g_bChoosenWeaponsSecondary[id] == false)
- ShowWeaponsMenu(id, WEAPONS_SECONDARY);
- ChatColor(id, "!g[Furien: Weapons Menu] !nYou select your weapons in this round");
- return PLUGIN_HANDLED;
- }
- stock ChatColor(index, const input[], any:...)
- {
- new iPlayers[32], count = 1;
- static msg[191];
- vformat(msg, 190, input, 3);
- replace_all(msg, 190, "!g", "^4"); // Green Color
- replace_all(msg, 190, "!n", "^1"); // Default Color
- replace_all(msg, 190, "!t", "^3"); // Team Color
- replace_all(msg, 190, "!t2", "^0"); // Team2 Color
- if (index) iPlayers[0] = index; else get_players(iPlayers, count, "ch");
- {
- for (new i = 0; i < count; i++)
- {
- if (is_user_connected(iPlayers[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i]);
- write_byte(iPlayers[i]);
- write_string(msg);
- message_end();
- }
- }
- }
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
- */
Advertisement
Add Comment
Please, Sign In to add comment