weapondialog not working
#1

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
Reply
#2

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

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

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);
            }          
     }
}
Reply
#5

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
Reply
#6

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;
}
Reply
#7

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?
Reply
#8

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

not working
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)