Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- **** Update 06/02/2013 ****
- I'm won't update this plugin any more.
- No license for this plugin/
- Free for All plugin - You can do what you want
- Note: No support for this plugin!
- Don't contact with me about this plugin!!!
- This plugin is fully bugged and not working!
- */
- #include <amxmodx>
- #include <fakemeta>
- #include <hamsandwich>
- #define OFFSET_AWM_AMMO 377
- #define OFFSET_SCOUT_AMMO 378
- #define OFFSET_PARA_AMMO 379
- #define OFFSET_FAMAS_AMMO 380
- #define OFFSET_M3_AMMO 381
- #define OFFSET_USP_AMMO 382
- #define OFFSET_FIVESEVEN_AMMO 383
- #define OFFSET_DEAGLE_AMMO 384
- #define OFFSET_P228_AMMO 385
- #define OFFSET_GLOCK_AMMO 386
- #define OFFSET_FLASH_AMMO 387
- #define OFFSET_HE_AMMO 388
- #define OFFSET_SMOKE_AMMO 389
- #define OFFSET_C4_AMMO 390
- #define MAX_WEAPONS 8
- #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
- enum _:Teams{
- FM_TEAM_UNASSIGNED,
- FM_TEAM_T,
- FM_TEAM_CT,
- FM_TEAM_SPECTATOR
- };
- new const g_Weaponsnames [MAX_WEAPONS] [] = {
- "M4A1",
- "AK47",
- "MP5",
- "Galil",
- "Famas",
- "Awp",
- "Scout",
- "ShutGun [M3]"
- };
- new const g_Weapons_code [MAX_WEAPONS] [] = {
- "weapon_m4a1",
- "weapon_ak47",
- "weapon_mp5",
- "weapon_galil",
- "weapon_famas",
- "weapon_awp",
- "weapon_scout",
- "weapon_m3"
- };
- new const g_Weapons_code2 [MAX_WEAPONS] [] = {
- CSW_M4A1,
- CSW_AK47,
- CSW_MP5NAVY,
- CSW_GALIL,
- CSW_FAMAS,
- CSW_AWP,
- CSW_SCOUT,
- CSW_M3
- };
- new g_weapon_choose[33];
- public plugin_init(){
- register_plugin("Guard Weapon Menu","0.0.1","");
- RegisterHam(Ham_Spawn,"player","PlayerSpawn",1);
- }
- public client_putinserver(client) g_weapon_choose[client] = 0;
- public client_disconnect(client) g_weapon_choose[client] = 0;
- public PlayerSpawn(client){
- if (!is_user_connected(client) || !is_user_alive(client))
- return;
- fm_strip_user_weapons(client);
- fm_give_item(client, "weapon_knife");
- if (fm_get_user_team(client) == FM_TEAM_CT)
- GuardMenu(client);
- }
- public GuardMenu(client){
- new Guard = menu_create("\r[ \yGuard's Weapon Menu \r]", "GuardMenu_Handler");
- new weapon[64];
- formatex(weapon,63,"Weapon: \d[\y%s\d]",g_Weaponsnames[g_weapon_choose[client]]);
- menu_additem(Guard,weapon);
- menu_additem(Guard,"Choose Weapon!");
- menu_setprop(Guard,MPROP_EXIT,MEXIT_NEVER);
- menu_display(client,Guard);
- }
- public GuardMenu_Handler(client,Guard,item){
- switch(item)
- {
- case MENU_EXIT: menu_destroy(Guard);
- case 0:
- {
- if (g_weapon_choose[client] = MAX_WEAPONS - 1)
- g_weapon_choose[client] = -1;
- g_weapon_choose[client]++;
- GuardMenu(client);
- }
- case 1:
- {
- fm_give_item(client,g_Weapons_code[g_weapon_choose[client]]);
- fm_set_user_bpammo(client,str_to_num(g_Weapons_code2[g_weapon_choose[client]]),9999);
- fm_give_item(client, "weapon_deagle");
- fm_give_item(client, "weapon_hegrenade");
- fm_give_item(client, "weapon_flashbang");
- fm_give_item(client, "weapon_smokegrenade");
- fm_set_user_bpammo(client, CSW_DEAGLE, 9999);
- fm_set_user_bpammo(client, CSW_HEGRENADE, 1);
- fm_set_user_bpammo(client, CSW_FLASHBANG, 2);
- fm_set_user_bpammo(client, CSW_SMOKEGRENADE, 4);
- }
- }
- menu_destroy(Guard);
- }
- stock fm_set_user_bpammo(index, weapon, amount)
- {
- new offset;
- switch(weapon)
- {
- case CSW_AWP: offset = OFFSET_AWM_AMMO;
- case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO;
- case CSW_M249: offset = OFFSET_PARA_AMMO;
- case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = OFFSET_FAMAS_AMMO;
- case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO;
- case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO;
- case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO;
- case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO;
- case CSW_P228: offset = OFFSET_P228_AMMO;
- case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO;
- case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO;
- case CSW_HEGRENADE: offset = OFFSET_HE_AMMO;
- case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO;
- case CSW_C4: offset = OFFSET_C4_AMMO;
- default:{
- new invalidMsg[20 + 7];
- formatex(invalidMsg,20 + 6,"Invalid weapon id %d",weapon);
- set_fail_state(invalidMsg);
- return 0;
- }
- }
- set_pdata_int(index,offset,amount);
- return 1;
- }
- stock fm_give_item(index, const item[]) {
- if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
- return 0;
- new ent = fm_create_entity(item);
- if (!pev_valid(ent))
- return 0;
- new Float:origin[3];
- pev(index, pev_origin, origin);
- set_pev(ent, pev_origin, origin);
- set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
- dllfunc(DLLFunc_Spawn, ent);
- new save = pev(ent, pev_solid);
- dllfunc(DLLFunc_Touch, ent, index);
- if (pev(ent, pev_solid) != save)
- return ent;
- engfunc(EngFunc_RemoveEntity, ent);
- return -1;
- }
- stock fm_strip_user_weapons(index) {
- new ent = fm_create_entity("player_weaponstrip");
- if (!pev_valid(ent))
- return 0;
- dllfunc(DLLFunc_Spawn, ent);
- dllfunc(DLLFunc_Use, ent, index);
- engfunc(EngFunc_RemoveEntity, ent);
- return 1;
- }
- stock fm_get_user_team(index)
- return get_pdata_int(index,114);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement