View Single Post
404UserNotFound
BANNED
Join Date: Dec 2011
Old 03-13-2013 , 01:10   Re: Alongub, does this look correct to you? (TF2 Event question)
Reply With Quote #5

Quote:
Originally Posted by eXemplar View Post
If you have a few instances of where you check for the same stuff you could try something along the lines of,
Code:
bool:IsValidClient(client)
{
    return IsClientInGame(client) && !IsFakeClient(client) && !IsClientObserver(client);
}
Ooh, I'll definitely use that. I'm surprised I didn't think of that o_o

I've got like 20 different iterations of IsValidClient saved in a text file. Here's a good example that checks for things like if a player is coaching, or if they are the Replay thing, or if they are a Source TV client.

PHP Code:
stock bool:IsValidClient(ibool:replay true)
{
    if (
<= || MaxClients || !IsClientInGame(i) || GetEntProp(iProp_Send"m_bIsCoaching"))
    {
        return 
false;
    }
    if (
replay && (IsClientSourceTV(i) || IsClientReplay(i)))
    {
        return 
false;
    }
    return 
true;


Last edited by 404UserNotFound; 03-13-2013 at 01:10.
404UserNotFound is offline