SA-MP Forums Archive
Gui menu problem. - 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: Gui menu problem. (/showthread.php?tid=132752)



Gui menu problem. - Razvann - 09.03.2010

I have this code:
pawn Код:
if(response)
{
if(dialogid == 90000)
{
if(strlen(inputtext))
{
if(inputtext > PlayerInfo[playerid][pAccount])
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have that money in your account!");
return 1;
}
ConsumingMoney[playerid] = 1;
GivePlayerCash(playerid,inputtext);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-inputtext;
}
}
}
It's a bank dialog system, when someone types /withdraw will appear this, but I have this errors, too:

pawn Код:
error 033: array must be indexed (variable "inputtext") x2
error 035: argument type mismatch (argument 2)



Re: Gui menu problem. - Razvann - 10.03.2010

bump


Re: Gui menu problem. - Joe_ - 10.03.2010

Never had this problem.

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(response && dialogid == 90000)
  {
     if(strlen(inputtext))
   	 {
       new v;
       v = strval(inputtext);
       if(v > PlayerInfo[playerid][pAccount])
       {
    	       return SendClientMessage(playerid, color, "You don't have that money in your account");
       }
       ConsumingMoney[playerid] = 1;
       GivePlayerCash(playerid, v);
       PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] - v;
  	 }
	 SendClientMessage(playerid, color, "Whatever"); // If the player doesn't put anything in the box return this message
  }
  return 1;
}
Not tested.



Re: Gui menu problem. - Deat_Itself - 10.03.2010

on which line the bug is and show me your "ShowPlayerDialog"


Re: Gui menu problem. - Razvann - 10.03.2010

Works, but I don't receive the money.


Re: Gui menu problem. - Joe_ - 10.03.2010

If it works, then good, if not:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(response && dialogid == 90000)
	{
 		if(strlen(inputtext))
   	{
      new v;
      v = strval(inputtext);
      if(v <= PlayerInfo[playerid][pAccount])
      {
	      ConsumingMoney[playerid] = 1;
	      GivePlayerCash(playerid, v);
	      PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] - v;
	      return 1;
      }
      else { SendClientMessage(playerid, color, "You don't have that money in your account"); }
  		}
		SendClientMessage(playerid, color, "Whatever"); // If the player doesn't put anything in the box return this message
	}
	return 1;
}
Forums ruin the indentation, sorry

GivePlayerCash is not the SA-MP Native way to give the player cash, try GivePlayerMoney?

If you're using the server-sided money from other scripts, make sure that the script works, but you could try GivePlayerMoney, if that works, then try GivePlayerCash, if that doesn't work, then it's the GivePlayerCash function, if GivePlayerMoney doesn't work, tell me.


Re: Gui menu problem. - Razvann - 10.03.2010

Quote:
Originally Posted by Joe_
If it works, then good, if not:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(response && dialogid == 90000)
	{
 		if(strlen(inputtext))
   	{
      new v;
      v = strval(inputtext);
      if(v <= PlayerInfo[playerid][pAccount])
      {
	      ConsumingMoney[playerid] = 1;
	      GivePlayerCash(playerid, v);
	      PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] - v;
	      return 1;
      }
      else { SendClientMessage(playerid, color, "You don't have that money in your account"); }
  		}
		SendClientMessage(playerid, color, "Whatever"); // If the player doesn't put anything in the box return this message
	}
	return 1;
}
Forums ruin the indentation, sorry

GivePlayerCash is not the SA-MP Native way to give the player cash, try GivePlayerMoney?
No, GivePlayerCash it's from the antihack, and it works fine..it's same
I have another dialog(login & register),and if I click cancel it Kick's me.
Here's my whole OnDialogResponse:
http://pastebin.com/hcUpAd7g


Re: Gui menu problem. - Joe_ - 10.03.2010

Hmmm, then I'm not sure..

Let me go test this on my server.


Re: Gui menu problem. - Razvann - 10.03.2010

Fixed, with one problem...


Re: Gui menu problem. - Joe_ - 10.03.2010

Lol ok, hope I helped