SA-MP Forums Archive
Dialog won't work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog won't work (/showthread.php?tid=610346)



Dialog won't work - Krauser123 - 23.06.2016

I'm making a tokens FS and eveyrhting work correctly just.. the dialog in the last of the script won't open IG... plz help me in this

http://pastebin.com/MRMybDeM


Re: Dialog won't work - Dayrion - 23.06.2016

Copy the code which dialog doesn't appear not your whole GM/FS.


Re: Dialog won't work - Krauser123 - 23.06.2016

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == FIRSTMENU)
    {
        if(
response)
        {
            if(
listitem == 0// Weapons
            
{
                
ShowPlayerDialog(playerid,FIRSTMENU+2,DIALOG_STYLE_LIST,
                
"Regular Players Lounge",
                
"MP5\nCombat Shotgun\nDesert Eagle\nM4\nAK-47\nBack",
                
"Select""Exit");
            }
         }
      }
     if(
dialogid == FIRSTMENU+2// Weapons
      
{
           if(
response)
        {
              if(
listitem == 0// MP5
            
{
                new 
ammo GetPlayerAmmo(playerid);
                if(
ammo >=600)
                    {
                        
SendClientMessage(playeridCOLOR_GREY,
                        
"Sorry you have all the free ammo we can give you for now");
                    }
                if(
GetPlayerMoney(playerid) < 15000)
                    {
                    
SendClientMessage(playeridCOLOR_GREY,"* You cannot afford this!");
                    }
                    else
                
GivePlayerMoney(playerid, -15000);
                
GivePlayerWeapon(playerid29200);
            }
            if(
listitem == 1// Chainsaw
               
{
                new 
ammo GetPlayerAmmo(playerid);
                if(
ammo >400)
                    {
                        
SendClientMessage(playeridCOLOR_GREY,
                        
"Sorry you have all the free ammo we can give you for now");
                    }
                if(
GetPlayerMoney(playerid) < 8000)
                    {
                    
SendClientMessage(playeridCOLOR_GREY,"* You cannot afford this!");
                    }
                    else
                
GivePlayerWeapon(playerid,25 ,25);
                
GivePlayerMoney(playerid, -8000);
              }
          }
      }
       return 
1;
  } 



Re: Dialog won't work - MotherDucker - 23.06.2016

Why are you using FIRSTMENU+2? That is possibily causing the issue, use dialog == 0, dialog == 1.


Re: Dialog won't work - Krauser123 - 23.06.2016

Can you fix it for me if possible ? i don't understand what you're trying to tell me exactly


Re: Dialog won't work - Dayrion - 23.06.2016

Your indentation is completly wrong.
Like MotherDucker said, define your dialogid before use it.
PHP код:
#define FIRSTMENU    990
#define SECONDMENU  991
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == FIRSTMENU)
    {
        if(
reponse)
        {
            if(
listitem == 0)
            {
                
ShowPlayerDialog(playeridSECONDMENUDIALOG_STYLE_LIST,
                
"Regular Players Lounge",
                
"MP5\nCombat Shotgun\nDesert Eagle\nM4\nAK-47\nBack",
                
"Select""Exit");
            }
        }
    }
    
    if(
dialogid == SECONDMENU)
    {
        if(
reponse)
        {
            switch(
listitem)
              {
                case 
0:
                {
                    new 
ammo GetPlayerAmmo(playerid);
                    if(
ammo >= 600) return SendClientMessage(playeridCOLOR_GREY"Sorry you have all the free ammo we can give you for now");
                    if(
GetPlayerMoney(playerid) < 15000) return SendClientMessage(playeridCOLOR_GREY,"* You cannot afford this!");
                    
GivePlayerMoney(playerid, -15000);
                    
GivePlayerWeapon(playerid29200);
                    return 
1;
                }
                case 
1:
                {
                    new 
ammo GetPlayerAmmo(playerid);
                    if(
ammo 400) return SendClientMessage(playeridCOLOR_GREY"Sorry you have all the free ammo we can give you for now");
                    if(
GetPlayerMoney(playerid) < 8000) return SendClientMessage(playeridCOLOR_GREY,"* You cannot afford this!");
                    
GivePlayerWeapon(playerid,25 ,25);
                    
GivePlayerMoney(playerid, -8000);
                    return 
1;
                }
                default : return 
1;
            }
               return 
1;
        }
    }
     return 
1;

pastbin with right indentation: http://pastebin.com/n6vPZuHC


Re: Dialog won't work - Krauser123 - 23.06.2016

Excuse me but i still got the same problem


Re: Dialog won't work - Dayrion - 23.06.2016

Which command call FIRSTMENU ?


Re: Dialog won't work - Krauser123 - 23.06.2016

Here is it

PHP код:
COMMAND:buyweapons(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        if(
IsPlayerInRangeOfPoint(playerid31720.9337, -1629.047920.2135))
        {
            
ShowPlayerDialog(playeridFIRSTMENUDIALOG_STYLE_LIST,
                
"Weapons List",
                
"MP5           5 Tokens\nShotgun       5 Tokens\nDesert Eagle  5 Tokens\nCombat Shotgun5 Tokens\nM4            5 Tokens\nAK-47         5 Tokens\nSniper Rifle  5 Tokens",
                
"Select""Exit");
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"You Are not at the weapon point!");
                }
            }
    return 
1;
        }