PHP Code:
stock g_WeaponSlots[] = {
0,
2, //CSW_P228
0,
2, //CSW_ELITE
2, //CSW_FIVESEVEN
2, //CSW_USP
2, //CSW_GLOCK18
2, //CSW_DEAGLE
}
This is completly wrong.
Code:
/* Id of weapons in CS */
#define CSW_P228 1
#define CSW_SCOUT 3
#define CSW_HEGRENADE 4
#define CSW_XM1014 5
#define CSW_C4 6
#define CSW_MAC10 7
#define CSW_AUG 8
#define CSW_SMOKEGRENADE 9
#define CSW_ELITE 10
#define CSW_FIVESEVEN 11
#define CSW_UMP45 12
#define CSW_SG550 13
#define CSW_GALI 14
#define CSW_GALIL 14
#define CSW_FAMAS 15
#define CSW_USP 16
#define CSW_GLOCK18 17
#define CSW_AWP 18
#define CSW_MP5NAVY 19
#define CSW_M249 20
#define CSW_M3 21
#define CSW_M4A1 22
#define CSW_TMP 23
#define CSW_G3SG1 24
#define CSW_FLASHBANG 25
#define CSW_DEAGLE 26
#define CSW_SG552 27
#define CSW_AK47 28
#define CSW_KNIFE 29
#define CSW_P90 30
Your code would looks like :
PHP Code:
stock g_WeaponSlots[] = {
0,
2, //CSW_P228
0,
1, //CSW_SCOUT
4, //CSW_HEGRENADE
1, //CSW_XM1014
5, //CSW_C4
1, //CSW_MAC10
}
You could do something like this :
PHP Code:
#define IsWeaponTypeSecondary(%1) (%1 & GUNS_BITSUM)
const GUNS_BITSUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
public Event_CurWeapon(id)
{
new iCswId = read_data(2)
if( IsWeaponTypeSecondary(iCswId) ) //Run time error 4 here... no idea why it does that...
{
// don't do useless checks
//new ammo = cs_get_user_bpammo(id, wp)
//if (ammo < g_MaxBPAmmo[wp])
//{
cs_set_user_bpammo(id, iCswId, GetGunMaxBpAmmo[iCswId])
}
}
GetGunMaxBpAmmo( CSW_ID )
{
switch( CSW_ID )
{
case CSW_P228:
{
return 52
}
case CSW_ELITE, CSW_GLOCK18:
{
return 120
}
case CSW_FIVESEVEN, CSW_USP:
{
return 100
}
case CSW_DEAGLE:
{
return 35
}
}
}
__________________