Dialog input problem
#1

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
Reply
#2

Код:
strcat(params,inputtext);
what is this, though?

PHP код:
if(inputtext[playerid] == params
Reply
#3

Lol idk, i think i take this from my old /give command
Reply
#4

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)
Reply
#5

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.
Reply
#6

But how to check a name of Item type to inputtext? or what i should write in inputtext[playerid] == THERE
Reply
#7

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.
Reply
#8

Okey, i got this

Thanks very much for help, love you <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)