Help with command
#1

Hey guys
/buy command for business, all i want is it will detect the player if he in ammunation or 24/7 market

24/7 market:
if the player typed for example "/buy 9mm" and he isnt in ammunation -
Код:
SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
ammunation:
if the player typed for example "/buy cellphone" and he isnt in 24/7 market -
Код:
SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the 24/7 Market!");
My problem is whereever i stand inside business -
Код:
SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the 24/7 Market!");
no matter if it 24/7 or ammunation

/buy command (not full version but strcmp are all the same)

Код:
CMD:buy(playerid, params[])
{
	new idx = GetPlayerVirtualWorld(playerid)-100, string[128], price, bizlevel;
	if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 1 && BizInfo[idx][bType] != 2 && BizInfo[idx][bType] != 3 && BizInfo[idx][bType] != 4 && BizInfo[idx][bType] != 6 && BizInfo[idx][bType] != 7 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business.");
	
	if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buy [item]");
	if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products.");
	{

	// 24/7 Market
	if(strcmp(params, "cellphone", true) == 0) price = 500, bizlevel = 1;
	if(strcmp(params, "phonebook", true) == 0) price = 2000, bizlevel = 1;
	if(strcmp(params, "dice", true) == 0) price = 100, bizlevel = 1;
	if(strcmp(params, "condom", true) == 0) price = 50, bizlevel = 1;
	if(strcmp(params, "cdplayer", true) == 0) price = 300, bizlevel = 3;
	if(strcmp(params, "spraycan", true) == 0) price = 200, bizlevel = 2;
	if(strcmp(params, "rope", true) == 0) price = 200, bizlevel = 2;
	if(strcmp(params, "blindfold", true) == 0) price = 200, bizlevel = 3;
	if(strcmp(params, "cutters", true) == 0) price = 3000, bizlevel = 5;
	if(strcmp(params, "cigar", true) == 0) price = 50, bizlevel = 1;
	if(strcmp(params, "sprunk", true) == 0) price = 10, bizlevel = 2;
	if(strcmp(params, "lock", true) == 0) price = 3000, bizlevel = 4;
	if(strcmp(params, "radio", true) == 0) price = 10000, bizlevel = 5;
	if(strcmp(params, "camera", true) == 0) price = 200, bizlevel = 4;
	if(strcmp(params, "lottoticket", true) == 0) price = 200, bizlevel = 2;
//	if(strcmp(params, "gascan", true) == 0) price = 200, bizlevel = 3;
	if(strcmp(params, "checks", true) == 0) price = 100, bizlevel = 3;
	if(strcmp(params, "speedometer", true) == 0) price = 2000, bizlevel = 4;
	
	
	// Ammunation
	if(strcmp(params, "9mm", true) == 0) price = 500, bizlevel = 1;
	if(strcmp(params, "shotgun", true) == 0) price = 2000, bizlevel = 1;
	if(strcmp(params, "mp5", true) == 0) price = 1500, bizlevel = 2;
	if(strcmp(params, "rifle", true) == 0) price = 3500, bizlevel = 2;
	if(strcmp(params, "deagle", true) == 0) price = 3000, bizlevel = 3;
	if(strcmp(params, "vest", true) == 0) price = 2000, bizlevel = 3;
	if(strcmp(params, "ak47", true) == 0) price = 4500, bizlevel = 4;
	if(strcmp(params, "m4", true) == 0) price = 5000, bizlevel = 4;
	if(strcmp(params, "spas12", true) == 0) price = 7000, bizlevel = 5;
	if(strcmp(params, "sniper", true) == 0) price = 10000, bizlevel = 5;
	
	
	if(BizInfo[idx][bLevel] < bizlevel) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have this product yet.");
	
	if(IsPlayerInRangeOfPoint(playerid, 20, 2233.8032,1712.2303,1011.7632))
	{
		if(strcmp(params, "phonebook", true) == 0)
		{
			PlayerInfo[playerid][pPhoneBook] = 1;
			format(string, sizeof(string), "Phonebook purchased, you can now look up other player's numbers.");
			SendClientMessageEx(playerid, COLOR_GRAD4, string);
			SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /number <id/name>.");
		}	
		if(strcmp(params, "speedometer", true) == 0)
		{
			PlayerInfo[playerid][pSpeedo] = 1;
			PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, COLOR_GRAD4, "Speedometer purchased.");
			SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /speedo to use.");			
		}
		
		if(GetPlayerMoney(playerid) < price) return SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		BizInfo[idx][bProducts] --;
		BizInfo[idx][bSold] ++;
		if(PlayerInfo[playerid][pDonateRank] >= 2)
		{
			GivePlayerCash(playerid, -(80*price)/100);
			BizInfo[idx][bMoney] += price;
			format(string, sizeof(string), "VIP: You have received 20 percent off this product. Instead of paying $%d, you paid $%d.", price, (80*price)/100);
			SendClientMessageEx(playerid, COLOR_YELLOW, string);
		}
		else
		{
			BizInfo[idx][bMoney] += price;
			GivePlayerCash(playerid, -price);
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the 24/7 Market!");
		return 1;
	}
		
	if(IsPlayerInRangeOfPoint(playerid, 20, 207.659606,-111.265319,1005.132812))
	{
		if(strcmp(params, "9mm", true) == 0)
		{
			format(string, sizeof(string), "* %s has bought 120 9mm bullets for $%d.", GetPlayerNameEx(playerid), price);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			GivePlayerValidWeapon(playerid, 22, 120);
		}	
		if(strcmp(params, "deagle", true) == 0)
		{
			format(string, sizeof(string), "* %s has bought 120 deagle bullets for $%d.", GetPlayerNameEx(playerid), price);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			GivePlayerValidWeapon(playerid, 24, 120);
		}
		if(GetPlayerMoney(playerid) < price) return SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
		BizInfo[idx][bProducts] --;
		BizInfo[idx][bSold] ++;
		if(PlayerInfo[playerid][pDonateRank] >= 2)
		{
			GivePlayerCash(playerid, -(80*price)/100);
			BizInfo[idx][bMoney] += price;
			format(string, sizeof(string), "VIP: You have received 20 percent off this product. Instead of paying $%d, you paid $%d.", price, (80*price)/100);
			SendClientMessageEx(playerid, COLOR_YELLOW, string);
		}
		else
		{
			BizInfo[idx][bMoney] += price;
			GivePlayerCash(playerid, -price);
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
		return 1;
		}
	}		
	return 1;
}
what's wrong here? +REP
Reply
#2

In your /buy command add PlayerPos and make it equal with business or ammunation, I have the same system in my server
Reply
#3

Quote:
Originally Posted by Clad
Посмотреть сообщение
In your /buy command add PlayerPos and make it equal with business or ammunation, I have the same system in my server
Okay another var - BizInfo[idx][bType] (type 1 24/7 type 3 ammu)
i dont understand what you mean.
What to equal playerpos and to what? can you give an example please?
Reply
#4

BUMP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)