I guess I should have given an example
oh well, next suggestion. What about including a YSI style help system? I'm not 100% percent sure but public functions seem to be ok if you pass extra arguments, so you could change the local function calls from
pawn Код:
CallLocalFunction(funcname, "is", playerid, cmdtext[pos])
to
pawn Код:
CallLocalFunction(funcname, "isi", playerid, cmdtext[pos], false)
without any compatibility problems. If you prefer it could be a compile option, but it shouldn't be necessary.
Then all that's needed is a function like
pawn Код:
stock ZCMD_FunctionHelp(const playerid, const command[])
{
new funcname[MAX_COMM_FUNC_NAME] = "zcmd_";
for(new pos = 5; pos < sizeof(funcname) - 1 && command[pos - 5] > ' '; pos++) {
funcname[pos] = tolower(command[pos - 5]);
}
return CallLocalFunction(funcname, "isi", playerid, "\1", true);
}
and if the scripters want, they can do stuff like
pawn Код:
ZCMD:something(playerid, params[], bool:help)
{
if(help) {
SendClientMessage(playerid, 0x00FF00FF, "This command does something");
return 1;
}
// do something
return 1;
}
ZCMD:help(playerid, params[], bool:help)
{
if(help) {
SendClientMessage(playerid, 0x00FF00FF, "This command displays help");
} else if(isnull(params)) {
SendClientMessage(playerid, 0x00FF00FF, "Server info or something...");
} else if(!ZCMD_FunctionHelp(playerid, params)) {
SendClientMessage(playerid, 0x00FF00FF, "Unknown command. Type /commands for a list of commands");
}
return 1;
}
As long as they don't use the
ZCMD_FunctionHelp function the
ZCMD:command(playerid, params[]) format should work as before.