SA-MP Forums Archive
weapondialog not working - 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: weapondialog not working (/showthread.php?tid=522675)



weapondialog not working - webhead - 28.06.2014

Hello everyone,

I've made a simple weapon selection with a dialog but it isn't working. The dialog shows up but if I select an entry and klick ok the dialog disappears and I don't get the weapon. Here my code
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == dmdia && response)
	{
		if(response)
        {
            if(listitem == 0)
            {
              
                GivePlayerWeapon(playerid,31,999);
            }
            if(listitem == 1)
            {
              
                GivePlayerWeapon(playerid,23,999);
            }
            if(listitem == 2)
            {

                GivePlayerWeapon(playerid,25,999);
            }
            if(listitem == 3)
            {

                GivePlayerWeapon(playerid,8,999);
            }			
        }
        return 1;

	}
...
Please tell me what's wrong with it.
Thank you
webhead


Re: weapondialog not working - Konstantinos - 28.06.2014

Return 0 at the end of OnDialogResponse callback for any script the server is running.


Re: weapondialog not working - webhead - 28.06.2014

Thank you for your answer, but it still doesn't work. Any other ideas?


Re : weapondialog not working - Clad - 28.06.2014

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dmdia && response)
    {
        if(response)
        {
            if(listitem == 0)
            {
             
                GivePlayerWeapon(playerid,31,999);
            }
            if(listitem == 1)
            {
             
                GivePlayerWeapon(playerid,23,999);
            }
            if(listitem == 2)
            {

                GivePlayerWeapon(playerid,25,999);
            }
            if(listitem == 3)
            {

                GivePlayerWeapon(playerid,8,999);
            }          
     }
}



Re: weapondialog not working - webhead - 28.06.2014

still not working. My complete callback in this script looks like this:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == dmdia && response)
	{
		if(response)
        {
            if(listitem == 0)
            {
		GivePlayerWeapon(playerid,31,999);
            }
            if(listitem == 1)
            {
		GivePlayerWeapon(playerid,23,999);
            }
            if(listitem == 2)
            {
		GivePlayerWeapon(playerid,25,999);
            }
            if(listitem == 3)
            {
		GivePlayerWeapon(playerid,8,999);
            }			
        }
    }
	if(dialogid == dmdia+1&& response)
	{
	     if(response)
             {  
		   if(listitem == 0)
                  {
			GivePlayerWeapon(playerid,27,999);
                   }
                  if(listitem == 1)
                 {
			GivePlayerWeapon(playerid,23,999);
                  }
                  if(listitem == 2)
                 {
		   GivePlayerWeapon(playerid,34,999);
                  }
                  if(listitem == 3)
                  {
		    GivePlayerWeapon(playerid,8,999);
                   }	
	           if(listitem==4)
	           {
		    GivePlayerWeapon(playerid,28,999);
	           }
            }
        }
}
Any ideas


Re : weapondialog not working - Clad - 28.06.2014

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dmdia && response)
    {
        if(response)
        {
            if(listitem == 0)
            {
        GivePlayerWeapon(playerid,31,999);
            }
            else if(listitem == 1)
            {
        GivePlayerWeapon(playerid,23,999);
            }
            else if(listitem == 2)
            {
        GivePlayerWeapon(playerid,25,999);
            }
            else if(listitem == 3)
            {
        GivePlayerWeapon(playerid,8,999);
            }          
        }
    }
if(dialogid == dmdia+1&& response)
    {
         if(response)
             {  
           if(listitem == 0)
                  {
            GivePlayerWeapon(playerid,27,999);
                   }
                  else if(listitem == 1)
                 {
            GivePlayerWeapon(playerid,23,999);
                  }
                  if(listitem == 2)
                 {
           GivePlayerWeapon(playerid,34,999);
                  }
                  else if(listitem == 3)
                  {
            GivePlayerWeapon(playerid,8,999);
                   }   
               else if(listitem==4)
               {
            GivePlayerWeapon(playerid,28,999);
        }
    }
    return 1;
}



Re: weapondialog not working - webhead - 28.06.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Return 0 at the end of OnDialogResponse callback for any script the server is running.
You say return 1 at the end of the code.

What is now correct?


Re : weapondialog not working - Clad - 28.06.2014

Try the code I gave you above and stop asking for every thing :S


Re: weapondialog not working - webhead - 28.06.2014

not working


Re: weapondialog not working - Konstantinos - 29.06.2014

Quote:
Originally Posted by webhead
Посмотреть сообщение
You say return 1 at the end of the code.

What is now correct?
I did say 0 and not 1. By returning 0 in OnDialogResponse callback in any script, it allows to search to other scripts for that dialogid if it's not found on the current one.