SA-MP Forums Archive
Dialog Response getting error (Invalid expression assumed 0) - 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 Response getting error (Invalid expression assumed 0) (/showthread.php?tid=153963)



Dialog Response getting error (Invalid expression assumed 0) - Qeux - 11.06.2010

Code:
if(dialogid == 22 && response)
	{
		new cashdeposit = strval(inputtext[]);
		new droppername[MAX_PLAYER_NAME];
		GetPlayerName(playerid, droppername, sizeof(droppername));

		if(cashdeposit <= 0)
		{
			return 1;
		}
		
		if(cashdeposit > PlayerInfo[playerid][pPot])
		{
			ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "House Safes by:Qeux", "You Don't have that much Pot with you", "Done", "Close");
			return 1;
		}
		PlayerInfo[playerid][pPot] -= cashdeposit;
		PlayerInfo[playerid][pSafePot] += cashdeposit;
		format(string, sizeof(string), "%s places some drugs in a safe.", droppername);
		ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "House Safes by:Qeux", string, "Done", "Close");
		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		printf("%s", string);
		return 1;
	}
this is basically for someone placing drugs into their safe... i'm getting an error on this part
Code:
new cashdeposit = strval(inputtext[]);
do you see why this would be an invalid expression.. i'm guessing because i don't fully understand inputtext[]... basically they are entering a multiple digit number and i want that number toe be equal to cashdeposit so i can withdraw and deposit stuff...



Re: Dialog Response getting error (Invalid expression assumed 0) - DJDhan - 11.06.2010

Code:
new cashdeposit = strval(inputtext);



Re: Dialog Response getting error (Invalid expression assumed 0) - Qeux - 11.06.2010

fucking genius... and within 4 minutes also


Re: Dialog Response getting error (Invalid expression assumed 0) - Jakku - 11.06.2010

pawn Code:
new cashdeposit = strval(inputtext[]); //For a text
new cashdeposit = strval(inputtext); //For a value
And, I think he's not a fucking genius, just a genius xD


Re: Dialog Response getting error (Invalid expression assumed 0) - DJDhan - 11.06.2010

Quote:
Originally Posted by Qeux
fucking genius... and within 4 minutes also
Quote:
Originally Posted by Jakku
pawn Code:
new cashdeposit = strval(inputtext[]); //For a text
new cashdeposit = strval(inputtext); //For a value
And, I think he's not a fucking genius, just a genius xD
Lol glad to help.

Btw, inputtext is itself a string isn't it? If you want to use the string, you don't use strval at all.


Re: Dialog Response getting error (Invalid expression assumed 0) - Jakku - 11.06.2010

Inputtext[] is a string. It will output the thing you write to the dialog and press OK- button.