Another thing you need to fix is next:
When spawning, bomb is dropped. You should strip all user weapons by one on time (except c4).
Do fm_strip_user_gun(player_index, weapon_index) on each player's weapon (except c4 and knife).
You can use this to detect if a weapon is primary or secondary.I think it will be helpful:
PHP Code:
#define snipers ((1<<CSW_SCOUT)|(1<<CSW_SG550)|(1<<CSW_AWP)|(1<<CSW_G3SG1))
#define rifles ((1<<CSW_AUG)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_M4A1)|(1<<CSW_SG552)|(1<<CSW_AK47))
#define shotguns ((1<<CSW_XM1014)|(1<<CSW_M3))
#define smg ((1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_MP5NAVY)|(1<<CSW_TMP)|(1<<CSW_P90))
#define pistols ((1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE))
#define nades ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG))
#define primary (snipers|rifles|shotguns|smg|(1<<CSW_M249))
#define secondary (pistols)
#define ct_primary ((1<<CSW_TMP)|(1<<CSW_AUG)|(1<<CSW_M4A1)|(1<<CSW_FAMAS)|(1<<CSW_G3SG1))
#define ct_secondary ((1<<CSW_P228)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_DEAGLE))
#define tt_primary ((1<<CSW_MAC10)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_GALIL)|(1<<CSW_SG550))
#define tt_secondary ((1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE))
These functions were made by me. They may help you too
PHP Code:
/* Returns the ammount of enabled bits of given sum:
For example:
if sum == 1 (0x001), enabled bits are 1
if sum == 2 (0x010), enabled bits are 1
if sum == 3 (0x011), enabled bits are 2
if sum == 4 (0x100), enabled bits are 1
This is usefull to detect how many weapons a user has at same time, for example.
...Or how many grenades are in same slot, or how many pistols (if your mod supports multiple pistols), etc...
*/
stock bitsnum(sum)
{
new EnabledBits = 0
new iMax
if ( sum>0 ) iMax = floatround(floatlog(float(sum), 2.0), floatround_ceil) + 1
for (new i=0; i<=iMax; i++)
{
if ( (1<<i)&sum == 0) continue
else EnabledBits++
}
return EnabledBits
}
/* Calculates the original ID of something that where left-shifted (1<<id), just like weapons, for example.
Be sure passed arg has exactly 1 bit ENABLED (1). */
stock bits2id(bits)
{
if ( bitsnum(bits) != 1 ) return 0
return (floatround(floatlog(float(bits), 2.0), floatround_ceil))
}