Counting ZCMD Commands.
#7

Tested and works.

pawn Код:
#include <a_samp>
#include <zcmd>
#include <YSI/y_scripting>

main() {
}

public OnGameModeInit() {
    printf("Commands: %d", countCommands());
    return 1;
}

CMD:test(playerid, params[]) {
    print("lol");
}

stock countCommands() {
    new
        cmdBuffer[32],
        commandCount;

    for(new it = 0; it < Scripting_GetPublicsCount(); it++) {
        Scripting_GetPublic(it, cmdBuffer);

        if(!strcmp(cmdBuffer, "cmd_", false, 4)) {
            commandCount++;
        }
    }

    return commandCount;
}
You need YSI/y_scripting for this to work, you can remove the OnGameModeInit callback as it was a test to verify it compiled.
Reply


Messages In This Thread
Counting ZCMD Commands. - by Zh3r0 - 27.01.2011, 20:08
Re: Counting ZCMD Commands. - by Gabe - 27.01.2011, 20:11
Re: Counting ZCMD Commands. - by Zh3r0 - 27.01.2011, 20:15
Re: Counting ZCMD Commands. - by Gabe - 27.01.2011, 20:29
Re: Counting ZCMD Commands. - by Zh3r0 - 27.01.2011, 20:31
Re: Counting ZCMD Commands. - by Zh3r0 - 28.01.2011, 07:21
Re: Counting ZCMD Commands. - by __ - 28.01.2011, 09:51
Re: Counting ZCMD Commands. - by Zh3r0 - 28.01.2011, 10:51

Forum Jump:


Users browsing this thread: 2 Guest(s)