16.03.2011, 22:39
(
Последний раз редактировалось JackYack13; 17.03.2011 в 16:06.
)
Let's say I have the following code:
As you can see, I'm trying to make a dialog with the commands and make it so that if the player selects the command and clicks the "Use" button then the command will be performed. But this code doesn't work as nothing happens when I click "Use" in the dialog box. I think that this line is the problem:
I also tried putting "/" in front of every command in the array but still no good. Any suggestions what I should do?
pawn Код:
new Commands[][] = {"hi", "kickme", "cmd"};
CMD:hi(playerid, params[])
{
SendClientMessage(playerid, COLOR_WHITE, "Hi!");
return 1;
}
CMD:kickme(playerid, params[])
{
Kick(playerid);
return 1;
}
CMD:cmd(playerid, params[])
{
new CmdList[256];
strcat(CmdList, "/hi - sends you a 'Hi!' message\n");
strcat(CmdList, "/kickme - kick yourself\n");
strcat(CmdList, "/cmd - show this message");
ShowPlayerDialog(playerid, 300, DIALOG_STYLE_LIST, "Commands:", CmdList, "Use", "Close");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
if (dialogid == 300){
if(response){
OnPlayerCommandReceived(playerid, Commands[listitem]);
}
return 1;
}
return 0;
}
pawn Код:
OnPlayerCommandReceived(playerid, Commands[listitem]);