Internal (add-ons/server_globalhelp/server.cs):
if($GlobalHelp::serverExecutedOnce) {
return;
}
$GlobalHelp::serverExecutedOnce = 1;
new ScriptObject(ServHelp) {
count=0;
};
Function addHelp(%name,%desc) {
If(!%name || !%desc) {
Error("Failed to add help command (Missing NAME or DESC)");
Return;
}
ServHelp.count += 1;
ServHelp.help[ServHelp.count@"name"] = %name;
ServHelp.help[ServHelp.count@"desc"] = %desc;
//packaging this overwrites any other addons that create the servercmdhelp function.
Package GlobalHelp {
Function serverCMDHelp(%c) {
For(%i=0;%i<ServHelp.count;%i++) {
messageClient(%c,'',"\c5"@ServHelp[%i@"name"]@"\c6 - "@ServHelp[%i@"desc"]);
}
messageClient(%c,'',"\c6Press PGUP to view all Help commands.");
}
};
activatePackage(GlobalHelp);
External (Other addons):
if(!isObject(ServHelp)) {
Exec("add-ons/server_globalhelp/server.cs");
}
addHelp("Test","Test Desc");
I havent tested this and i wrote this all on my kindle, so apologies for any syntax errors.
No package needed.
You can also add a variable like this:
ServHelp.help[ServHelp.count@"AdminOnly"]
And have serverCMDhelp check for admin if the variable shown above is 1.
EDIT: Packaged serverCmdhelp to overwrite any addons that create the servercmdhelp function.