SA-MP Forums Archive
Brackets - 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: Brackets (/showthread.php?tid=636782)



Brackets - TeKno - 03.07.2017

Hi,
Can anyone tell me where are the brackets missing in the code given below

Код:
  if(dialogid == DIALOG_FREESHOP)
        {
             if(response)
            {
                if (playerData[playerid][playerVIPLevel] >= 3)
                {
	                case 1:
	                {
	                     GivePlayerWeaponEx(playerid, WEAPON_CHAINSAW, 1);
	                }
	                case 2:
	                {
	                GivePlayerWeaponEx(playerid, WEAPON_DEAGLE, 6000);
	                }
	                case 3:
	                {
	                GivePlayerWeaponEx(playerid, WEAPON_SAWEDOFF, 6000);
	                }
	                case 4:
	                {
	                GivePlayerWeaponEx(playerid, WEAPON_AK47, 6000);
	                }
	                case 5:
	                {
	                GivePlayerWeaponEx(playerid, WEAPON_SNIPER, 6000);
	                }
	                case 6:
	                {
	                GivePlayerWeaponEx(playerid, WEAPON_PARACHUTE, 1);
					}
	            }
			}
			return 1;
        }



Re: Brackets - Freedom. - 03.07.2017

You forget to add this switch(listitem)

Код:
if (dialogid == DIALOG_FREESHOP)
{
	if (response)
	{
		if (playerData[playerid][playerVIPLevel] >= 3)
		{
			switch(listitem)
   			{
				case 1: GivePlayerWeaponEx(playerid, WEAPON_CHAINSAW, 1);
				case 2: GivePlayerWeaponEx(playerid, WEAPON_DEAGLE, 6000);
				case 3: GivePlayerWeaponEx(playerid, WEAPON_SAWEDOFF, 6000);
				case 4: GivePlayerWeaponEx(playerid, WEAPON_AK47, 6000);
				case 5: GivePlayerWeaponEx(playerid, WEAPON_SNIPER, 6000);
				case 6: GivePlayerWeaponEx(playerid, WEAPON_PARACHUTE, 1);
			}
		}
	}
}



Re: Brackets - TeKno - 03.07.2017

same issue.. The pawno crashes


Re: Brackets - Freedom. - 03.07.2017

There is no missing brackets here. Check other codes.


Re: Brackets - TeKno - 03.07.2017

this code causes the pawno to crash


Re: Brackets - mongi - 03.07.2017

Quote:
Originally Posted by TeKno
Посмотреть сообщение
this code causes the pawno to crash
Server chatlog may help?


Re: Brackets - Meller - 03.07.2017

Where did you place this code?


Re: Brackets - TeKno - 03.07.2017

ondialogresponse


Re: Brackets - Meller - 03.07.2017

Show the full code, including the codes outside OnDialogResponse.

Aswell as, show the definition of the WEAPON_x variables and the GivePlayerWeaponEx function.


Re: Brackets - TeKno - 03.07.2017

there is a problem in this code... the code compiles easily if i remove this piece