View difference between Paste ID: B4e2SdcN and gmFcTjKS
SHOW: | | - or go back to the newest paste.
1
/*
2-
#include <fun>
2+
	**** Update 06/02/2013 ****
3
	I'm won't update this plugin any more.
4-
#include <cstrike>
4+
	No license for this plugin/
5
	Free for All plugin - You can do what you want
6-
public plugin_init() {
6+
7-
 
7+
	Note: No support for this plugin!
8-
 RegisterHam( Ham_Spawn, "player", "PlayerSpawn", 1 )  
8+
	Don't contact with me about this plugin!!!
9
	This plugin is fully bugged and not working!
10-
public PlayerSpawn(client) {
10+
*/
11-
	 strip_user_weapons(client);
11+
12-
	 give_item(client, "weapon_knife");
12+
13-
	 if (is_user_alive(client) && cs_get_user_team(client) == CS_TEAM_CT) {
13+
#include <fakemeta>
14-
		  new g_WeaponMenu = menu_create("\r[ \yGuard's Weapon Menu \r]", "WeaponMenu_Handler");
14+
15-
		  menu_additem(g_WeaponMenu, "\yM4A1", "1", 0);
15+
16-
		  menu_additem(g_WeaponMenu, "\yAK47", "2", 0);
16+
#define OFFSET_AWM_AMMO			377 
17-
		  menu_additem(g_WeaponMenu, "\yMP5", "3", 0);
17+
#define OFFSET_SCOUT_AMMO		378
18-
		  menu_additem(g_WeaponMenu, "\yGalil", "4", 0);
18+
#define OFFSET_PARA_AMMO		379
19-
		  menu_additem(g_WeaponMenu, "\yFamas", "5", 0);
19+
#define OFFSET_FAMAS_AMMO		380
20-
		  menu_additem(g_WeaponMenu, "\yAwp", "6", 0);
20+
#define OFFSET_M3_AMMO			381
21-
		  menu_additem(g_WeaponMenu, "\yScout", "7", 0);
21+
#define OFFSET_USP_AMMO			382
22-
		  menu_additem(g_WeaponMenu, "\yShutGun\r[\yM3\r]", "8", 0);
22+
#define OFFSET_FIVESEVEN_AMMO		383
23-
		   
23+
#define OFFSET_DEAGLE_AMMO		384
24-
		  menu_setprop(g_WeaponMenu, MPROP_EXIT, MEXIT_ALL);
24+
#define OFFSET_P228_AMMO		385
25-
		  menu_display(client, g_WeaponMenu, 0);
25+
#define OFFSET_GLOCK_AMMO		386
26-
	 }
26+
#define OFFSET_FLASH_AMMO		387
27-
	 return PLUGIN_HANDLED;
27+
#define OFFSET_HE_AMMO			388
28
#define OFFSET_SMOKE_AMMO		389
29
#define OFFSET_C4_AMMO			390
30-
public WeaponMenu_Handler(client, g_WeaponMenu, item) {
30+
31-
	 if (item == MENU_EXIT) {
31+
#define MAX_WEAPONS 8
32-
	  menu_destroy(g_WeaponMenu);
32+
33-
	  return PLUGIN_HANDLED;
33+
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
34-
	 }
34+
35-
	 
35+
enum _:Teams{
36-
	 new data[6], iName[64];
36+
	FM_TEAM_UNASSIGNED,
37-
	 new access, callback;
37+
	FM_TEAM_T,
38-
	 menu_item_getinfo(g_WeaponMenu, item, access, data, 5, iName, 63, callback);
38+
	FM_TEAM_CT,
39-
	 
39+
	FM_TEAM_SPECTATOR
40-
	 new WeaponChoose = str_to_num(data);
40+
};
41-
	 switch(WeaponChoose) {
41+
42-
	  case 1:
42+
new const g_Weaponsnames [MAX_WEAPONS] [] = {
43-
	  {
43+
	"M4A1",
44-
		   give_item(client, "weapon_m4a1");
44+
	"AK47",
45-
		   cs_set_user_bpammo(client, CSW_M4A1, 9999);
45+
	"MP5",
46-
	  }
46+
	"Galil",
47-
	  case 2:
47+
	"Famas",
48-
	  {
48+
	"Awp",
49-
		   give_item(client, "weapon_ak47");
49+
	"Scout",
50-
		   cs_set_user_bpammo(client, CSW_AK47, 9999);
50+
	"ShutGun [M3]"
51-
	  }
51+
};
52-
	  case 3:
52+
53-
	  {
53+
new const g_Weapons_code [MAX_WEAPONS] [] = {
54-
		   give_item(client, "weapon_mp5navy");
54+
	"weapon_m4a1",
55-
		   cs_set_user_bpammo(client, CSW_MP5NAVY, 9999);
55+
	"weapon_ak47",
56-
	  }
56+
	"weapon_mp5",
57-
	  case 4:
57+
	"weapon_galil",
58-
	  {
58+
	"weapon_famas",
59-
		   give_item(client, "weapon_galil");
59+
	"weapon_awp",
60-
		   cs_set_user_bpammo(client, CSW_GALIL, 9999);
60+
	"weapon_scout",
61-
	  }
61+
	"weapon_m3"
62-
	  case 5:
62+
};
63-
	  {
63+
64-
		   give_item(client, "weapon_famas");
64+
new const g_Weapons_code2 [MAX_WEAPONS] [] = {
65-
		   cs_set_user_bpammo(client, CSW_FAMAS, 9999);
65+
	CSW_M4A1,
66-
	  }
66+
	CSW_AK47,
67-
	  case 6:
67+
	CSW_MP5NAVY,
68-
	  {
68+
	CSW_GALIL,
69-
		   give_item(client, "weapon_awp");
69+
	CSW_FAMAS,
70-
		   cs_set_user_bpammo(client, CSW_AWP, 9999);
70+
	CSW_AWP,
71-
	  }
71+
	CSW_SCOUT,
72-
	  case 7:
72+
	CSW_M3
73-
	  {
73+
};
74-
		   give_item(client, "weapon_scout");
74+
75-
		   cs_set_user_bpammo(client, CSW_SCOUT, 9999);
75+
new g_weapon_choose[33];
76-
	  }
76+
77-
	  case 8:
77+
public plugin_init(){
78-
	  {
78+
	register_plugin("Guard Weapon Menu","0.0.1","");
79-
		   give_item(client, "weapon_m3");
79+
	RegisterHam(Ham_Spawn,"player","PlayerSpawn",1);
80-
		   cs_set_user_bpammo(client, CSW_M3, 9999);
80+
81-
	  }
81+
82-
	 }
82+
public client_putinserver(client) g_weapon_choose[client] = 0;
83-
	 give_item(client, "weapon_deagle");
83+
public client_disconnect(client) g_weapon_choose[client] = 0;
84-
	 give_item(client, "weapon_hegrenade");
84+
85-
	 give_item(client, "weapon_flashbang");
85+
public PlayerSpawn(client){
86-
	 give_item(client, "weapon_smokegrenade");
86+
	if (!is_user_connected(client) || !is_user_alive(client))
87-
	 cs_set_user_bpammo(client, CSW_DEAGLE, 9999);
87+
		return;
88-
	 cs_set_user_bpammo(client, CSW_HEGRENADE, 1);
88+
89-
	 cs_set_user_bpammo(client, CSW_FLASHBANG, 2);
89+
	fm_strip_user_weapons(client);
90-
	 cs_set_user_bpammo(client, CSW_SMOKEGRENADE, 4);
90+
	fm_give_item(client, "weapon_knife");
91-
	 return PLUGIN_HANDLED;
91+
92-
}  
92+
	if (fm_get_user_team(client) == FM_TEAM_CT)
93-
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
93+
		GuardMenu(client);
94-
*{\\ rtf1\\ fbidis\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ ltrpar\\ lang1037\\ f0\\ fs16 \n\\ par }
94+
95-
*/
95+
96
public GuardMenu(client){
97
	new Guard = menu_create("\r[ \yGuard's Weapon Menu \r]", "GuardMenu_Handler");
98
	new weapon[64];
99
100
	formatex(weapon,63,"Weapon: \d[\y%s\d]",g_Weaponsnames[g_weapon_choose[client]]);
101
	menu_additem(Guard,weapon);
102
103
	menu_additem(Guard,"Choose Weapon!");
104
105
	menu_setprop(Guard,MPROP_EXIT,MEXIT_NEVER);
106
	menu_display(client,Guard);
107
}
108
109
public GuardMenu_Handler(client,Guard,item){
110
	switch(item)
111
	{
112
		case MENU_EXIT: menu_destroy(Guard);
113
		case 0:
114
		{
115
			if (g_weapon_choose[client] = MAX_WEAPONS - 1)
116
				g_weapon_choose[client] = -1;
117
118
			g_weapon_choose[client]++;
119
			GuardMenu(client);
120
		}
121
122
		case 1:
123
		{
124
			fm_give_item(client,g_Weapons_code[g_weapon_choose[client]]);
125
			fm_set_user_bpammo(client,str_to_num(g_Weapons_code2[g_weapon_choose[client]]),9999);
126
127
			fm_give_item(client, "weapon_deagle");
128
			fm_give_item(client, "weapon_hegrenade");
129
			fm_give_item(client, "weapon_flashbang");
130
			fm_give_item(client, "weapon_smokegrenade");
131
			fm_set_user_bpammo(client, CSW_DEAGLE, 9999);
132
			fm_set_user_bpammo(client, CSW_HEGRENADE, 1);
133
			fm_set_user_bpammo(client, CSW_FLASHBANG, 2);
134
			fm_set_user_bpammo(client, CSW_SMOKEGRENADE, 4);
135
		}
136
	}
137
138
	menu_destroy(Guard);
139
}
140
141
stock fm_set_user_bpammo(index, weapon, amount)
142
{
143
	new offset;
144
	
145
	switch(weapon)
146
	{
147
		case CSW_AWP: offset = OFFSET_AWM_AMMO;
148
			case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO;
149
			case CSW_M249: offset = OFFSET_PARA_AMMO;
150
			case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = OFFSET_FAMAS_AMMO;
151
			case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO;
152
			case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO;
153
			case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO;
154
			case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO;
155
			case CSW_P228: offset = OFFSET_P228_AMMO;
156
			case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO;
157
			case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO;
158
			case CSW_HEGRENADE: offset = OFFSET_HE_AMMO;
159
			case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO;
160
			case CSW_C4: offset = OFFSET_C4_AMMO;
161
			
162
		default:{
163
			new invalidMsg[20 + 7];
164
			formatex(invalidMsg,20 + 6,"Invalid weapon id %d",weapon);
165
			set_fail_state(invalidMsg);
166
			
167
			return 0;
168
		}
169
	}
170
	
171
	set_pdata_int(index,offset,amount);
172
	
173
	return 1;
174
}
175
176
stock fm_give_item(index, const item[]) {
177
	if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
178
		return 0;
179
180
	new ent = fm_create_entity(item);
181
	if (!pev_valid(ent))
182
		return 0;
183
184
	new Float:origin[3];
185
	pev(index, pev_origin, origin);
186
	set_pev(ent, pev_origin, origin);
187
	set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
188
	dllfunc(DLLFunc_Spawn, ent);
189
190
	new save = pev(ent, pev_solid);
191
	dllfunc(DLLFunc_Touch, ent, index);
192
	if (pev(ent, pev_solid) != save)
193
		return ent;
194
195
	engfunc(EngFunc_RemoveEntity, ent);
196
197
	return -1;
198
}
199
200
stock fm_strip_user_weapons(index) {
201
	new ent = fm_create_entity("player_weaponstrip");
202
	if (!pev_valid(ent))
203
		return 0;
204
205
	dllfunc(DLLFunc_Spawn, ent);
206
	dllfunc(DLLFunc_Use, ent, index);
207
	engfunc(EngFunc_RemoveEntity, ent);
208
209
	return 1;
210
}
211
212
stock fm_get_user_team(index)
213
	return get_pdata_int(index,114);