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



OnDialogResponse - maksicnm - 23.10.2017

What is wrong with this code?
Код HTML:
	else if( dialogid == DIALOG_DAJSVIMA_NOVAC )
	{
	    if( !response ) return true;
	    if( response )
	    {
	        if((inputtext < 1) || (inputtext > 500000)) return SendClientMessage(playerid,0xFFFFFFFF,"Cifra ne sme biti manja od 5000$, ili vec od 500000$!");
			{
			    kolicina = inputtext;
			    foreach( Player, i )
				{
	        		if( i != INVALID_PLAYER_ID && PlayerLogged[ i ] != false )
					{
	            		DajIgracuNovac( i, kolicina );
	    				format( globalstring, sizeof( globalstring ), ""col_athlone"|:.Black Storm:.| "col_white" Vlasnik %s je nagradio sve igrace sa:  %d$.", ImeIgraca( playerid ), kolicina );
	    				SCMA( -1, globalstring );
					}
				}
			}
		}
	}
ERROR:
Код HTML:
error 033: array must be indexed (variable "inputtext")
error 017: undefined symbol "kolicina"
warning 215: expression has no effect
error 017: undefined symbol "kolicina"
error 017: undefined symbol "kolicina"

Its DSI Give money to all...


Re: OnDialogResponse - Kane - 23.10.2017

inputtext is a string. You need to turn it into an integer.

https://sampwiki.blast.hk/wiki/Strval

Example:
PHP код:
new string[4] = "250";
new 
iValue strval(string); // iValue is now '250' 



Re: OnDialogResponse - maksicnm - 23.10.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
inputtext is a string. You need to turn it into an integer.

https://sampwiki.blast.hk/wiki/Strval

Example:
PHP код:
new string[4] = "250";
new 
iValue strval(string); // iValue is now '250' 
Can you give me code for this up? xd


Re: OnDialogResponse - Kane - 23.10.2017

PHP код:
if(response)
{
     new 
amount;
     
amount strval(inputtext);
     if(
amount || amount 2)
     {
          return;
     }

Basically.


Re: OnDialogResponse - maksicnm - 23.10.2017

Thanks, i'll compile mod to test


EDIT:
btw you learned me how to use strval, master