impossible problem?
#1

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

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

edited
Reply
#4

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

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

thanks
Reply
#6

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

thanks
to make it easily readable
Reply
#7

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;
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)