SA-MP Forums Archive
Dialog - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog (/showthread.php?tid=165835)



Dialog - Typhome - 06.08.2010

Код:
if(dialogid == DIALOOG_REG_KODAKONDSUS)
    {
		if(response)
		{
			new tmp[256];
			new idx;
	    	tmp = strtok(inputtext, idx);
		    if((strcmp("Los Santos", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("los santos")))
		    {
		        RegistreerimineEtapp[playerid] = 3;
		        PlayerInfo[playerid][pOrigin] = 1;
		        PlayerInfo[playerid][pReg] = 1;
		        ShowPlayerDialog(playerid, DIALOOG_REG_ALUSTAMINE, DIALOG_STYLE_MSGBOX, "Registreerimisesьsteem - (Alustamine)", " Tдnan registreerimast. \n Kas te soovite alustada lugemist хpetuse? Oleks parem, kui sa seda loeksid. (Siis kui oled algaja) \n", "Edasi", "Loobu");
			}
			else if((strcmp("San Fierro", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("san fierro")))
		    {
		        RegistreerimineEtapp[playerid] = 3;
		        PlayerInfo[playerid][pOrigin] = 2;
		        PlayerInfo[playerid][pReg] = 1;
		        ShowPlayerDialog(playerid, DIALOOG_REG_ALUSTAMINE, DIALOG_STYLE_MSGBOX, "Registreerimisesьsteem - (Alustamine)", " Tдnan registreerimast. \n Kas te soovite alustada lugemist хpetuse? Oleks parem, kui sa seda loeksid. (Siis kui oled algaja) \n", "Edasi", "Loobu");
			}
			else if((strcmp("Los Santos", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("los santos")))
		    {
		        RegistreerimineEtapp[playerid] = 3;
		        PlayerInfo[playerid][pOrigin] = 3;
		        PlayerInfo[playerid][pReg] = 1;
		        ShowPlayerDialog(playerid, DIALOOG_REG_ALUSTAMINE, DIALOG_STYLE_MSGBOX, "Registreerimisesьsteem - (Alustamine)", " Tдnan registreerimast. \n Kas te soovite alustada lugemist хpetuse? Oleks parem, kui sa seda loeksid. (Siis kui oled algaja) \n", "Edasi", "Loobu");
			}
			else
			{
			    ShowPlayerDialog(playerid, DIALOOG_REG_KODAKONDSUS, DIALOG_STYLE_INPUT, "Registreerimisesьsteem - (Kodakondsus)", "Milline kodakondsus on sinu karakter? (Los Santos / San Fierro / Las Venturas)", "Siseta", "");
   			}
		}
		else
		{
		    ShowPlayerDialog(playerid, DIALOOG_REG_KODAKONDSUS, DIALOG_STYLE_INPUT, "Registreerimisesьsteem - (Kodakondsus)", "Milline kodakondsus on sinu karakter? (Los Santos / San Fierro / Las Venturas)", "Siseta", "");
		}
    }
Код:
new tmp[256];
			new idx;
	    	tmp = strtok(inputtext, idx);
		    if((strcmp("Los Santos", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("los santos")))
		    {
I type input: Los Santos, and it shows again that same dialog. I tryed too: San Fierro, Las Venturas, still same problem.

What problem? :S


Re: Dialog - Typhome - 06.08.2010

help


Re: Dialog - Hiddos - 06.08.2010

strtok puts everything in the 'tmp' between a space and another, so the value in 'tmp' is just 'Los', not "Los Santos"


Re: Dialog - Typhome - 06.08.2010

How i do then it? Los Santos, San Fierro, Las Venturas and los santos, san fierro, las venturas... etc


Re: Dialog - Hiddos - 06.08.2010

Could try:

pawn Код:
format(tmp, sizeof tmp, "%s %s", strtok(inputtext, idx), strtok(inputtext, idx));
Might work, I'm unsure.


Re: Dialog - Typhome - 06.08.2010

How system will read, is she/he did typed los santos, san fierro or las venturas?


Re: Dialog - Hiddos - 06.08.2010

pawn Код:
if(!strcmp(tmp, "Los Santos"))
{
  //Do shit
}
else if(!strcmp(tmp, "San Fierro"))
{
  //Do shit
}
else if(!strcmp(tmp, "Las Venturas"))
{
  //Do shit
}



Re: Dialog - Typhome - 06.08.2010

Код:
if(dialogid == DIALOOG_REG_KODAKONDSUS)
    {
		if(response)
		{
			new tmp[256];
			new idx;
	    	tmp = strtok(inputtext, idx);
if(!strcmp(tmp, "Los Santos"))
{
  //Do shit
}
else if(!strcmp(tmp, "San Fierro"))
{
  //Do shit
}
else if(!strcmp(tmp, "Las Venturas"))
{
  //Do shit
}
}
else
{
// exit
}
}
or wat?


Re: Dialog - Hiddos - 06.08.2010

Just the code you have now,

but instead of

'tmp = strtok(cmdtext, idx);'

you do

'format(tmp, sizeof tmp, "%s %s", strtok(inputtext, idx), strtok(inputtext, idx));'


Re: Dialog - Typhome - 06.08.2010

Tested, it doens't work. Shows again dialog, when i type "Los Santos"