Need help with a dialog
#1

Ok so,i made a class dialog that show everytime a player spawns.But there is a problem,when a dialogbox appear,if i press ESC,no option where selected from the dialog and i got normal cj skin.

How to fix this problem?

here is the dialog:

pawn Код:
if(dialogid == 888)
    {
        if(response)
        {
            if(listitem == 0)  // Assault
            {
               SetPlayerArmour(playerid, 90.0);
               GivePlayerWeapon(playerid, 24, 75);
               GivePlayerWeapon(playerid, 27, 50);
               GivePlayerWeapon(playerid, 31, 120);
               SetPlayerSkin(playerid, 124);
            }
            if(listitem == 1)  // Demolition
            {
            if(GetPlayerScore(playerid) < 500)
            {
                 SendClientMessage(playerid,0xFF0000AA,"You need 500 score for Demolition class.");
                 ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
                 return 0;
            }
            else if(GetPlayerScore(playerid) > 500)
            {
               SetPlayerArmour(playerid, 90.0);
               GivePlayerWeapon(playerid, 35, 5);
               GivePlayerWeapon(playerid, 28, 150);
               GivePlayerWeapon(playerid, 16, 10);
               SetPlayerSkin(playerid, 179);
            }
            }
            if(listitem == 2)  // Expert
            {
            if(GetPlayerScore(playerid) < 1000)
            {
                 SendClientMessage(playerid,0xFF0000AA,"You need 1000 score for Expert class.");
                 ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
                 return 0;
            }
            else if(GetPlayerScore(playerid) > 1500)
            {
               SetPlayerArmour(playerid, 90.0);
               GivePlayerWeapon(playerid, 26, 240);
               GivePlayerWeapon(playerid, 24, 75);
               GivePlayerWeapon(playerid, 17, 20);
               GivePlayerWeapon(playerid, 37, 150);
               SetPlayerSkin(playerid, 272);
            }
            }
              if(listitem == 3)  // Sniper
            {
            if(GetPlayerScore(playerid) < 100)
            {
                 SendClientMessage(playerid,0xFF0000AA,"You need 100 score for Sniper class.");
                 ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
                 return 0;
            }
            else if(GetPlayerScore(playerid) > 100)
            {
               SetPlayerArmour(playerid, 90.0);
               GivePlayerWeapon(playerid, 34, 200);
               GivePlayerWeapon(playerid, 16, 20);
               SetPlayerSkin(playerid, 183);
            }
            }
                  if(listitem == 4)  // Damager
            {
            if(GetPlayerScore(playerid) < 100)
            {
                 SendClientMessage(playerid,0xFF0000AA,"You need 5000 score for Damager class.");
                 ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
                 return 0;
            }
            else if(GetPlayerScore(playerid) > 5000)
            {
               SetPlayerArmour(playerid, 90.0);
               GivePlayerWeapon(playerid, 35, 100);
               SetPlayerSkin(playerid, 33);
            }
            }
        }
      return 1;
    }
OnPlayerSpawn:

pawn Код:
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
Thanks.
Reply
#2

Im not gonna copy the code, but try after the if(response) close bracket, put return 0;
pawn Код:
if(response)
{
//Listitems and stuff
}
return 0;
Hope I helped (somewhat)
Reply
#3

Emh nope...not helped
Reply
#4

Well my last try to make use of myself, Instead of if(response) { }
My dialogs all have this;
pawn Код:
if(dialogid == 1337) {
if(!response) return 0; //I have this
if(listitem == 0) { //else carry on to listitems
SendClientMessageToAll(-1, "TROLL");
}
}
Seems to work for me, else i'm sorry for wasting time :S
Reply
#5

Nope,i can still press ESC and get the CJ Skin
Reply
#6

Sorry, I think I misread.
Maybe you should TogglePlayerSpectating or something until the player has chosen one of the listitems. Maybe don't include the if(response). If he presses esc then, it will just choose whichever item is selected.
Reply
#7

Try This
pawn Код:
if(dialogid == 888)
{
    if(response)
    {
        if(listitem == 0)  // Assault
        {
            SetPlayerArmour(playerid, 90.0);
            GivePlayerWeapon(playerid, 24, 75);
            GivePlayerWeapon(playerid, 27, 50);
            GivePlayerWeapon(playerid, 31, 120);
            SetPlayerSkin(playerid, 124);
        }
        if(listitem == 1)  // Demolition
        {
            if(GetPlayerScore(playerid) < 500)
            {
                SendClientMessage(playerid,0xFF0000AA,"You need 500 score for Demolition class.");
                ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
            }
            else if(GetPlayerScore(playerid) > 500)
            {
                SetPlayerArmour(playerid, 90.0);
                GivePlayerWeapon(playerid, 35, 5);
                GivePlayerWeapon(playerid, 28, 150);
                GivePlayerWeapon(playerid, 16, 10);
                SetPlayerSkin(playerid, 179);
            }
        }
        if(listitem == 2)  // Expert
        {
            if(GetPlayerScore(playerid) < 1000)
            {
                SendClientMessage(playerid,0xFF0000AA,"You need 1000 score for Expert class.");
                ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
            }
            else if(GetPlayerScore(playerid) > 1500)
            {
                SetPlayerArmour(playerid, 90.0);
                GivePlayerWeapon(playerid, 26, 240);
                GivePlayerWeapon(playerid, 24, 75);
                GivePlayerWeapon(playerid, 17, 20);
                GivePlayerWeapon(playerid, 37, 150);
                SetPlayerSkin(playerid, 272);
            }
        }
        if(listitem == 3)  // Sniper
        {
            if(GetPlayerScore(playerid) < 100)
            {
                SendClientMessage(playerid,0xFF0000AA,"You need 100 score for Sniper class.");
                ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
            }
            else if(GetPlayerScore(playerid) > 100)
            {
                SetPlayerArmour(playerid, 90.0);
                GivePlayerWeapon(playerid, 34, 200);
                GivePlayerWeapon(playerid, 16, 20);
                SetPlayerSkin(playerid, 183);
            }
        }
        if(listitem == 4)  // Damager
        {
            if(GetPlayerScore(playerid) < 100)
            {
                SendClientMessage(playerid,0xFF0000AA,"You need 5000 score for Damager class.");
                ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
            }
            else if(GetPlayerScore(playerid) > 5000)
            {
                SetPlayerArmour(playerid, 90.0);
                GivePlayerWeapon(playerid, 35, 100);
                SetPlayerSkin(playerid, 33);
            }
        }
    }
    else
    {
        ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "******CLASS******", "Assault\nDemolition\nExpert\nSniper\nDamager", "Ok", "");
    }
}
Reply
#8

Thank you! It's working now!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)