0.3 menu
#1

i wanted to make a nice menu, but now it wont work.

Код:
if (strcmp("/wmenu", cmdtext, true, 10) == 0)
{
	ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "menu", "Enter\nBuy Points\nInformation", "Select", "Exit");// first i do select on the "Buy Points"
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new Quantity = strval(inputtext);
	new CurrMoney = GetPlayerMoney(playerid);
	gCheckout[playerid]= Quantity*Cost;
	
	if(dialogid == DIALOGID)
	{
		if(response)
		{
			if(listitem == 0) 	
			{
				SendClientMessage(playerid,COLOR_BLUE,"some message here");
			}				
			if(listitem == 1) 			{
				ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_INPUT, "Points", "", "Select", "Cancel");// then i put a number in the inputbox and do "select"
			}

		}
		return 1;
	}

	if(dialogid == DIALOGID+1)
	{
	new s[128];
	format(s,sizeof(s),"Points: %i\n\nCost: %i$",Quantity,gCheckout[playerid]);
	ShowPlayerDialog(playerid, DIALOGID+3,0,"lolzzzz",s,"Buy","Cancel");                //then i do buy
	}
	else if(dialogid == DIALOGID+3 && CurrMoney >= gCheckout[playerid]) 
	{
  new PointsStringbought[128];
	format(PointsStringbought,sizeof(PointsStringbought),"You have bought %i Points for $%i",PointsQuantity,gCheckout[playerid]);
	GivePlayerMoney(playerid,-gCheckout[playerid]);
 	return 1;
  }
  else if(dialogid == DIALOGID+3 && CurrMoney <= gCheckout[playerid])
  {
	  SendClientMessage(playerid,COLOR_BLUE,"You do not have enough money.");
		return 1;
	 	}
	return 0;
 }
It will go to DIALOG+3 with the BUY button, but it wont get any money off, or send me messages. how can i fix this?
Reply
#2

BUMP
Reply
#3

Quote:
Originally Posted by thuron
if (strcmp("/wmenu", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "menu", "Enter\nBuy Points\nInformation", "Select", "Exit");// first i do select on the "Buy Points"
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
....

if(dialogid == DIALOGID)
...
Why won't you use simple integers for dialogid?
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "menu", "Enter\nBuy Points\nInformation", "Select", "Exit");// first i do select on the "Buy Points"

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
....

if(dialogid == 1)
Reply
#4

i dont think that will solve my problem...
Reply
#5

hmm, is anyone able to make a good tutorial about creating menu's in 0.3?? i have seen 1, but that was a menu with only 2 levels ( with 2 levels i mean that you click on select somewhere, and the click somewhere and something happens like a teleport. i need like 3 levels: Main->InputBox->totalcost + buy button. but it wont work)
Reply
#6

Quote:
Originally Posted by thuron
hmm, is anyone able to make a good tutorial about creating menu's in 0.3?? i have seen 1, but that was a menu with only 2 levels ( with 2 levels i mean that you click on select somewhere, and the click somewhere and something happens like a teleport. i need like 3 levels: Main->InputBox->totalcost + buy button. but it wont work)
I don't see how you could do 2 levels, and then not 3.

pawn Код:
switch(dialogid)
{
  case 1:
  {
    if(!response)return 1;
    ShowPlayerDialog(playerid,2,.......);
  }
  case 2:
  {
    if(!response)ShowPlayerDialog(playerid,1,......);
    ShowPlayerDialog(playerid,3,.......);
  }
  case 3:
  {
    if(!response)ShowPlayerDialog(playerid,2,.......);
    SendClientMessage(playerid,0xFF0000FF,"LULULULULUL");
  }
}
Reply
#7

Quote:
Originally Posted by SiJ
Quote:
Originally Posted by thuron
if (strcmp("/wmenu", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "menu", "Enter\nBuy Points\nInformation", "Select", "Exit");// first i do select on the "Buy Points"
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
....

if(dialogid == DIALOGID)
...
Why won't you use simple integers for dialogid?
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "menu", "Enter\nBuy Points\nInformation", "Select", "Exit");// first i do select on the "Buy Points"

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
....

if(dialogid == 1)
this is why (it's a link, click it)
Reply
#8

yea, but it wont work. here is the script where it goes to the 3rd level:

Код:
	if(dialogid == DIALOGID+1) // points
	{
	new s[128];
	format(s,sizeof(s),"Points: %i\n\nCost: %i$",PointsQuantity,gCheckout[playerid]);
	ShowPlayerDialog(playerid, DIALOGID+3,0,"Points",s,"Buy","Back");               //goes to 3 here
	}
	else if(dialogid == DIALOGID+2) // info
	{
	return 1;
 }
	else if(dialogid == DIALOGID+3 && CurrMoney >= gCheckout[playerid]) // Buy points
	{
       new PointsStringbought[128];
	format(PointsStringbought,sizeof(PointsStringbought),"You have bought %i Points for $%i",PointsQuantity,gCheckout[playerid]);
	GivePlayerMoney(playerid,-gCheckout[playerid]);
 	PInfo[playerid][Points] = PInfo[playerid][Points]+PointsQuantity;
 	ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "TITLE", "Enter\nBuy Points\n Information", "Select", "Cancel");
 	return 1;
  }
i think there should be a better and more organisable way to do this?
Reply
#9

Quote:
Originally Posted by Daren_Jacobson
Quote:
Originally Posted by SiJ
Quote:
Originally Posted by thuron
if (strcmp("/wmenu", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "menu", "Enter\nBuy Points\nInformation", "Select", "Exit");// first i do select on the "Buy Points"
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
....

if(dialogid == DIALOGID)
...
Why won't you use simple integers for dialogid?
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "menu", "Enter\nBuy Points\nInformation", "Select", "Exit");// first i do select on the "Buy Points"

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
....

if(dialogid == 1)
this is why (it's a link, click it)
Hmm, an other number?... omg why isnt there a good tut or something that tells how to make these 0.3 menus.....
Reply
#10

well, you don't have it showing the string you format, and if that doesn't work, i will post my big thing on structured programming, to make it more organizable.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)