SA-MP Forums Archive
impossible problem? - 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: impossible problem? (/showthread.php?tid=287111)



impossible problem? - rt-2 - 01.10.2011

Hello,
here's my code,
Код:
//car dealership
	if(dialogid == 2041)//receive money amount
	{
		if(!response)//if cancel, cancel
	    {
			return 1;
	    }
	    printf("%i",strval(inputtext));
	    if(strval(inputtext) < 1000 || strval(inputtext) > 10000000)
	    {
	    	//not valid number
	    	ShowPlayerDialog(playerid,2041,DIALOG_STYLE_INPUT,"Vehicle Ownership","To sell this vehicle,\nplease enter a valid amount of money(1000-10000000)","Ok","Cancel");
	    }
	    //give confirm
	    
	    
	    //format(message,sizeof(message),"Vehicle informations.\n\n\tLicense plate: %i\n\tModel: %s\n\tPrice: %i\n\nAre you sure you want to sell this vehicle?",GetPlayerVehicleID(playerid)+1000,VehiclesName[GetVehicleModel(GetPlayerVehicleID(playerid))+400],strval(inputtext));

	    //ShowPlayerDialog(playerid,2042,DIALOG_STYLE_MSGBOX,"Vehicle Dealership","teat","Yes","Back");
		ShowPlayerDialog(playerid,2042,DIALOG_STYLE_MSGBOX,"Vehicle Dealership","teat","Yes","Back");

	    return 1;

	}
so when i enter the number 1 or every other not working numbers,,, the printf tells me the good number, but the "if" doesn't do his job, he always think it's between 1000 and 10000000...

I don't understand how it is possible

thansks


Re: impossible problem? - Dripac - 01.10.2011

I can't understand, can you please write this in english?


Re: impossible problem? - rt-2 - 01.10.2011

edited


Re: impossible problem? - Vince - 01.10.2011

You need to exit the command if the player types a wrong number, i.e. add a return after your ShowPlayerDialog line. And while I'm at it, here's a little trick:

pawn Код:
if(!(1000 <= strval(inputtext) <= 10_000_000))



Re: impossible problem? - rt-2 - 01.10.2011

you used the underlines in your 10 million, can you explain why?

thanks


AW: Re: impossible problem? - Nero_3D - 02.10.2011

Quote:
Originally Posted by blinkpnk
Посмотреть сообщение
you used the underlines in your 10 million, can you explain why?

thanks
to make it easily readable


Re: impossible problem? - rt-2 - 11.10.2011

Resolved, forgot to put the "return 1;" at the end of my if,, so the first

Код:
//not valid number
ShowPlayerDialog(playerid,2041,DIALOG_STYLE_INPUT,"Vehicle Ownership","To sell this vehicle,\nplease enter a valid amount of money(1000-10000000)","Ok","Cancel");
was some kind of onverwrited by the
Код:
ShowPlayerDialog(playerid,2042,DIALOG_STYLE_MSGBOX,"Vehicle Dealership","teat","Yes","Back");
return 1;