Dialog input problem -
makaronek123 - 23.03.2017
Hi, i want create dialog style input where i can type name of Item and destroy it, i make this:
Код:
if(strcmp("/destroy", cmdtext, true) == 0)
{
if(gTeam[playerid] == TEAM_XX)
{
SendClientMessage(playerid, COLOR_RED, "You cant use this command as Zombie");
return 1;
}
ShowPlayerDialog(playerid,67,DIALOG_STYLE_INPUT,"Destroy","Item Name\n Item name:","Destroy","Quit");
}
Response:
Код:
if(dialogid==67){
new params[64];
strcat(params,inputtext[6]);
if(response){
if(inputtext[playerid] == params) {
if(!PlayerHasItem(playerid,params))return SendClientMessage(playerid,-1,"You dont have this item!");
RemoveItem(playerid,params,1);
}
return 1;
}
return 0;
}
And i get:
Код:
error 033: array must be indexed (variable "params")
What i must change? maybe i do a mistake, idk
Re: Dialog input problem -
Toroi - 23.03.2017
Код:
strcat(params,inputtext);
what is this, though?
PHP код:
if(inputtext[playerid] == params)
Re: Dialog input problem -
makaronek123 - 23.03.2017
Lol idk, i think i take this from my old /give command
Re: Dialog input problem -
Jihanz - 23.03.2017
Quote:
Originally Posted by Troydere
Код:
strcat(params,inputtext);
what is this, though?
PHP код:
if(inputtext[playerid] == params)
|
I like you Helping people
REP+ for you from me (Y)
Re: Dialog input problem -
Toroi - 23.03.2017
Quote:
Originally Posted by makaronek123
Lol idk, i think i take this from my old /give command
|
Well, it has no solid reason to be there, so you should consider to remove that statement.
In addition:
- You may want to check if the inputtext is empty and return the same dialog.
- There is no need for
strcat or a new string to be there as you have
inputtext for that, hence, instead of
params you should directly use
inputtext and remove both the
params declaration and the
strcat function.
Re: Dialog input problem -
makaronek123 - 23.03.2017
But how to check a name of Item type to inputtext? or what i should write in inputtext[playerid] == THERE
Re: Dialog input problem -
Toroi - 23.03.2017
I'm pretty sure your
PlayerHasItem(playerid,item) function will handle that.
If the player type '
asdfsda' in the box, it'll return the following:
PHP код:
SendClientMessage(playerid,-1,"You dont have this item!");
Unless the player write an item name, that function wont execute so rest assured. You don't need these checks.
Re: Dialog input problem -
makaronek123 - 23.03.2017
Okey, i got this
Thanks very much for help, love you <3