Defining Dialog Help
#1

i made 3 dialogs :

Music dialog
Radio dialog
Admin Control Panel Dialog,

Music and Radio dialog working perfectly but when i opened admin control panel dialog and i click on any thing that i made for it, it will play stream that i put in radio

the defines are this :

PHP код:
#define DIALOG_MUSIC 5
#define DIALOG_RADIO 1
#define DIALOG_ADMIN 6 
and code :

PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(
dialogid == DIALOG_MUSIC)
    {
        if(
response)
        {
              switch(
listitem)
            {
                case 
0: //English Songs
                
{
                    
ShowPlayerDialog(playerid, DIALOG_MUSIC+1, DIALOG_STYLE_TABLIST_HEADERS, "English Songs", "Song \tArtist \tDuration \nCongratulations \tPost Malone \t4:16 \nDespacito \tJustin Bieber \t2:43 \nAll I Do \tLogic \t3:52", "Play", "Back");
                }
                case 
1: //Hindi Songs
                
{
                    
ShowPlayerDialog(playerid, DIALOG_MUSIC+2, DIALOG_STYLE_TABLIST_HEADERS, "Hindi Songs", "Song \tArtist \tDuration \nSoch \tChen-K \t3:18 \nNaamchor \tChen-K \t1:51", "Play", "Back");
                }    
            }
        }
        else
        {
            
SendClientMessage(playerid, COLOR_RED, "You've closed the Music Dialog");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_MUSIC+1) //English Songs
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/q16rvkee67/Post_Malone_-_Congratulations_Meroshi_Trap_Remix_.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
                case 
1:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/ysgwj5jw8m/Justin_Bieber_-_Despacito_Jeydee_Club_Mix_ft._Luis_Fonsi_Daddy_Yankee.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
                case 
2:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/mnwozac2sp/Logic-_All_I_Do.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_MUSIC, DIALOG_STYLE_LIST, "Music", "English Songs \nHindi Songs", "Play", "Cancel");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_MUSIC+2) //Hindi Songs
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/hgkh82sfg1/CHEN-K_-_SOCH_Lyrics_Video_EXPLICIT_URDU_RAP.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
                case 
1:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/i3rl0qgd9b/CHEN-K_-_NAAMCHOR_Official_Video_x_LYRIK_URDU_RAP.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_MUSIC, DIALOG_STYLE_LIST, "Music", "English Songs \nHindi Songs", "Play", "Cancel");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_RADIO)
    {
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://7609.live.streamtheworld.com:80/977_HITS_SC");
                    
SendClientMessage(playerid, COLOR_WHITE, "type {FF6600}/stop{FFFFFF} to stop the radio");
                }
            }
        }
        else
        {
            
SendClientMessage(playerid, COLOR_RED, "You've closed the Radio Dialog");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_ADMIN) //Admin Control Panel
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
ShowPlayerDialog(playerid, DIALOG_ADMIN+1, DIALOG_STYLE_LIST, "Weapons", "Minigun \nChainsaw \nMoltov \nJetpack", "Select", "Back");
                }
                case 
1:
                {
                    
ShowPlayerDialog(playerid, DIALOG_ADMIN+2, DIALOG_STYLE_LIST, "Perks", "Health \nArmour", "Select", "Back");
                }
            }
        }
        else
        {
            
SendClientMessage(playerid, COLOR_RED, "You've closed the Admin Control Panel");
        }
        return 
1;    
    }
    if(
dialogid == DIALOG_ADMIN+1) //Weapons
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0: // Minigun
                
{
                    
GivePlayerWeapon(playerid, 38, 99999);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Minigun has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
1: //Chainsaw
                
{
                    
GivePlayerWeapon(playerid, 9, 99999);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Chainsaw has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
2: //Moltov
                
{
                    
GivePlayerWeapon(playerid, 18, 99999);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Moltov has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
3: //jetpack
                
{
                    
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Jetpack has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_ADMIN, DIALOG_STYLE_LIST, "Admin Control Panel", "Weapons \nPerks", "Select", "Cancel");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_ADMIN+2) //Perks
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0: //Health
                
{
                    
SetPlayerHealth(playerid, 100.0);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Your Health has been refilled");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
1: //Armour
                
{
                    
SetPlayerArmour(playerid, 100.0);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Your Armour has been refilled");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_ADMIN, DIALOG_STYLE_LIST, "Admin Control Panel", "Weapons \nPerks", "Select", "Cancel");
        }
        return 
1;
    }
    return 
0;
} 
i define them as cases i made for them for an example i put 5 songs in music dialog so i define it DIALOG_MUSIC 5

i defined DIALOG_RADIO 1 because i put 1 stream on it
Reply
#2

Hello, so you are mixing up dialogs music and admin dialog!
I mean dialog dialog music plus 1 equals the admin control panel dialog!
So you can change the ids of the dialogs!

========> Sry for my bad english, I hope you understand me!
Reply
#3

ids are already diffirent DIALOG_ADMIN and DIALOG_RADIO

can u code an example here?
Reply
#4

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Hello, so you are mixing up dialogs music and admin dialog!
I mean dialog dialog music plus 1 equals the admin control panel dialog!
So you can change the ids of the dialogs!

========> Sry for my bad english, I hope you understand me!
So, in such cases, use enum

enum{
dialog1,
dialog2
};
Reply
#5

Quote:
Originally Posted by Debjit
Посмотреть сообщение
So, in such cases, use enum

enum{
dialog1,
dialog2
};
did but not working

when i play radio stream it plays music stream everything is messed up

and when i'm opening my admin control panel it's playing radio stream
Reply
#6

Here you are the code my friend
PHP код:
#define DIALOG_MUSIC 53
#define DIALOG_MUSIC2 54
#define DIALOG_MUSIC3 55
#define DIALOG_RADIO 56
#define DIALOG_ADMIN 57
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(
dialogid == DIALOG_MUSIC)
    {
        if(
response)
        {
              switch(
listitem)
            {
                case 
0: //English Songs
                
{
                    
ShowPlayerDialog(playerid, DIALOG_MUSIC2, DIALOG_STYLE_TABLIST_HEADERS, "English Songs", "Song \tArtist \tDuration \nCongratulations \tPost Malone \t4:16 \nDespacito \tJustin Bieber \t2:43 \nAll I Do \tLogic \t3:52", "Play", "Back");
                }
                case 
1: //Hindi Songs
                
{
                    
ShowPlayerDialog(playerid, DIALOG_MUSIC3, DIALOG_STYLE_TABLIST_HEADERS, "Hindi Songs", "Song \tArtist \tDuration \nSoch \tChen-K \t3:18 \nNaamchor \tChen-K \t1:51", "Play", "Back");
                }
            }
        }
        else
        {
            
SendClientMessage(playerid, COLOR_RED, "You've closed the Music Dialog");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_MUSIC2) //English Songs
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/q16rvkee67/Post_Malone_-_Congratulations_Meroshi_Trap_Remix_.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
                case 
1:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/ysgwj5jw8m/Justin_Bieber_-_Despacito_Jeydee_Club_Mix_ft._Luis_Fonsi_Daddy_Yankee.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
                case 
2:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/mnwozac2sp/Logic-_All_I_Do.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_MUSIC, DIALOG_STYLE_LIST, "Music", "English Songs \nHindi Songs", "Play", "Cancel");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_MUSIC3) //Hindi Songs
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/hgkh82sfg1/CHEN-K_-_SOCH_Lyrics_Video_EXPLICIT_URDU_RAP.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
                case 
1:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/i3rl0qgd9b/CHEN-K_-_NAAMCHOR_Official_Video_x_LYRIK_URDU_RAP.mp3");
                    
SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/stop{FFFFFF} to stop the music");
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_MUSIC, DIALOG_STYLE_LIST, "Music", "English Songs \nHindi Songs", "Play", "Cancel");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_RADIO)
    {
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
PlayAudioStreamForPlayer(playerid, "http://7609.live.streamtheworld.com:80/977_HITS_SC");
                    
SendClientMessage(playerid, COLOR_WHITE, "type {FF6600}/stop{FFFFFF} to stop the radio");
                }
            }
        }
        else
        {
            
SendClientMessage(playerid, COLOR_RED, "You've closed the Radio Dialog");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_ADMIN) //Admin Control Panel
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
ShowPlayerDialog(playerid, DIALOG_ADMIN+1, DIALOG_STYLE_LIST, "Weapons", "Minigun \nChainsaw \nMoltov \nJetpack", "Select", "Back");
                }
                case 
1:
                {
                    
ShowPlayerDialog(playerid, DIALOG_ADMIN+2, DIALOG_STYLE_LIST, "Perks", "Health \nArmour", "Select", "Back");
                }
            }
        }
        else
        {
            
SendClientMessage(playerid, COLOR_RED, "You've closed the Admin Control Panel");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_ADMIN+1) //Weapons
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0: // Minigun
                
{
                    
GivePlayerWeapon(playerid, 38, 99999);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Minigun has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
1: //Chainsaw
                
{
                    
GivePlayerWeapon(playerid, 9, 99999);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Chainsaw has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
2: //Moltov
                
{
                    
GivePlayerWeapon(playerid, 18, 99999);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Moltov has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
3: //jetpack
                
{
                    
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Jetpack has given to you!");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_ADMIN, DIALOG_STYLE_LIST, "Admin Control Panel", "Weapons \nPerks", "Select", "Cancel");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_ADMIN+2) //Perks
    
{
        if(
response)
        {
            switch(
listitem)
            {
                case 
0: //Health
                
{
                    
SetPlayerHealth(playerid, 100.0);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Your Health has been refilled");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
                case 
1: //Armour
                
{
                    
SetPlayerArmour(playerid, 100.0);
                    
SendClientMessage(playerid, COLOR_WHITE, "* {66ffcc}Your Armour has been refilled");
                    
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid, DIALOG_ADMIN, DIALOG_STYLE_LIST, "Admin Control Panel", "Weapons \nPerks", "Select", "Cancel");
        }
        return 
1;
    }
    return 
0;
} 
Reply
#7

here's a suggestion use this for convenience.
Reply
#8

Quote:
Originally Posted by Debjit
Посмотреть сообщение
here's a suggestion use this for convenience.
Download link not working
Reply
#9

I think you're confused on how this works.
Код:
if(dialogid == DIALOG_MUSIC+1) //English Songs
You have DIALOG_MUSIC defined as 5. You have DIALOG_ADMIN as 6.

DIALOG_MUSIC (5) + 1 = DIALOG_ADMIN (6).
Reply
#10

Quote:
Originally Posted by Debjit
Посмотреть сообщение
So, in such cases, use enum

enum{
dialog1,
dialog2
};
^

This should help you
Reply


Forum Jump:


Users browsing this thread: