AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Useful Stock(S) [Any Game] (https://forums.alliedmods.net/showthread.php?t=144685)

naris 12-10-2010 19:28

Re: Useful Stock(S) [Any Game]
 
Quote:

Originally Posted by samantharp (Post 1368091)
PHP Code:

stock GetTotalClients() 

GetMaxClients() is depreciated and putting any constant function in a loop is bad because it will call it several times, while placing it in a variable wont.

Why wouldn't you just use GetClientCount(false)?

berni 12-11-2010 16:55

Re: Useful Stock(S) [Any Game]
 
Also I see no need in commenting every single line of the code, especially things like this:

PHP Code:

    //Return:
    
return; 

Isn't it obvious that it's a return ?

Also, sometimes you use return at the end, in other functions there isn't one, why ?

Use i, j, k for as loop count variables

PHP Code:

stock bool:IsAdmin(Client)
{

    
//Declare:
    
new Admin GetUserFlagBits(Client);

    
//Not Admin:
    
if(Admin 1)
    {

        
//Return:
        
return true;       
    } 

Is he admin now or not ? wtf


All times are GMT -4. The time now is 18:40.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.