SA-MP Forums Archive
Halp (OnDialogResponse) - 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: Halp (OnDialogResponse) (/showthread.php?tid=566238)



Halp (OnDialogResponse) - MafiaOink - 04.03.2015

Guys I want to check if the inputtext on the dialog is correct as the textdraw 4 one, The textdraw4 is clean it has nothing instead of normal text e.g "hey"
So I want to check if the inputtext is same as the textdraw 4 one since textdraw 4 text changes too

Код:
if (!strcmp(inputtext, Textdraw4[playerid], true))
// I have this as the code

Код:
C:\Users\noturbiz\Desktop\TestSVR\filterscripts\mmmm.pwn(171) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
//Errors


Re: Halp (OnDialogResponse) - CalvinC - 04.03.2015

Strcmp is used to compare 2 strings, "Textdraw4[playerid]" isn't a string, just use the same characters as what is on the textdraw instead.


AW: Halp (OnDialogResponse) - Kaliber - 04.03.2015

In TextDraw4[playerid], is the id of the TextDraw, not the text

You must safe the text in a variable to check this

Greekz


Re: Halp (OnDialogResponse) - MafiaOink - 04.03.2015

How shall I save it in a var?
Please tell..
P.S
I already told it is changing.!


Re: Halp (OnDialogResponse) - CalvinC - 04.03.2015

You can't save it to a variable, you need to create an array where you store the characters in.
If you're using TextDrawSetString, you can just store the same result in the array as in the textdraw.
First, declare an array.
pawn Код:
new MyArray[4]; // Declares the array with a size of 4
I've set the size to 4 since we only store "H", "E", "Y" and the null symbol, change it if you want more characters.

So in your function where you change the textdraw, you can do something like this:
pawn Код:
format(MyArray, sizeof(MyArray), "Hey"); // We format the array, so it now contains "Hey"
TextDrawSetString(TextdrawID, MyArray); // Sets the string of the textdraw to the same
And then finally check if the inputtext matches with MyArray in the OnDialogResponse.
pawn Код:
if(!strcmp(inputtext, MyArray, true)) // Checks if the inputtext matches what MyArray contains