AMXX-BG.INFO weap_slots.inc Raw include

weap_slots.inc

Original include source with line numbers.

Back Download .inc
1 /*
2 1.0a: set_slot now works with bots
3 */
4
5 #define MAXSLOTS 5
6 #define MAXWEAPS 31
7
8 new numWeapons[33]
9 new numSlot[33][MAXSLOTS]
10 new inSlot[33][MAXSLOTS]
11
12 stock weap_slot[MAXWEAPS] = {
13 0,
14 2, //CSW_P228
15 0,
16 1, //CSW_SCOUT
17 4, //CSW_HEGRENADE
18 1, //CSW_XM1014
19 5, //CSW_C4
20 1, //CSW_MAC10
21 1, //CSW_AUG
22 4, //CSW_SMOKEGRENADE
23 2, //CSW_ELITE
24 2, //CSW_FIVESEVEN
25 1, //CSW_UMP45
26 1, //CSW_SG550
27 1, //CSW_GALIL
28 1, //CSW_FAMAS
29 2, //CSW_USP
30 2, //CSW_GLOCK18
31 1, //CSW_AWP
32 1, //CSW_MP5NAVY
33 1, //CSW_M249
34 1, //CSW_M3
35 1, //CSW_M4A1
36 1, //CSW_TMP
37 1, //CSW_G3SG1
38 4, //CSW_FLASHBANG
39 2, //CSW_DEAGLE
40 1, //CSW_SG552
41 1, //CSW_AK47
42 3, //CSW_KNIFE
43 1 //CSW_P90
44 }
45
46 public num_slot(id, slot){
47 get_weaps(id)
48 return numSlot[id][slot]
49 }
50
51 public set_slot(id, slot){
52 if(weap_slot[get_user_weapon(id)]==1 && num_slot(id, slot))
53 {
54 new weapon[33]
55 get_weaponname(inSlot[id][slot], weapon, 32)
56
57 engclient_cmd(id, weapon)
58 }
59 }
60
61 get_weaps(id){
62 reset_slots(id)
63
64 new Weapons[32], weap
65 get_user_weapons(id, Weapons, numWeapons[id])
66
67 for(new x = 0; x < numWeapons[id]; x++)
68 {
69 weap = Weapons[x]
70
71 new slot = weap_slot[weap]
72 numSlot[id][slot]++
73 inSlot[id][slot] = weap
74 }
75 }
76
77 reset_slots(id){
78 numWeapons[id] = 0
79
80 for(new x=0; x<MAXSLOTS; x++)
81 {
82 numSlot[id][x]=0
83 inSlot[id][x]=-1
84 }
85 }
86