Help with OnDialogResponse
#1

NOTE BEFORE READING! I'm not a complete retard like some of the other people saying plz help. I somewhat know what i'm doing. I just need a hand.


I'm somewhat new to scripting, I've been scripting about a month now. I've currently been scripting a paintball script so when you type a command it teleports you etc. I'm making a shop where you buy guns, My attackers shop is working perfetly, It's all connected right i guess. The defenders shop is the one that gives me errors. When i make the ShowPlayerDialog It shows all very well. But when i enable the script for the OnDialogResponse it starts to go crazy, Here are my commands.

WORKING ONES
Код:
if (strcmp(cmd, "/ashop", true) == 0)


{
	  if(IsPlayerConnected(playerid))
	  	 {
  			if(IsPlayerInRangeOfPoint(playerid, 3.0, 3175.3003, -1141.0750, 30.6428))

			{
			  SendClientMessage(playerid, COLOR_GRAD2, "* You are not near the shop !");
			  return 1;
		  }
	    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Weapon Lists", "Kevlar Vest\nKnife\nColt45\nMac10\nAK-47\nShotgun\nSpas12\nSniper Rifle\nMolotov Cocktails", "Select", "Cancel");
		}
		return 1;
	}
And this is the OnDialogResponse for the /ashop
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1)
	{
		if(response)
		{
			if(listitem == 0)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up a Kevlar Vest from the shelf !");
				  SetPlayerArmour(playerid, 100);
			}

			if(listitem == 1)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Knife from the draw !");
				  GivePlayerWeapon(playerid, 4, 100000);//Knife
			}

			if(listitem == 2)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Colt 45 from the shelf !");
				  GivePlayerWeapon(playerid, 22, 100000);//Colt 45
			}

			if(listitem == 3)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Mac-10 from the shelf !");
				  GivePlayerWeapon(playerid, 28, 100000);// tec 9
			}

			if(listitem == 4)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up an AK47 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 30, 100000);//AK
			}

			if(listitem == 5)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Shotgun from the Gun Locker !");
          GivePlayerWeapon(playerid, 25, 100000);//shotgun

			}

			if(listitem == 6)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a SPAS 12 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 27, 100000);//spas12
			}

			if(listitem == 7)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Sniper Rifle out of the Gun Locker !");
				  GivePlayerWeapon(playerid, 34, 100000);//Sniper Rifle
			}

			if(listitem == 8)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Molotov Cocktail's from the shelf !");
				  GivePlayerWeapon(playerid, 18, 2);//Molotov Cocktail
			}


 }

		return 1;
	}
	return 0;
}
This is the /dshop where only the ShowPlayerDialog works.
Код:
if (strcmp(cmd, "/dshop", true) == 0)

	{
  
	  if(IsPlayerConnected(playerid))
	  {
  if(IsPlayerInRangeOfPoint(playerid, 3.0, 2106.1311,-1837.8669,10.3766))

		{
	 SendClientMessage(playerid, COLOR_GRAD2, "* You are not near the shop !");
			  return 1;
		  }
	    ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Lists", "Kevlar Vest\nKnife\nDesert Eagle\nMP5\nM4\nSpas12\nSniper Rifle\nGrenades\nTeargas", "Select", "Cancel");
		}
		return 1;
	}
Then this is the Response, That gives me all the errors.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

		}
{
  if(dialogid == DIALOGID)
	{
		if(response)
		{
			if(listitem == 0)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up a Kevlar Vest from the shelf !");
				  SetPlayerArmour(playerid, 100);
			}

			if(listitem == 1)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a knife from the draw !");
				  GivePlayerWeapon(playerid, 4, 100000);//Knife
			}

			if(listitem == 2)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Desert Eagle from the shelf !");
				  GivePlayerWeapon(playerid, 24, 100000);//Deagle
			}

			if(listitem == 3)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have have taken an MP5 from the shelf !");
				  GivePlayerWeapon(playerid, 29, 100000);//mp5
			}

			if(listitem == 4)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken an M4 from the shelf !");
				  GivePlayerWeapon(playerid, 31, 100000);//M4
			}

			if(listitem == 5)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a SPAS 12 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 27, 100000);//spas12

			}

			if(listitem == 6)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have carefully taken a Sniper Rifle out of the Gun Locker !");
				  GivePlayerWeapon(playerid, 34, 100000);//Sniper Rifle
			}
			if(listitem == 7)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Grenade's from the shelf");
				  GivePlayerWeapon(playerid, 16, 2);//Naids
			}
			if(listitem == 8)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Tear Gas' from the shelf !");
				  GivePlayerWeapon(playerid, 17, 2);//Tear Gas
			}
 


 }

		return 1;
	}
	return 0;
	
	
}
And then the errors. When i enable the response..
Код:
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1686) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1688) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1690) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1692) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1694) : error 055: start of function body without function header
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1699) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1701) : error 055: start of function body without function header
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1706) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1709) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1713) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1716) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1720) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1723) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1727) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1730) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1733) : error 054: unmatched closing brace ("}")
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1735) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1738) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1741) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1744) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1747) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1750) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1756) : error 054: unmatched closing brace ("}")
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1758) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1760) : error 010: invalid function or declaration
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1763) : error 054: unmatched closing brace ("}")

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#2

Try this
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == DIALOGID)
    {
        if(response)
        {
            if(listitem == 0)

            {
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up a Kevlar Vest from the shelf !");
                  SetPlayerArmour(playerid, 100);
            }

            if(listitem == 1)

            {
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a knife from the draw !");
                  GivePlayerWeapon(playerid, 4, 100000);//Knife
            }

            if(listitem == 2)
            {

                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Desert Eagle from the shelf !");
                  GivePlayerWeapon(playerid, 24, 100000);//Deagle
            }

            if(listitem == 3)
            {

                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have have taken an MP5 from the shelf !");
                  GivePlayerWeapon(playerid, 29, 100000);//mp5
            }

            if(listitem == 4)
            {

                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken an M4 from the shelf !");
                  GivePlayerWeapon(playerid, 31, 100000);//M4
            }

            if(listitem == 5)
            {

                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a SPAS 12 from the Gun Locker !");
                  GivePlayerWeapon(playerid, 27, 100000);//spas12

            }

            if(listitem == 6)
            {

                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have carefully taken a Sniper Rifle out of the Gun Locker !");
                  GivePlayerWeapon(playerid, 34, 100000);//Sniper Rifle
            }
            if(listitem == 7)
            {

                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Grenade's from the shelf");
                  GivePlayerWeapon(playerid, 16, 2);//Naids
            }
            if(listitem == 8)
            {

                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Tear Gas' from the shelf !");
                  GivePlayerWeapon(playerid, 17, 2);//Tear Gas
            }
        }
    }
    return true;
}
Reply
#3

Okay that worked

I'm only getting one error now.
Код:
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1757) : error 021: symbol already defined: "OnDialogResponse"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I'm not sure how to do this, Can you merge these two OnDialogResponse's together for me please ?
Код:
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == DIALOGID)
	{
		if(response)
		{
			if(listitem == 0)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up a Kevlar Vest from the shelf !");
				  SetPlayerArmour(playerid, 100);
			}

			if(listitem == 1)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a knife from the draw !");
				  GivePlayerWeapon(playerid, 4, 100000);//Knife
			}

			if(listitem == 2)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Desert Eagle from the shelf !");
				  GivePlayerWeapon(playerid, 24, 100000);//Deagle
			}

			if(listitem == 3)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have have taken an MP5 from the shelf !");
				  GivePlayerWeapon(playerid, 29, 100000);//mp5
			}

			if(listitem == 4)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken an M4 from the shelf !");
				  GivePlayerWeapon(playerid, 31, 100000);//M4
			}

			if(listitem == 5)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a SPAS 12 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 27, 100000);//spas12

			}

			if(listitem == 6)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have carefully taken a Sniper Rifle out of the Gun Locker !");
				  GivePlayerWeapon(playerid, 34, 100000);//Sniper Rifle
			}
			if(listitem == 7)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Grenade's from the shelf");
				  GivePlayerWeapon(playerid, 16, 2);//Naids
			}
			if(listitem == 8)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Tear Gas' from the shelf !");
				  GivePlayerWeapon(playerid, 17, 2);//Tear Gas
			}
		}
	}
	return true;
}
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1)
	{
		if(response)
		{
			if(listitem == 0)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up a Kevlar Vest from the shelf !");
				  SetPlayerArmour(playerid, 100);
			}

			if(listitem == 1)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Knife from the draw !");
				  GivePlayerWeapon(playerid, 4, 100000);//Knife
			}

			if(listitem == 2)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Colt 45 from the shelf !");
				  GivePlayerWeapon(playerid, 22, 100000);//Colt 45
			}

			if(listitem == 3)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Mac-10 from the shelf !");
				  GivePlayerWeapon(playerid, 28, 100000);// tec 9
			}

			if(listitem == 4)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up an AK47 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 30, 100000);//AK
			}

			if(listitem == 5)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Shotgun from the Gun Locker !");
          GivePlayerWeapon(playerid, 25, 100000);//shotgun

			}

			if(listitem == 6)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a SPAS 12 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 27, 100000);//spas12
			}

			if(listitem == 7)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Sniper Rifle out of the Gun Locker !");
				  GivePlayerWeapon(playerid, 34, 100000);//Sniper Rifle
			}

			if(listitem == 8)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Molotov Cocktail's from the shelf !");
				  GivePlayerWeapon(playerid, 18, 2);//Molotov Cocktail
			}


 }

		return 1;
	}
	return 0;
}
Reply
#4

Quote:
Originally Posted by xLowrider
Okay that worked

I'm only getting one error now.
Код:
C:\Documents and Settings\Jack\Desktop\samp03asvr_R3_win32\gamemodes\bare.pwn(1757) : error 021: symbol already defined: "OnDialogResponse"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I'm not sure how to do this, Can you merge these two OnDialogResponse's together for me please ?
Код:
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == DIALOGID)
	{
		if(response)
		{
			if(listitem == 0)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up a Kevlar Vest from the shelf !");
				  SetPlayerArmour(playerid, 100);
			}

			if(listitem == 1)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a knife from the draw !");
				  GivePlayerWeapon(playerid, 4, 100000);//Knife
			}

			if(listitem == 2)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Desert Eagle from the shelf !");
				  GivePlayerWeapon(playerid, 24, 100000);//Deagle
			}

			if(listitem == 3)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have have taken an MP5 from the shelf !");
				  GivePlayerWeapon(playerid, 29, 100000);//mp5
			}

			if(listitem == 4)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken an M4 from the shelf !");
				  GivePlayerWeapon(playerid, 31, 100000);//M4
			}

			if(listitem == 5)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a SPAS 12 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 27, 100000);//spas12

			}

			if(listitem == 6)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have carefully taken a Sniper Rifle out of the Gun Locker !");
				  GivePlayerWeapon(playerid, 34, 100000);//Sniper Rifle
			}
			if(listitem == 7)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Grenade's from the shelf");
				  GivePlayerWeapon(playerid, 16, 2);//Naids
			}
			if(listitem == 8)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Tear Gas' from the shelf !");
				  GivePlayerWeapon(playerid, 17, 2);//Tear Gas
			}
		}
	}
	return true;
}
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1)
	{
		if(response)
		{
			if(listitem == 0)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up a Kevlar Vest from the shelf !");
				  SetPlayerArmour(playerid, 100);
			}

			if(listitem == 1)

			{
				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Knife from the draw !");
				  GivePlayerWeapon(playerid, 4, 100000);//Knife
			}

			if(listitem == 2)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Colt 45 from the shelf !");
				  GivePlayerWeapon(playerid, 22, 100000);//Colt 45
			}

			if(listitem == 3)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Mac-10 from the shelf !");
				  GivePlayerWeapon(playerid, 28, 100000);// tec 9
			}

			if(listitem == 4)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have picked up an AK47 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 30, 100000);//AK
			}

			if(listitem == 5)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Shotgun from the Gun Locker !");
          GivePlayerWeapon(playerid, 25, 100000);//shotgun

			}

			if(listitem == 6)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a SPAS 12 from the Gun Locker !");
				  GivePlayerWeapon(playerid, 27, 100000);//spas12
			}

			if(listitem == 7)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken a Sniper Rifle out of the Gun Locker !");
				  GivePlayerWeapon(playerid, 34, 100000);//Sniper Rifle
			}

			if(listitem == 8)
			{

				  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have taken 2 Molotov Cocktail's from the shelf !");
				  GivePlayerWeapon(playerid, 18, 2);//Molotov Cocktail
			}


 }

		return 1;
	}
	return 0;
}
Delete your current OnDialogResponse. Leave mine.
Reply
#5

WRong topic
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)