Command not working
#1

Hello, I recently made a /buyguns command for inside ammunation stores using if(IsPlayerInRangeOfPoint but for some reason when I'm inside the store and I type /buyguns....Nothing happens (Doesn't say unkown command). How can I fix this problem?

Here is my code;

Код:
CMD:buyguns(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 40, 286.148986,-40.644397,1001.515625))
	if(IsPlayerInRangeOfPoint(playerid, 40, 286.800994,-82.547599,1001.515625))
	if(IsPlayerInRangeOfPoint(playerid, 40, 296.919982,-108.071998,1001.515625))
	if(IsPlayerInRangeOfPoint(playerid, 40, 314.820983,-141.431991,999.601562))
	if(IsPlayerInRangeOfPoint(playerid, 40, 316.524993,-167.706985,999.593750))
	ShowPlayerDialog(playerid, DIALOGWEAPONS, DIALOG_STYLE_LIST, "Hello, what guns can I get you?", "Deagle(15k)\nShotgun(2.5k)\nMP5(5k)\nSpas12(170k)\nAK-47(50k)\nM4(60k)\nSniper(150k)\nHalf vest(10k)\nFull vest(20k)","Buy","Cancel");
	return 1;
}
The dialog response;

Код:
if(dialogid == DIALOGWEAPONS)
	{
	    if(response)
	    {
	        switch(listitem)
	        {
	            case 0:
			{
			    if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item! chea!");
			    SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!");
			    GivePlayerMoney(playerid, -1500);
			    GivePlayerWeapon(playerid,24, 9999999);
			}
			    case 1:
			{
				if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_GRAD, "You bought a shotgun for 2.5k!");
				GivePlayerMoney(playerid, -2500);
				GivePlayerWeapon(playerid, 25, 9999999);
			}
			    case 2:
			{
				if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_GRAD, "You bought an MP5 for 5k!");
				GivePlayerMoney(playerid, -5000);
				GivePlayerWeapon(playerid, 29 ,9999999);
			}
			    case 3:
			{
				if(GetPlayerMoney(playerid) <170000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_GRAD, "You bought a spas12 for 170k!");
				GivePlayerMoney(playerid, -170000);
				GivePlayerWeapon(playerid, 27, 9999999);
			}
				case 4:
			{
				if(GetPlayerMoney(playerid) <50000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_GRAD, "You bought an AK-47 for 50k!");
				GivePlayerMoney(playerid, -50000);
				GivePlayerWeapon(playerid,30 ,9999999);
			}
			    case 5:
			{
				if(GetPlayerMoney(playerid) <60000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_GRAD, "You bought an M4 for 60k!");
				GivePlayerMoney(playerid, -60000);
				GivePlayerWeapon(playerid, 31, 9999999);
			}
			    case 6:
			{
			    if(GetPlayerMoney(playerid) <150000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
			    SendClientMessage(playerid, COLOR_GRAD, "You bought a sniper for 150k!");
			    GivePlayerMoney(playerid, -150000);
			    GivePlayerWeapon(playerid, 34, 9999999);
			}
			    case 7:
			{
			    if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

				new Float:armour;
				GetPlayerArmour(playerid, armour);
				if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD,"You already have a full vest!");
   				SendClientMessage(playerid, COLOR_GRAD, "You bought a half vest for 10k!");
	    		GivePlayerMoney(playerid, -10000);
				SetPlayerArmour(playerid, 50);
			}
			    case 8:
			{
			    if(GetPlayerMoney(playerid) <20000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

				new Float:armour;
				GetPlayerArmour(playerid, armour);
				if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD, "You already have a full vest!");
    			SendClientMessage(playerid, COLOR_GRAD, "You bought a full vest for 20k!");
       			GivePlayerMoney(playerid, -20000);
		        SetPlayerArmour(playerid, 100);
			}

			}
			return 1;
	}
}
	return 0;
}
Any help would be appreciated. Thanks!
Reply
#2

pawn Код:
CMD:buyguns(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 40, 286.148986,-40.644397,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 286.800994,-82.547599,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 296.919982,-108.071998,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 314.820983,-141.431991,999.601562) || IsPlayerInRangeOfPoint(playerid, 40, 316.524993,-167.706985,999.593750))
    ShowPlayerDialog(playerid, DIALOGWEAPONS, DIALOG_STYLE_LIST, "Hello, what guns can I get you?", "Deagle(15k)\nShotgun(2.5k)\nMP5(5k)\nSpas12(170k)\nAK-47(50k)\nM4(60k)\nSniper(150k)\nHalf vest(10k)\nFull vest(20k)","Buy","Cancel");
    return 1;
}
Hope it works
Reply
#3

Quote:
Originally Posted by introzen
Посмотреть сообщение
pawn Код:
CMD:buyguns(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 40, 286.148986,-40.644397,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 286.800994,-82.547599,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 296.919982,-108.071998,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 314.820983,-141.431991,999.601562) || IsPlayerInRangeOfPoint(playerid, 40, 316.524993,-167.706985,999.593750))
    ShowPlayerDialog(playerid, DIALOGWEAPONS, DIALOG_STYLE_LIST, "Hello, what guns can I get you?", "Deagle(15k)\nShotgun(2.5k)\nMP5(5k)\nSpas12(170k)\nAK-47(50k)\nM4(60k)\nSniper(150k)\nHalf vest(10k)\nFull vest(20k)","Buy","Cancel");
    return 1;
}
Hope it works
It worked! Thanks a lot!!!!
Reply
#4

Quote:
Originally Posted by Josh_Main
Посмотреть сообщение
It worked! Thanks a lot!!!!
No problem! (:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)