Command keeps returning "Unknown Command" -
Nathan_Taylor - 21.05.2014
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;
}
Re: Command keeps returning "Unknown Command" -
lulo356 - 21.05.2014
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]");
}
Re: Command keeps returning "Unknown Command" -
Nathan_Taylor - 21.05.2014
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?
Re: Command keeps returning "Unknown Command" -
DeStunter - 21.05.2014
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.
Re: Command keeps returning "Unknown Command" -
Nathan_Taylor - 21.05.2014
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
Re: Command keeps returning "Unknown Command" -
DeStunter - 21.05.2014
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?
Re: Command keeps returning "Unknown Command" -
Nathan_Taylor - 21.05.2014
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
Re: Command keeps returning "Unknown Command" -
DeStunter - 22.05.2014
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
Re: Command keeps returning "Unknown Command" -
Nathan_Taylor - 22.05.2014
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.
Re: Command keeps returning "Unknown Command" -
DeStunter - 22.05.2014
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);