rep + dialog problem.
#1

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == russianbar)
    {
            if(response)
        {
                switch(listitem)
            {
                    case 0:
                {

                    if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -25);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+15);



                }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+25);

                }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -15);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+35);
                   

                }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 75) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -75);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+40);

                }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -100);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+50);
                    }
                }
            }
           return 0;
    }
    if(dialogid == danielsbar)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {

                    if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -25);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+15);



                    }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+25);

                    }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -15);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+35);

                    }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 75) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -75);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+40);

                    }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -200);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+50);


                    }
                }
            }
        }
    return 1;
}
wont compile it gives me an error loose indentation.

pawn Код:
ShowPlayerDialog(playerid, russianbar, DIALOG_STYLE_LIST, "Russian Menu","Sprunk ($25)\nVodka($50) \nBeer ($15)\nWine ($75) \nRedbull ($100)", "Purchase", "Cancel");
Reply
#2

What is Error?
Reply
#3

Post behind [pawn] [*/pawn] (without *)

Show your ShowPlayerDialog

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == russianpickupbar)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -25);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+15);
                }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+25);
                }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -15);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+35);
                }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 75) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -75);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+40);
                }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -100);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+50);
                }
            }
        }
    }
    return 1;
}
Reply
#4

Do you get any warnings or error?

How have you defined russianpickupbar?
Reply
#5

found the error, repairing e.e
Reply
#6

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Do you get any warnings or error?

How have you defined russianpickupbar?
yeah loose indentation I need to add multiple of those see?
Reply
#7

pawn Код:
C:\Users\Oscar\Desktop\*\Gangwarz\gamemodes\backup.pwn(1482) : warning 217: loose indentation
C:\Users\Oscar\Desktop\*\Gangwarz\gamemodes\backup.pwn(1484) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#8

Loose indentation is a warning, not an error. Are there any more errors showing in the console? This code will still work regardless of the indentation, the compiler doesn't notice logic problems (i.e. if you used the wrong operator, etc.).

Also, are you positive 'hp' is defined as a float?
Reply
#9

try this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == russianbar)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {

                    if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -25);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+15);



                }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+25);

                }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -15);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+35);


                }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 75) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -75);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+40);

                }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -100);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+50);
                }
            }
        }
        return 0;
    }
    if(dialogid == danielsbar)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {

                    if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -25);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+15);



                    }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+25);

                    }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -15);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+35);

                    }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 75) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -75);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+40);

                    }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -200);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+50);


                    }
                }
            }
        }
    return 1;
}
Reply
#10

Quote:
Originally Posted by niels44
Посмотреть сообщение
try this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == russianbar)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {

                    if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -25);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+15);



                }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+25);

                }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -15);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+35);


                }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 75) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -75);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+40);

                }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -100);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+50);
                }
            }
        }
        return 0;
    }
    if(dialogid == danielsbar)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {

                    if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -25);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+15);



                    }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+25);

                    }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -15);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+35);

                    }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 75) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -75);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+40);

                    }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -200);
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,hp+50);


                    }
                }
            }
        }
    return 1;
}
Thanks man worked! If I want to add the 3rd one how? all rep +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)