[Tutorial] How to make your server/script look clean and good.
#7

I use this for usage/syntax messages:

pawn Код:
stock ShowSyntax(playerid, cmd[], func[], example[]="")
{
    new syntax[144];
    format(syntax, sizeof(syntax), "USAGE: {FFFFFF}%s", cmd);
    SendClientMessage(playerid, COLOR_RED, syntax);
    format(syntax, sizeof(syntax), "FUNCTION: {FFFFFF}%s", func);
    SendClientMessage(playerid, COLOR_ORANGE, syntax);

    if(!isnull(example))
    {
    format(syntax, sizeof(syntax), "EXAMPLE: {FFFFFF}%s", func);
    SendClientMessage(playerid, COLOR_DARKGREEN, syntax);
    }
    return 1;
}
(it could probably be made better with string concatenation or something but I made this about a year ago and it works so yeah)

Consistency is good.

Usage of usage:
pawn Код:
CMD:weapon(playerid, params[])
{
    if(isnull(params)) return ShowSyntax(playerid, "/WEAPON [PART OF WEAPON NAME]", "Give yourself a weapon.", "/weapon minigun or /weapon mini");
    // rest of command
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)