Dialog Problems
#1

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)