PDA

View Full Version : iZCMD + Dialog = Unkown Command?


Cepillado
29/12/2015, 11:45 PM
I have no idea why I'm getting this message, the dialog won't show up as well.


#define DIALOG_TEST 700

CMD:test(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", "Da da da", "OK", " ");
return 1;
}

All the other commands are working perfectly.

saffierr
30/12/2015, 02:30 AM
You have to script under the "OnDialogResponse" either.

Tamy
30/12/2015, 05:11 AM
Make sure you don't have "public OnPlayerCommandText(playerid)" if you are using ZCMD.

Cepillado
30/12/2015, 06:17 AM
You have to script under the "OnDialogResponse" either.

I do.

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_TEST)
{
if(response)
{
SendClientMessage(playerid, -1, "That's cool");
}
else
{
Kick(playerid);
}
return 1;
}
return 0;
}

Make sure you don't have "public OnPlayerCommandText(playerid)" if you are using ZCMD.

I am aware of this, I am only using the OnPlayerCommandPerformed callback.

That's why I find this to be extremely odd, there are no errors, nothing.

Karan007
30/12/2015, 06:50 AM
Try this :D

CMD:test(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", "Da da da", "OK", "");
return CMD_SUCCESS;
}

iKarim
30/12/2015, 06:56 AM
Actually passing empty string to Button2 param causing command crash.
Simply use this:

CMD:test(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", "Da da da", "OK", "");
return true;
}

Cepillado
30/12/2015, 07:41 AM
Nope, both still give out "Unknown Command", and the dialog doesn't show up.

CMD:test(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", "Da da da", "OK", "");
return true;
}

CMD:test2(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", "Da da da", "OK", "");
return CMD_SUCCESS;
}

Update: I just made a new GameMode, with just those 2 commands and the OnDialogResponse callback, and it works. Does that mean that I have something on my current script that interferes with the command? I have no idea of what could it be.

ProDude
30/12/2015, 07:57 AM
Try this one in your current script i think this code will work

CMD:test(playerid, params[])
{
new str[1000];
format(str, sizeof(str), "Da da da");
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", str, "Ok", "");
return 1;
}

Karan007
30/12/2015, 08:39 AM
Try this one in your current script i think this code will work

CMD:test(playerid, params[])
{
new str[1000];
format(str, sizeof(str), "Da da da");
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", str, "Ok", "");
return 1;
}


Hmmm using this much string for this "Da da da" ? Even 15 would be a good to go.

Nope, both still give out "Unknown Command", and the dialog doesn't show up.

CMD:test(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", "Da da da", "OK", "");
return true;
}

CMD:test2(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", "Da da da", "OK", "");
return CMD_SUCCESS;
}

Update: I just made a new GameMode, with just those 2 commands and the OnDialogResponse callback, and it works. Does that mean that I have something on my current script that interferes with the command? I have no idea of what could it be.

Yes, there is something wrong in your gamemode.

Cepillado
30/12/2015, 08:45 AM
Try this one in your current script i think this code will work

CMD:test(playerid, params[])
{
new str[1000];
format(str, sizeof(str), "Da da da");
ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Test Dialog", str, "Ok", "");
return 1;
}


Same deal, Unknown Command. I'm guessing the issue is with another command (even though I only have about 3 more) or the place in which the command is placed, as I said already, in a clean script it works perfectly (despite the fact that I literally copied it)

And, as Karan007 said, 1000 cells are quite a lot for that string.

ProDude
30/12/2015, 12:46 PM
did you Compiled your script?

Bennyy
30/12/2015, 10:35 PM
Replace your command and add this
ShowPlayerDialog(playerid,143,DIALOG_STYLE_LIST,"Testing"");