Quote:
Originally Posted by Greyscale
Since it is not a requirement for a plugin to be bug-free for approval, I will approve it. But you might want to double-check this:
Code:
if (b_antiteam && GetClientTeam(i) == GetClientTeam(client) && i != client)
StopFlash(i);
else if (b_antiowner && i == client)
StopFlash(i);
else if (b_antidead && !IsPlayerAlive(i))
StopFlash(i);
else
{
if (!b_blind)
RemoveBlind(i);
if (!b_deafen)
RemoveDeafen(i);
}
Everything below the first true if-statement will be ignored because you used 'else'. I don't know if that's what you intended.
|
You forgot that there is cycle of it
thats what I intended
but I just noticed that i could call GetClientTeam(client) only once
PHP Code:
public Action:OnFlashDetonate_PrePost(Handle:event, const String:name[], bool:dontBroadcast)
{
new owner = GetClientOfUserId(GetEventInt(event,"userid"));
new ownerteam = GetClientTeam(owner);
for (new i = 1; i <= MaxClients; i++) // cycle
{
if (IsInGame[i] && IsInGame[owner]) // clients in game
{
if (b_antiteam && GetClientTeam(i) == ownerteam && i != owner) // if player is in owner team but not owner
StopFlash(i);
else if (b_antiowner && i == owner) // if player is owner
StopFlash(i);
else if (b_antidead && !IsPlayerAlive(i)) // if player is dead
StopFlash(i);
else // if player is in opposite team and alive
{
if (!b_blind) // check wherther sm_antiflash_blind is disabled
RemoveBlind(i); // remove blind effect
if (!b_deafen) // check wherther sm_antiflash_deafen is disabled
RemoveDeafen(i); // remove deafen effect
}
}
}
return Plugin_Continue;
}
Edit:
Found bug, now fixed
Plugin optimized