About the weapon shop script.
#2

Quote:
Originally Posted by SuNL1GhT
Посмотреть сообщение
Hello,I like to ask you for help me check this script if it is wrong,cause it got some errors.
These are the error.
I made these script by using Notepad++.(Newbie scripter.)

Код:
Weaponset.pwn(227 -- 228) : error 029: invalid expression, assumed zero
Weaponset.pwn(228) : warning 217: loose indentation
Weaponset.pwn(228) : warning 215: expression has no effect
Weaponset.pwn(228) : error 001: expected token: ";", but found ")"
Weaponset.pwn(228) : error 029: invalid expression, assumed zero
Weaponset.pwn(228) : fatal error 107: too many error messages on one line

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


4 Errors.
The command script is,
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/weapons", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Weapons Shop","Pistol($1000)\nSilenced Pistol($2000)\nDesert Eagle($5000)\nShotgun($2500)\nSawn-off Shotgun($5000)\nCombat Shotgun($7500)\nUzi Machine Gun($5000)\nMP5($7500)\nTec-9($10000)\nAK-47($10000)\nM4($20000)","Buy","Cancel");
		return 1;
	}
	return 0;
}
And finally is the script.(It's quite big.)
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if (dialogid == 20320 && response)
	(
		switch (listitem)
		(
			case 0:
			(
				ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Weapons Shop","Pistol($1000)\nSilenced Pistol($2000)\nDesert Eagle($5000)\nShotgun($2500)\nSawn-off Shotgun($5000)\nCombat Shotgun($7500)\nUzi Machine Gun($5000)\nMP5($7500)\nTec-9($10000)\nAK-47($10000)\nM4($20000)","Buy","Cancel"
			)
		)
	)
	if (dialogid == 20321 && response)
	(
		switch (listitem)
		(
			case 0:
			(
			if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 22, 1000);
			GivePlayerMoney(playerid, -1000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $1000 for 1000 ammo.Use it wisely!");
			)
			case 1:
			if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 23, 1000);
			GivePlayerMoney(playerid, -2000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $2000 for 1000 ammo.Use it wisely!");
			)
			case 3:
			(
			if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 24, 1000);
			GivePlayerMoney(playerid, -5000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $5000 for 1000 ammo.Use it wisely!");
			)
			case 4:
			(
			if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 25, 1000);
			GivePlayerMoney(playerid, -2500);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $2500 for 1000 ammo.Use it wisely!"); 
			)
			case 5:
			(
			if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 26, 1000);
			GivePlayerMoney(playerid, -5000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $5000 for 1000 ammo.Use it wisely!");
			)
			case 6:
			(
			if(GetPlayerMoney(playerid) < 7500) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 27, 1000);
			GivePlayerMoney(playerid, -7500);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $7500 for 1000 ammo.Use it wisely!");
			)
			case 7:
			(
			if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 28, 1000);
			GivePlayerMoney(playeris, -5000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $5000 for 1000 ammo.Use it wisely!");
			)
			case 8:
			(
			if(GetPlayerMoney(playerid) < 7500) return SendClientMessage(playerid, 0xFFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 29, 1000);
			GivePlayerMoney(playerid, -7500);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $7500 for 1000 ammo.Use it wisely!");
			)
			case 9:
			(
			if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 32, 1000);
			GivePlayerMoney(playerid, -10000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $10000 for 1000 ammo.Use it wisely!");
			)
			case 10:
			(
			if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 30, 1000);
			GivePlayerMoney(playerid, -10000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $10000 for 1000 ammo.Use it wisely!");
			)
			case 11:
			if(GetPlayerMoney(playerid) < 20000) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR:You have not enough money to buy this weapon.");
			GivePlayerWeapon(playerid, 31, 1000);
			GivePlayerMoney(playerid, -20000);
			SendClientMessage(playerid, 0xFFFFFFFF, "INFO:You have buy this weapon with $20000 for 1000 ammo.Use it wisely!");
			)			
		)
	)	
	return 1;
}
Hello mate, the code you made is not correct, you have used round brackets everywhere "(" and ")" which is wrong. You have to use a flower bracket "}" or "{". And please follow the link below as it teaches newbie people how to work on OnDialogResponse.

Good luck.

https://sampwiki.blast.hk/wiki/OnDialogResponse

-FalconX
Reply


Messages In This Thread
About the weapon shop script. - by SuNL1GhT - 25.02.2012, 12:50
Re: About the weapon shop script. - by FalconX - 25.02.2012, 21:54
Re: About the weapon shop script. - by SuNL1GhT - 26.02.2012, 01:15
Re: About the weapon shop script. - by FalconX - 26.02.2012, 01:17
Re: About the weapon shop script. - by SuNL1GhT - 26.02.2012, 01:34
Re: About the weapon shop script. - by FalconX - 26.02.2012, 01:46

Forum Jump:


Users browsing this thread: 1 Guest(s)