[HELP] Dialog Bug Or Something Wrong?
#1

Hello Guys , I Made A Weapon Spawner System , But When I Click On Dialog's Weapon And Nothing Happen , Dialog Just Disappear After I Click It , Does Anyone Know How To Fix This Bug? Or I Do Something Wrong? But I Compile It And No Error Pop Up ...

So Here Is My Weapons.pwn File.

PHP код:
#include < a_samp >
#include < zcmd >
#define DIALOG_WEPS 2013
CMD:weaps(playeridparams[])
{
     
ShowPlayerDialog(playeridDIALOG_WEPSDIALOG_STYLE_LIST"{80FFFF}Weapon Spawner""{80FFFF}Brassknuckle\nGoldclub\nNitestick\nKnife\nBat\nShovel\nPoolstick\nKatana\nChainsaw\n""Select""Close");
     return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
     if(
dialogid == DIALOG_WEPS)
     {
         if(
response)
         {
             switch(
listitem)
             {
                 case 
1GivePlayerWeapon(playerid11);
                 case 
2GivePlayerWeapon(playerid21);
                 case 
3GivePlayerWeapon(playerid31);
                 case 
4GivePlayerWeapon(playerid41);
                 case 
5GivePlayerWeapon(playerid51);
                 case 
6GivePlayerWeapon(playerid61);
                 case 
7GivePlayerWeapon(playerid71);
                 case 
8GivePlayerWeapon(playerid81);
                 case 
9GivePlayerWeapon(playerid91);
                  }     
         }
         return 
1;
     }
     return 
0;

Reply
#2

Try return 1;

pawn Код:
#include < a_samp >
#include < zcmd >
#define DIALOG_WEPS 2013


CMD:weaps(playerid, params[])
{
     ShowPlayerDialog(playerid, DIALOG_WEPS, DIALOG_STYLE_LIST, "{80FFFF}Weapon Spawner", "{80FFFF}Brassknuckle\nGoldclub\nNitestick\nKnife\nBat\nShovel\nPoolstick\nKatana\nChainsaw\n", "Select", "Close");
     return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
     if(dialogid == DIALOG_WEPS)
     {
         if(response)
         {
             switch(listitem)
             {
                 case 1: GivePlayerWeapon(playerid, 1, 1);
                 case 2: GivePlayerWeapon(playerid, 2, 1);
                 case 3: GivePlayerWeapon(playerid, 3, 1);
                 case 4: GivePlayerWeapon(playerid, 4, 1);
                 case 5: GivePlayerWeapon(playerid, 5, 1);
                 case 6: GivePlayerWeapon(playerid, 6, 1);
                 case 7: GivePlayerWeapon(playerid, 7, 1);
                 case 8: GivePlayerWeapon(playerid, 8, 1);
                 case 9: GivePlayerWeapon(playerid, 9, 1);
             }
         }
     }
     return 1;
}
Also, be sure you don't have another dialog with same ID.
Reply
#3

Also, be aware that dialog list items start at 0, not 1.
Reply
#4

Quote:
Originally Posted by HY
Посмотреть сообщение
Try return 1;

pawn Код:
#include < a_samp >
#include < zcmd >
#define DIALOG_WEPS 2013


CMD:weaps(playerid, params[])
{
     ShowPlayerDialog(playerid, DIALOG_WEPS, DIALOG_STYLE_LIST, "{80FFFF}Weapon Spawner", "{80FFFF}Brassknuckle\nGoldclub\nNitestick\nKnife\nBat\nShovel\nPoolstick\nKatana\nChainsaw\n", "Select", "Close");
     return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
     if(dialogid == DIALOG_WEPS)
     {
         if(response)
         {
             switch(listitem)
             {
                 case 1: GivePlayerWeapon(playerid, 1, 1);
                 case 2: GivePlayerWeapon(playerid, 2, 1);
                 case 3: GivePlayerWeapon(playerid, 3, 1);
                 case 4: GivePlayerWeapon(playerid, 4, 1);
                 case 5: GivePlayerWeapon(playerid, 5, 1);
                 case 6: GivePlayerWeapon(playerid, 6, 1);
                 case 7: GivePlayerWeapon(playerid, 7, 1);
                 case 8: GivePlayerWeapon(playerid, 8, 1);
                 case 9: GivePlayerWeapon(playerid, 9, 1);
             }
         }
     }
     return 1;
}
Also, be sure you don't have another dialog with same ID.
Try , But Didn't Work , I Click And The Dialog Just Disappear , And Nothing Happen.
Reply
#5

Check your other filterscripts for OnDialogResponse.
They should return 0 in every script.
Only the gamemode should return 1, as it's the last script checked for that callback.
Reply
#6

Quote:
Originally Posted by TuSheng
Посмотреть сообщение
Hello Guys , I Made A Weapon Spawner System , But When I Click On Dialog's Weapon And Nothing Happen , Dialog Just Disappear After I Click It , Does Anyone Know How To Fix This Bug? Or I Do Something Wrong? But I Compile It And No Error Pop Up ...

So Here Is My Weapons.pwn File.

PHP код:
#include < a_samp >
#include < zcmd >
#define DIALOG_WEPS 2013
CMD:weaps(playeridparams[])
{
     
ShowPlayerDialog(playeridDIALOG_WEPSDIALOG_STYLE_LIST"{80FFFF}Weapon Spawner""{80FFFF}Brassknuckle\nGoldclub\nNitestick\nKnife\nBat\nShovel\nPoolstick\nKatana\nChainsaw\n""Select""Close");
     return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
     if(
dialogid == DIALOG_WEPS)
     {
         if(
response)
         {
             switch(
listitem)
             {
                 case 
1GivePlayerWeapon(playerid11);
                 case 
2GivePlayerWeapon(playerid21);
                 case 
3GivePlayerWeapon(playerid31);
                 case 
4GivePlayerWeapon(playerid41);
                 case 
5GivePlayerWeapon(playerid51);
                 case 
6GivePlayerWeapon(playerid61);
                 case 
7GivePlayerWeapon(playerid71);
                 case 
8GivePlayerWeapon(playerid81);
                 case 
9GivePlayerWeapon(playerid91);
                  }     
         }
         return 
1;
     }
     return 
0;

Change then ID of your dialog from this:

pawn Код:
#define DIALOG_WEPS 2013
To this:


pawn Код:
#define DIALOG_WEPS 3013
And change the ammo to 9999 and see if it works.
Reply
#7

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
     if(dialogid == DIALOG_WEPS)
     {
         if(response)
         {
             switch(listitem)
             {
                 case 0: GivePlayerWeapon(playerid, 1, 1);
                 case 1: GivePlayerWeapon(playerid, 2, 1);
                 case 2: GivePlayerWeapon(playerid, 3, 1);
                 case 3: GivePlayerWeapon(playerid, 4, 1);
                 case 4: GivePlayerWeapon(playerid, 5, 1);
                 case 5: GivePlayerWeapon(playerid, 6, 1);
                 case 6: GivePlayerWeapon(playerid, 7, 1);
                 case 7: GivePlayerWeapon(playerid, 8, 1);
                 case 8: GivePlayerWeapon(playerid, 9, 1);
                  }    
         }
         return 1;
     }
     return 0;
}
Reply
#8

@Ciarannn
I Try And Didn't Work , I Just Click And Same Thing Happen Again , Dialogs Just Disappear.

@Nimrod
Already Try That Too , Doesn't Work Too ...

Seen I Have Tried Every Option , But Just Didn't Work ... Here Is My Code , Maybe Can Test In In Your Gamemode/Filterscript? See If Would Works Or Not?

Sorry About My Bad/Poor English.

PHP код:
#include a_samp
#include zcmd
#define DIALOG_WEPS 3013
#pragma tabsize 0
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" dialog testing by TuSheng");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
CMD:weaps(playeridparams[])
{
    
ShowPlayerDialog(playerid50DIALOG_STYLE_LIST"{80FFFF}Weapon Spawner""{80FFFF}Brassknuckle\nGoldclub\nNitestick\nKnife\nBat\nShovel\nPoolstick\nKatana\nChainsaw\n""Select""Close");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 50)
    {
       
SendClientMessage(playerid, -1"dialog");
       if(
response)
       {
          
SendClientMessage(playerid, -1"response");
          switch(
listitem)
          {
                 case 
0:
              {                 
                 
GivePlayerWeapon(playerid19999);
                
SendClientMessage(playerid, -1"case 0");
            }
                 case 
1
            {
                
GivePlayerWeapon(playerid29999);
                
SendClientMessage(playerid, -1"case 1");
              } 
            case 
2
            {
                
GivePlayerWeapon(playerid39999);
                
SendClientMessage(playerid, -1"case 2");
              }
            case 
3
            {
                
GivePlayerWeapon(playerid49999);
                
SendClientMessage(playerid, -1"case 3");
              }
            case 
4
            {
                
GivePlayerWeapon(playerid59999);
                
SendClientMessage(playerid, -1"case 4");
              }
            case 
5
            {
                
GivePlayerWeapon(playerid69999);
                
SendClientMessage(playerid, -1"case 5");
              }
            case 
6
            {
                
GivePlayerWeapon(playerid79999);
                
SendClientMessage(playerid, -1"case 6");
              }
            case 
7
            {
                
GivePlayerWeapon(playerid89999);
                
SendClientMessage(playerid, -1"case 7");
              }
            case 
8
            {
                
GivePlayerWeapon(playerid99999);
                
SendClientMessage(playerid, -1"case 8");
            }
            
          }
          
        }
 
    }
    return 
1;

Reply
#9

Problem Solved , Thank Guys For Helping Me !
Anyways , Thanks !!!

Regards,
The Newbie [ TuSheng ]
Reply
#10

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_WEPS)
    {
        if(response)
        {
            if(listitem == 0) return GivePlayerWeapon(playerid, 1, 1);
            if(listitem == 1) return GivePlayerWeapon(playerid, 2, 1);
            if(listitem == 2) return GivePlayerWeapon(playerid, 3, 1);
            if(listitem == 3) return GivePlayerWeapon(playerid, 4, 1);
            if(listitem == 4) return GivePlayerWeapon(playerid, 5, 1);
            if(listitem == 5) return GivePlayerWeapon(playerid, 6, 1);
            if(listitem == 6) return GivePlayerWeapon(playerid, 7, 1);
            if(listitem == 7) return GivePlayerWeapon(playerid, 8, 1);
            if(listitem == 8) return GivePlayerWeapon(playerid, 9, 1);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)