AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Clarity of Script (https://forums.alliedmods.net/showthread.php?t=10196)

gunblade 02-11-2005 02:35

Clarity of Script
 
1 Attachment(s)
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! :lol:

n0obie4life 02-11-2005 06:08

wrong forum? mouldes shld be the correct one..nice module anyway..

Johnny got his gun 02-11-2005 06:16

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.


All times are GMT -4. The time now is 19:25.

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