Problems with dialogs
#1

Hi there! i have two dialogs. Dialog for command /changegang wich is working perfect, and dialog for command /order.
When i type /order, it's shows me the correct options but when i select something, is changing my gang. I look closer in GM but i don't find the problem.. the id's are corect....
pawn Код:
switch(5)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    case DIALOG_GANGCHANGE:// Our dialog!
    {
        if(!response) return 0;
        switch(listitem)// Checking which listitem was selected
        {
            case 0:// The first item listed
            {
                if(PlayerInfo[playerid] [pTeam] == 0) return SendClientMessage(playerid, -1, "You cannot select the same gang.");
                SetPlayerTeam(playerid, 0);
                PlayerInfo[playerid][pTeam] = 0;
                SetSpawnInfo( playerid, 0,186, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
                SpawnPlayer(playerid);
                SendClientMessage(playerid, -1, "Your new gang is Red Dragon Triad.");
            }
            case 1: // The second item listed
            {
                if(PlayerInfo[playerid] [pTeam] == 1) return SendClientMessage(playerid, -1, "You cannot select the same gang.");
                SetPlayerTeam(playerid, 1);
                PlayerInfo[playerid][pTeam] = 1;
                SetSpawnInfo( playerid, 1, 112, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
                SpawnPlayer(playerid);
                SendClientMessage(playerid, -1, "Your new gang is The Corleone Family.");
            }
        }
    }
}
switch(DIALOG_ORDER6)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    case 6:// Our dialog!
    {
    if(!response) return 0;
        switch(listitem)// Checking which listitem was selected
        {
            case 2:// The first item listed
            {
                GivePlayerWeapon(playerid, 24, 350);
                GivePlayerWeapon(playerid, 31, 350);
                GivePlayerWeapon(playerid, 32, 550);
                GivePlayerMoney(playerid, -5000);
                GameTextForPlayer(playerid, "-5000$", 3000, 1);
               
            }
            case 3: // The second item listed
            {
                GivePlayerWeapon(playerid, 24, 350);
                GivePlayerWeapon(playerid, 31, 350);
                GivePlayerWeapon(playerid, 32, 550);
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 34, 100);
                GivePlayerMoney(playerid, -10000);
                GameTextForPlayer(playerid, "-10000$", 3000, 1);
            }
        }
    }
}
return 1;
}
}
Reply
#2

That code is so terrible I don't even want to fix it for you.

Use
pawn Код:
if(dialogid == DIALOG_ORDER6)
I don't suggest switching dialog ids, unless you do it correctly, and in this case your code is horrible.
Reply
#3

PHP код:
switch(5)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    case 
DIALOG_GANGCHANGE:// Our dialog!
    
{
        if(!
response) return 0;
        switch(
listitem)// Checking which listitem was selected
        
{
            case 
0:// The first item listed
            
{
                if(
PlayerInfo[playerid] [pTeam] == 0) return SendClientMessage(playerid, -1"You cannot select the same gang.");
                
SetPlayerTeam(playerid0);
                
PlayerInfo[playerid][pTeam] = 0;
                
SetSpawnInfoplayerid0,1862022.1766,1007.5810,10.8203,270.033000000);
                
SpawnPlayer(playerid);
                
SendClientMessage(playerid, -1"Your new gang is Red Dragon Triad.");
            }
            case 
1// The second item listed
            
{
                if(
PlayerInfo[playerid] [pTeam] == 1) return SendClientMessage(playerid, -1"You cannot select the same gang.");
                
SetPlayerTeam(playerid1);
                
PlayerInfo[playerid][pTeam] = 1;
                
SetSpawnInfoplayerid11122194.3840,1676.9290,12.3672,88.403500000);
                
SpawnPlayer(playerid);
                
SendClientMessage(playerid, -1"Your new gang is The Corleone Family.");
            }
        }
    }
}
if(
dialogid == DIALOG_ORDER6)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    case 
6:// Our dialog!
    
{
    if(!
response) return 0;
        switch(
listitem)// Checking which listitem was selected
        
{
            case 
2:// The first item listed
            
{
                
GivePlayerWeapon(playerid24350);
                
GivePlayerWeapon(playerid31350);
                
GivePlayerWeapon(playerid32550);
                
GivePlayerMoney(playerid, -5000);
                
GameTextForPlayer(playerid"-5000$"30001);
               
            }
            case 
3// The second item listed
            
{
                
GivePlayerWeapon(playerid24350);
                
GivePlayerWeapon(playerid31350);
                
GivePlayerWeapon(playerid32550);
                
GivePlayerWeapon(playerid41);
                
GivePlayerWeapon(playerid34100);
                
GivePlayerMoney(playerid, -10000);
                
GameTextForPlayer(playerid"-10000$"30001);
            }
        }
    }
}
return 
1;
}

Reply
#4

Quote:
Originally Posted by arlindi
Посмотреть сообщение
PHP код:
switch(5)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    case 
DIALOG_GANGCHANGE:// Our dialog!
    
{
        if(!
response) return 0;
        switch(
listitem)// Checking which listitem was selected
        
{
            case 
0:// The first item listed
            
{
                if(
PlayerInfo[playerid] [pTeam] == 0) return SendClientMessage(playerid, -1"You cannot select the same gang.");
                
SetPlayerTeam(playerid0);
                
PlayerInfo[playerid][pTeam] = 0;
                
SetSpawnInfoplayerid0,1862022.1766,1007.5810,10.8203,270.033000000);
                
SpawnPlayer(playerid);
                
SendClientMessage(playerid, -1"Your new gang is Red Dragon Triad.");
            }
            case 
1// The second item listed
            
{
                if(
PlayerInfo[playerid] [pTeam] == 1) return SendClientMessage(playerid, -1"You cannot select the same gang.");
                
SetPlayerTeam(playerid1);
                
PlayerInfo[playerid][pTeam] = 1;
                
SetSpawnInfoplayerid11122194.3840,1676.9290,12.3672,88.403500000);
                
SpawnPlayer(playerid);
                
SendClientMessage(playerid, -1"Your new gang is The Corleone Family.");
            }
        }
    }
}
if(
dialogid == DIALOG_ORDER6)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    case 
6:// Our dialog!
    
{
    if(!
response) return 0;
        switch(
listitem)// Checking which listitem was selected
        
{
            case 
2:// The first item listed
            
{
                
GivePlayerWeapon(playerid24350);
                
GivePlayerWeapon(playerid31350);
                
GivePlayerWeapon(playerid32550);
                
GivePlayerMoney(playerid, -5000);
                
GameTextForPlayer(playerid"-5000$"30001);
               
            }
            case 
3// The second item listed
            
{
                
GivePlayerWeapon(playerid24350);
                
GivePlayerWeapon(playerid31350);
                
GivePlayerWeapon(playerid32550);
                
GivePlayerWeapon(playerid41);
                
GivePlayerWeapon(playerid34100);
                
GivePlayerMoney(playerid, -10000);
                
GameTextForPlayer(playerid"-10000$"30001);
            }
        }
    }
}
return 
1;
}

You should actually study the code.. you have a case statement without a switch statement.
Reply
#5

Here, I took my time to fix your horrible code:
pawn Код:
if(dialogid == DIALOG_GANGCHANGE)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    if(!response) return 0;
    switch(listitem)// Checking which listitem was selected
    {
        case 0:// The first item listed
        {
            if(PlayerInfo[playerid] [pTeam] == 0) return SendClientMessage(playerid, -1, "You cannot select the same gang.");
            SetPlayerTeam(playerid, 0);
            PlayerInfo[playerid][pTeam] = 0;
            SetSpawnInfo( playerid, 0,186, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
            SpawnPlayer(playerid);
            SendClientMessage(playerid, -1, "Your new gang is Red Dragon Triad.");
        }
        case 1: // The second item listed
        {
            if(PlayerInfo[playerid] [pTeam] == 1) return SendClientMessage(playerid, -1, "You cannot select the same gang.");
            SetPlayerTeam(playerid, 1);
            PlayerInfo[playerid][pTeam] = 1;
            SetSpawnInfo( playerid, 1, 112, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
            SpawnPlayer(playerid);
            SendClientMessage(playerid, -1, "Your new gang is The Corleone Family.");
        }
    }
    return 1;
}

else if(dialogid == DIALOG_ORDER6)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    if(!response) return 0;
    switch(listitem)// Checking which listitem was selected
    {
        case 0:// The first item listed
        {
            GivePlayerWeapon(playerid, 24, 350);
            GivePlayerWeapon(playerid, 31, 350);
            GivePlayerWeapon(playerid, 32, 550);
            GivePlayerMoney(playerid, -5000);
            GameTextForPlayer(playerid, "-5000$", 3000, 1);

        }
        case 1: // The second item listed
        {
            GivePlayerWeapon(playerid, 24, 350);
            GivePlayerWeapon(playerid, 31, 350);
            GivePlayerWeapon(playerid, 32, 550);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 34, 100);
            GivePlayerMoney(playerid, -10000);
            GameTextForPlayer(playerid, "-10000$", 3000, 1);
        }
    }
    return 1;
}
Reply
#6

Yeah i do it wrong
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)