Not sure if this will work, but...
Entity_t *e = ent->entity;
Sentient *s = (Sentient *)e;
Player *p = (Player *)e;
Weapon_t *weapon = NULL, *weap = NULL;
//Does player have a active weapon
if((player->activeWeapon != 0) || (ent->client->ps.activeItems[0] != -1))
{
weap = (Weapon_t *)player->activeWeapon;
if(weap != NULL)
{
//Not sure, but this may be one way of detecting whether or not a weapon is being fired
if(weap->firemodeindex == "FIRE_PRIMARY" || weap->firemodeindex == "FIRE_SECONDARY")
{
//Don't drop weapon
weap->notdroppable == TRUE;
}
//A second way of checking if a weapon is being fired
if(ucmd->buttons & BUTTON_GROUP_FIRE_PRIMARY || ucmd->buttons & BUTTON_GROUP_FIRE_SECONDARY)
{
//Don't drop weapon
weap->notdroppable == TRUE;
}
}
}
or maybe this
//Does player have a active weapon
if((player->activeWeapon != 0) || (ent->client->ps.activeItems[0] != -1))
{
weap = (Weapon_t *)player->activeWeapon;
if(weap != NULL)
{
//Not sure, but this may be one way of detecting whether or not a weapon is being fired and dropped
if((weap->firemodeindex == "FIRE_PRIMARY" || weap->firemodeindex == "FIRE_SECONDARY") && (ucmd->buttons & BUTTON_GROUP_DROP_WEAPON))
{
//Force sound
gameImport.Sound(&gEntTo->s.origin, gEntFrom->client->ps.clientNum, 2, "sound/weapons/fire/Colt45Fire1.wav", 1.0, 10.0, 1.0, 500.0, qfalse);
}
//A second way of checking if a weapon is being fired and dropped
if((ucmd->buttons & BUTTON_GROUP_FIRE_PRIMARY || ucmd->buttons & BUTTON_GROUP_FIRE_SECONDARY) && (ucmd->buttons & BUTTON_GROUP_DROP_WEAPON))
{
//Force sound
gameImport.Sound(&gEntTo->s.origin, gEntFrom->client->ps.clientNum, 2, "sound/weapons/fire/Colt45Fire1.wav", 1.0, 10.0, 1.0, 500.0, qfalse);
}
}
}