Command works but says unknown command?
#1

Hey so when i type /ooc message it says my message, but also says under the working message SERVER: Unknown command. The second problem is, after 5 characters in /ooc example 12345 it shows OOC: : 12345 but when i do /ooc 1234 it does OOC: My_Name: 1234. Help?

pawn Код:
CMD:ooc(playerid, params[])
{
    new OOCT;
    new string[246];
    if(sscanf(params, "s[126]", OOCT)) return SendClientMessage(playerid, COLOR_RED, "USE: /ooc [message]");
    if(ooc == 0)
    {
        return SendClientMessage(playerid, COLOR_GREY, "The OOC channel is closed!");
    }
    else
    {
        format(string, sizeof(string), "(( OOC: %s: %s ))", pName(playerid), OOCT);
        SendClientMessageToAll(COLOR_GREY, string);
        print(string);
        return 1;
    }
    return 0;
}
Reply
#2

pawn Код:
CMD:ooc(playerid, params[])
{
    new OOCT[126];
    new string[246];
    if(sscanf(params, "s[126]", OOCT)) return SendClientMessage(playerid, COLOR_RED, "USE: /ooc [message]");
    if(ooc == 0)
    {
        return SendClientMessage(playerid, COLOR_GREY, "The OOC channel is closed!");
    }
    else
    {
        format(string, sizeof(string), "(( OOC: %s: %s ))", pName(playerid), OOCT);
        SendClientMessageToAll(COLOR_GREY, string);
        print(string);
        return 1;
    }
    return 1;
}
i think this will be work
Reply
#3

You don't need sscanf.
pawn Код:
CMD:ooc(playerid, params[])
{
    new string[246];
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USE: /ooc [message]");
    if(ooc == 0) return SendClientMessage(playerid, COLOR_GREY, "The OOC channel is closed!");
    format(string, sizeof(string), "(( OOC: %s: %s ))", pName(playerid), params);
    SendClientMessageToAll(COLOR_GREY, string);
    print(string);
    return 1;
}
Reply
#4

Your returning everything inside the compound expression or statement (everything within the first and last code block) as false.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)