Raised This Month: $ Target: $400
 0% 

Useful Stock(S) [Any Game]


Post New Thread Reply   
 
Thread Tools Display Modes
naris
AlliedModders Donor
Join Date: Dec 2006
Old 12-10-2010 , 19:28   Re: Useful Stock(S) [Any Game]
Reply With Quote #11

Quote:
Originally Posted by samantharp View Post
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)?
naris is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 12-11-2010 , 16:55   Re: Useful Stock(S) [Any Game]
Reply With Quote #12

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
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:54.


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