SA-MP Forums Archive
PROBLEM WITH DIALOG_STYLE_INPUT - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PROBLEM WITH DIALOG_STYLE_INPUT (/showthread.php?tid=663634)



PROBLEM WITH DIALOG_STYLE_INPUT - jullyus - 07.02.2019

Код:
if(dialogid==MENUCARROS2){

				if(response==1){
					new num;
                                        new string[5];
                                        format(string,sizeof(string),"%d",inputtext);
  					num=strval(string);
						if(num  == strval(string)){
   							GetPlayerPos(playerid,x,y,z);
							CreateVehicle(num, x+2,y+2,z, 0, 0, 0, 6000);
}
}
}
I've got the next problem, i want know їWhy dont works this code IN THE TOP? and this code does works ON THE DOWN .

Код:
if(dialogid==MENUCARROS2){

				if(response==1){
					new num;
                                                                  
  					num=strval(inputtext);
						if(num  == strval(inputtext)){
   							GetPlayerPos(playerid,x,y,z);
							CreateVehicle(num, x+2,y+2,z, 0, 0, 0, 6000);
}
}
}



Re: PROBLEM WITH DIALOG_STYLE_INPUT - Kaliber - 07.02.2019

What are you trying to check there?

Actually you check
PHP код:
if == 



Re: PROBLEM WITH DIALOG_STYLE_INPUT - jullyus - 07.02.2019

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
What are you trying to check there?

Actually you check
PHP код:
if == 
Hey, i'm new in the world of the pawn language, just i need that you answer me the problem that i present.


The conclusion that i think is the 'format' just take variables and inputtext not is a variable.

Correct me please, if i'm wrong.


Re: PROBLEM WITH DIALOG_STYLE_INPUT - Kaliber - 07.02.2019

Both are Variables.

Actually Array Variables, that are used in that case for string storing.

Here is a good Tutorial for you: https://sampforum.blast.hk/showthread.php?tid=654471

With strval you convert that string to an integer.

And format with %d tries to interpret the Variable like an Integer.

So if you pass an A it gets to 65, because ASCII Values are taken.

So in that case you should directly use strval(inputtext), to get the integer values (if that is your target).

I dont know why the first one is not working, you can check that easily out.

Just make:

PHP код:
printf("%d == %d",num,strval(string)); 
Before the if.

Then you know, what the exact values are and why it is not working


Re: PROBLEM WITH DIALOG_STYLE_INPUT - Banditul18 - 07.02.2019

PHP код:
new string[5];
format(string,sizeof(string),"%d",inputtext); 
This doesnt work cus inputtext is string yet you try to format it using integer format

PHP код:
new string[5];
 
format(string,sizeof(string),"%s",inputtext); 



Re: PROBLEM WITH DIALOG_STYLE_INPUT - jullyus - 07.02.2019

thank you mate ♥♥♥♥♥♥!


Re: PROBLEM WITH DIALOG_STYLE_INPUT - TheToretto - 07.02.2019

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
What are you trying to check there?

Actually you check
PHP код:
if == 
You forgot a colon.

Oh sorry I thought you were coding in python.

You need brackets in an if statement in pawn lang, don't make him grasp wrong stuff.


Re: PROBLEM WITH DIALOG_STYLE_INPUT - Kaliber - 07.02.2019

Its obviously nothing, but Pseudo-Code.