View Single Post
Annihilator
Senior Member
Join Date: Nov 2006
Location: Lithuania
Old 07-10-2012 , 06:16   Re: Checking for silencer
Reply With Quote #5

Well, I'll expand my problem a bit

I've been trying to hook OnTakeDamage and check if the one who dealt damage had a usp with a silencer equiped.

Trying to implement what you suggested I now have this:

PHP Code:
public Action:TakeDamageHook(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    new 
Ent = -1;
    if((
victim 0) && (victim <= MaxClients) && (attacker 0) && (attacker <= MaxClients) && (IsClientInGame(victim)) && (IsClientInGame(attacker)) && (GetClientTeam(victim) == CS_TEAM_T) && (GetClientTeam(attacker) == CS_TEAM_CT))
    {
        
decl String:WeaponName[64];
        
GetClientWeapon(inflictorWeaponNamesizeof(WeaponName));
        while ((
Ent FindEntityByClassname(attacker"weapon_usp")) != -1)
        {
            if (
StrEqual(WeaponName"weapon_usp") && (GetEntProp(EntProp_Send"m_bSilencerOn") == 1)) //FindSendPropOffs("CWeaponUSP","m_bSilencerOn") == 1)
            
{
                
damage 0.0;
                return 
Plugin_Changed;
            }
        }
    }
    return 
Plugin_Continue;

Well, so far it just crashes the server when someone does dmg with a silenced usp

Well, I have never used FindEntityByClassname or GetEntProp so, I'm guessing the the fault lies there


Edit: Silly me, copied the "while" even when I didnt need it . Fixed and solved

T.y. for the help


Last edited by Annihilator; 07-10-2012 at 06:24.
Annihilator is offline