SA-MP Forums Archive
Dialog Problems - 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 Problems (/showthread.php?tid=105261)



Dialog Problems - Master_FM - 28.10.2009

Hi,

why i can not make like this on my ondialogresponse?

GivePlayerMoney -= inputtext;

It wants every time that i should index my inputtext. How i can change this and clear the error?


Re: Dialog Problems - MenaceX^ - 28.10.2009

What error?
And inputtext is a string, so you need to do strval(inputtext).


Re: Dialog Problems - LordShigi - 28.10.2009

Maybe if you put GivePlayerMoney(playerid, inputtext);?!?!?!?1


Re: Dialog Problems - Streetplaya - 28.10.2009

I suppose you would have to do something like this:

pawn Код:
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - strval(inputtext));
Note: in order to have this working, inputtext has to be numeric only, so no dollar etc.


Re: Dialog Problems - BMUK - 28.10.2009

And... you can check that it's numeric in the response call back to save any problems

pawn Код:
if(!IsNumeric(inputtext)) return SendClientMessage(playerid,COLOR_RED,"You must write numbers. Not letters");

pawn Код:
stock IsNumeric(const string[])
{
  for (new i = 0, j = strlen(string); i < j; i++)
  {
    if (string[i] > '9' || string[i] < '0')
    {
      return 0;
    }
  }
  return 1;
}