Add some proper validation checking, remove unnecessary code and do some code cleanup (readable code is very important) then you are fine:
PHP Code:
public Action:TakeDamageHook(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3])
{
// We don't have to check if the victim is valid, because otherwise this hook wouldn't have been called.
if (attacker < 0 || attacker > MaxClients || !IsClientInGame(attacker)) {
return Plugin_Continue;
}
if (GetClientTeam(victim) == CS_TEAM_T && GetClientTeam(attacker) == CS_TEAM_CT) {
decl String:weaponClass[32];
GetEntityClassname(weapon, weaponClass, sizeof(weaponClass));
if (StrEqual(weaponClass, "weapon_usp")) {
// We use GetEntProp to get a cell and cast it to a boolean, because there is no boolean version
new bool:m_bSilencerOn = bool:GetEntProp(weapon, Prop_Send, "m_bSilencerOn");
if (m_bSilencerOn) {
damage = 0.0;
PrintToChatAll("\x01Oh noes! \x03%N \x01shot \x04%N \x01!", attacker, victim);
return Plugin_Changed;
}
}
}
return Plugin_Continue;
}
__________________