Command keeps returning "Unknown Command"
#1

Probably some stupid mistake, I'm just not seeing it. When a user tries /ticket, it says "USAGE: /ticket [question]" which is should. However, if they use "/ticket Hello World" it gives them
Код:
** Ticket has been sent to on duty admins
SERVER: Unknown Command
and if there is no admins on duty, it just returns
Код:
SERVER: Unknown Command
pawn Код:
//Message to Send if user submits ticket, but no admins are on duty
new NoDutyMessage[128] = "No admins are currently on duty or may be busy. Try again later";
//Color of no-duty Message
#define NoDutyColor 0xFF0000FF
pawn Код:
CMD:ticket(playerid, params[]){

    new text[128];

    if(!sscanf(params, "s[128]", text)){
        if(AdminCheck(playerid)) return SendClientMessage(playerid, 0xFA8072FF, "Admins cannot submit tickets"); //delete if if you want admins to be able to submit tickets
        if(SubmittedTicket[playerid] != -1) return SendClientMessage(playerid, 0xFA8072FF, "You alreaddy have a ticket sent out");
        if(!AdminsOnDuty()) return SendClientMessage(playerid, NoDutyColor, NoDutyMessage);

        SubmittedTicket[playerid] = playerid;
        SendClientMessage(playerid, 0xFA8072FF, "** Ticket has been sent to on duty admins");

        //format message to admins
        new aMessage[128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(aMessage, sizeof(aMessage), "** Incoming ticket from %s, Use /claim %i to claim", pName, playerid);
        SendClientMessageToOnDutyAdmins(aMessage);

        TicketInfo[playerid][claimed] = 0;
        TicketInfo[playerid][query] = text;
        TicketInfo[playerid][player] = playerid;
        TicketInfo[playerid][helper] = -1;
    } else {
        return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ticket [question]");
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:ticket(playerid, params[]){
{ //this was missing..
        new text[128];
        if(!sscanf(params, "s[128]", text)){
        if(AdminCheck(playerid)) return SendClientMessage(playerid, 0xFA8072FF, "Admins cannot submit tickets"); //delete if if you want admins to be able to submit tickets
        if(SubmittedTicket[playerid] != -1) return SendClientMessage(playerid, 0xFA8072FF, "You alreaddy have a ticket sent out");
        if(!AdminsOnDuty()) return SendClientMessage(playerid, NoDutyColor, NoDutyMessage);

        SubmittedTicket[playerid] = playerid;
        SendClientMessage(playerid, 0xFA8072FF, "** Ticket has been sent to on duty admins");

        //format message to admins
        new aMessage[128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(aMessage, sizeof(aMessage), "** Incoming ticket from %s, Use /claim %i to claim", pName, playerid);
        SendClientMessageToOnDutyAdmins(aMessage);

        TicketInfo[playerid][claimed] = 0;
        TicketInfo[playerid][query] = text;
        TicketInfo[playerid][player] = playerid;
        TicketInfo[playerid][helper] = -1;
    } else {
        return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ticket [question]");
    }
Reply
#3

Quote:
Originally Posted by lulo356
Посмотреть сообщение
pawn Код:
CMD:ticket(playerid, params[]){
{ //this was missing..
        new text[128];
        if(!sscanf(params, "s[128]", text)){
        if(AdminCheck(playerid)) return SendClientMessage(playerid, 0xFA8072FF, "Admins cannot submit tickets"); //delete if if you want admins to be able to submit tickets
        if(SubmittedTicket[playerid] != -1) return SendClientMessage(playerid, 0xFA8072FF, "You alreaddy have a ticket sent out");
        if(!AdminsOnDuty()) return SendClientMessage(playerid, NoDutyColor, NoDutyMessage);

        SubmittedTicket[playerid] = playerid;
        SendClientMessage(playerid, 0xFA8072FF, "** Ticket has been sent to on duty admins");

        //format message to admins
        new aMessage[128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(aMessage, sizeof(aMessage), "** Incoming ticket from %s, Use /claim %i to claim", pName, playerid);
        SendClientMessageToOnDutyAdmins(aMessage);

        TicketInfo[playerid][claimed] = 0;
        TicketInfo[playerid][query] = text;
        TicketInfo[playerid][player] = playerid;
        TicketInfo[playerid][helper] = -1;
    } else {
        return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ticket [question]");
    }
it is on the line above the line you added, does it make a difference?
Reply
#4

Quote:
Originally Posted by Nathan_Taylor
Посмотреть сообщение
it is on the line above the line you added, does it make a difference?
no, you are returning 0 somewhere which is causing the Server Unknown Command. What command system are you using? ZCMD? Also his version has more '{' brackets then '}' which will cause errors if you paste it in.
Reply
#5

Quote:
Originally Posted by DeStunter
Посмотреть сообщение
no, you are returning 0 somewhere which is causing the Server Unknown Command.
Well I know returning 0 gives you that message. But I didn't return 0 anywhere
Reply
#6

Quote:
Originally Posted by Nathan_Taylor
Посмотреть сообщение
Well I know returning 0 gives you that message. But I didn't return 0 anywhere
sorry but I edited the post right when you posted. What command system are you using?
Reply
#7

I am using ZCMD, yeah, all he did was add another opening bracket which would throw it off. I just don't understand why I am getting that message back when I never returned 0
Reply
#8

could I see your
pawn Код:
OnPlayerCommandReceived(playerid, cmdtext[])
OnPlayerCommandPerformed(playerid, cmdtext[], success)
callback code?

that or one of you SendClientMessage is returning 0 instead 1
Reply
#9

Sorry? I'm not sure what you mean. I don't have anything of the sort in my script. Here is my whole script. I never have those commands on callbacks. I've made filterscripts/gamemodes before doing it the way I just did in this one. That is why I am confused.
Reply
#10

I noticed while looking you are assigning text incorrectly too TicketInfo[playerid][query].
Use
pawn Код:
strcat(TicketInfo[playerid][query], text);
or

pawn Код:
format(TicketInfo[playerid][query], sizeof(TicketInfo[playerid][query]), "%s", text);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)