Having a problem getting this dialog to compile (Help please)
#1

Any help will be appreciated.

Script:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
		if (dialogid == 1 && response)
	{
	    switch(listitem)
	    {
	        case 0:
			{
			    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Pizza stack menu", "Burger and fries ($10)\nOne slice of pepperoni pizza($5)\nTwo slices of pepperoni pizza ($10)\nOne whole pepperoni pizza ($20)", "Buy", "Exit");
			}
		}
	}
		if (dialogid == 1 && response)
		{
	    switch(listitem)
	 	{
			case 0:
			{
			if(GetPlayerHealth(playerid) > 100) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
			else if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for burger and fries.");
			SetPlayerHealth(playerid, 50);
			GivePlayerMoney(playerid, -10);
			SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your burger and fries!");
			}
			case 1:
			{
			if(GetPlayerHealth(playerid) > 100) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
			else if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for a slice of pizza.");
			SetPlayerHealth(playerid, 25);
			GivePlayerMoney(playerid, -5);
			SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
			}
			case 2:
			{
			if(GetPlayerHealth(playerid) > 100) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
			else if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for two slices of pizza.");
			SetPlayerHealth(playerid, 50);
			GivePlayerMoney(playerid, -10);
			SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
			}
			case 3:
			{
			if(GetPlayerHealth(playerid) > 100) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
			else if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for a whole pizza.");
			SetPlayerHealth(playerid, 100);
			GivePlayerMoney(playerid, -20);
			SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
			}
		}
	}
		return 1;
}
Warnings:

Код:
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(242) : warning 202: number of arguments does not match definition
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(250) : warning 202: number of arguments does not match definition
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(258) : warning 202: number of arguments does not match definition
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(266) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
Reply
#2

I love error lines That was because you din't show witch lines they are LOl thats why I was sarcastic!
Reply
#3

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
I love error lines
I hate them.
Reply
#4

pawn Код:
new Float:health;

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1 && response)
    {
        switch(listitem)
        {
            case 0:
            {
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Pizza stack menu", "Burger and fries ($10)\nOne slice of pepperoni pizza($5)\nTwo slices of pepperoni pizza ($10)\nOne whole pepperoni pizza ($20)", "Buy", "Exit");
            }
        }
    }
if (dialogid == 1 && response)
    {
        switch(listitem)
        {
            case 0:
            {
                GetPlayerHealth(playerid,health);
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for burger and fries.");
                SetPlayerHealth(playerid, 50);
                GivePlayerMoney(playerid, -10);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your burger and fries!");
            }
            case 1:
            {
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for a slice of pizza.");
                SetPlayerHealth(playerid, 25);
                GivePlayerMoney(playerid, -5);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
            }
            case 2:
            {
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for two slices of pizza.");
                SetPlayerHealth(playerid, 50);
                GivePlayerMoney(playerid, -10);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
            }
            case 3:
            {
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for a whole pizza.");
                SetPlayerHealth(playerid, 100);
                GivePlayerMoney(playerid, -20);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
            }
        }
    }
Reply
#5

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
pawn Код:
new Float:health;

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1 && response)
    {
        switch(listitem)
        {
            case 0:
            {
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Pizza stack menu", "Burger and fries ($10)\nOne slice of pepperoni pizza($5)\nTwo slices of pepperoni pizza ($10)\nOne whole pepperoni pizza ($20)", "Buy", "Exit");
            }
        }
    }
if (dialogid == 1 && response)
    {
        switch(listitem)
        {
            case 0:
            {
                GetPlayerHealth(playerid,health);
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for burger and fries.");
                SetPlayerHealth(playerid, 50);
                GivePlayerMoney(playerid, -10);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your burger and fries!");
            }
            case 1:
            {
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for a slice of pizza.");
                SetPlayerHealth(playerid, 25);
                GivePlayerMoney(playerid, -5);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
            }
            case 2:
            {
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for two slices of pizza.");
                SetPlayerHealth(playerid, 50);
                GivePlayerMoney(playerid, -10);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
            }
            case 3:
            {
                if(health > 99.9) return SendClientMessage(playerid, 0xAA3333AA, "ERROR: You don't seem to be hungry (Your HP is full).");
                else if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, 0xAA3333AA, "Worker: You don't have enough money for a whole pizza.");
                SetPlayerHealth(playerid, 100);
                GivePlayerMoney(playerid, -20);
                SendClientMessage(playerid, 0xFFFF00AA, "Worker: Enjoy your pizza!");
            }
        }
    }
Thanks but still no luck.

20 errors:

Код:
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(246) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(246) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(249) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(251) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(253) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(259) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(261) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(263) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(265) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(266) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(271) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(273) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(274) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(279) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(281) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(282) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(287) : error 010: invalid function or declaration
C:\Users\Lee\Desktop\SA-MP scripting\gamemodes\foodmenu.pwn(289) : error 010: invalid function or declaration
Reply
#6

I went without warnings etc!

Show line 246!
Reply
#7

Lol, well didn't work out for me:

Quote:

new Float:health;

Reply
#8

LOl put it at the top of the script
Reply
#9

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
LOl put it at the top of the script
Lol, worked a charm. As you can see I'm new to all this, thanks for the help mate, rep added
Reply
#10

It's all okay mate don't stress if something is needed just ask me on pm or somehow I will try to help you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)