Raised This Month: $ Target: $400
 0% 

Clarity of Script


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:         
gunblade
New Member
Join Date: Feb 2005
Old 02-11-2005 , 02:35   Clarity of Script
Reply With Quote #1

This is actually an include file that contains some macros that I
think can drastically improve the clarity and readabillity of AMXX
scripts. Consider the function for a console command:

Code:
public eat_player(id, level, cid) {
    ...Check permissions...
    ...Read in args...
    ...Eat the player...
}
so, I have a function that eats a player.... SO?
And just look at that boilerplate code!

With gunblade.inc you can also use:
Code:
concmd eat_player(...Put # of args here) {
...Eat the player...
}
You can access the arguments with args, args_len == # of args
id, level, and cid are implicitly defined.

Notice that this is much more clear:
Here we have a console command that eats a player and take x args
duh!.

Currently gunblade.inc includes concmd, clcmd, and task.
though I'm still learning amxx so I think clcmd and task need more in them.

Enjoy!
Attached Files
File Type: inc gunblade.inc (1.1 KB, 185 views)
gunblade is offline
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 02-11-2005 , 06:08  
Reply With Quote #2

wrong forum? mouldes shld be the correct one..nice module anyway..
n0obie4life is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 02-11-2005 , 06:16  
Reply With Quote #3

Well technically it isn't a module nor a script. I'll move it to scripting forum.

Also you're reading arguments the wrong way. Strings always need a null char to terminate them.
Johnny got his gun 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 19:25.


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