Raised This Month: $ Target: $400
 0% 

Proper indenting


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-28-2005 , 18:21  
Reply With Quote #9

Quote:
Originally Posted by v3x
Well, what I do is stick it in the compiler to test for loose-indentations .
That works!


Quote:
Originally Posted by Sp4rt4n
:/ is this clean code or do i have to work on it a little?

Code:
public checkPing(param[]) {     new id = param[0]     if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION))     {         remove_task(id)         client_print(id, print_chat, "[HPK] Ping checking disabled because of immunity..")         return PLUGIN_CONTINUE     }     new ping, l     get_user_ping(id, ping, l)     if (ping < ping_max)         ++numtests[id]     else     if (numtests[id] > 0) --numtests[id]     if (numtests[id] > ping_times)         kickPlayer(id)     return PLUGIN_CONTINUE }

(sample from my high ping kicker)
Beautiful!

But to shorten that one long if statement (if you want) you could include <amxmisc> and use the stock access() function:

Code:
if ((access(id, ADMIN_IMMUNITY) || (access(id, ADMIN_RESERVATION))
xeroblood is offline
Send a message via MSN to xeroblood
 



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 14:07.


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