I need /sellbiz /sellhouse cmd [+1 REP]
#1

I dont have any sell command for business and houses, and i need your help.

There are the buy commands i hope it can help:

Код:
if(strcmp(cmd, "/buybiz", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new Float:oldposx, Float:oldposy, Float:oldposz;
			GetPlayerName(playerid, playername, sizeof(playername));
			GetPlayerPos(playerid, oldposx, oldposy, oldposz);
			if(PlayerInfo[playerid][pPbiskey] != 255)
			{
				SendClientMessage(playerid, COLOR_WHITE, "You already own a business!");
				return 1;
			}
			for(new b = 0; b < sizeof(BizzInfo); b++)
			{
				if(PlayerToPoint(2.0, playerid, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]) && BizzInfo[b][bOwned] == 0)
				{
					if(PlayerInfo[playerid][pLevel] < BizzInfo[b][bLevelNeeded])
					{
						format(string, sizeof(string), "You need level %d to buy this business",BizzInfo[b][bLevelNeeded]);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						return 1;
					}
					if(PlayerInfo[playerid][pCash] > BizzInfo[b][bBuyPrice])
					{
						PlayerInfo[playerid][pPbiskey] = b;
						BizzInfo[b][bOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(BizzInfo[b][bOwner], sendername, 0, strlen(sendername), 255);
						PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizzInfo[b][bBuyPrice];
						PlayerPlayMusic(playerid);
						GameTextForPlayer(playerid, "~w~Welcome~n~To exit just type /exit", 5000, 3);
						SendClientMessage(playerid, COLOR_WHITE, "Congratulations for the business.");
						SendClientMessage(playerid, COLOR_WHITE, "If you need help type /businesshelp.");
						OnPropUpdate();
						SavePlayerData(playerid);
						OnPropTextdrawUpdate(2, b);
						if(b == 0 || b == 1)
						{
						    SetPlayerCheckpoint(playerid, 314.2583,-134.3235,999.6016, 1.3);
							CPBiz[playerid] = 1;
						}
						if(b == 2)
						{
						    SetPlayerCheckpoint(playerid, -784.6074,500.0738,1371.7422, 1.3);
						    CPBiz[playerid] = 2;
						}
						if(b == 5)
						{
						    SetPlayerCheckpoint(playerid, 2200.8516,1606.9673,999.9688, 1.3);
						    CPBiz[playerid] = 3;
						}
						if(BizzInfo[b][bvw] == 0)
						{
						    return 1;
						}
						SetPlayerInterior(playerid,BizzInfo[b][bInterior]);
						SetPlayerVirtualWorld(playerid, BizzInfo[b][bvw]);
						SetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
						PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
						PlayerInfo[playerid][pLocal] = b+99;
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
						return 1;
					}
				}
			}
		}
		return 1;
	}
Код:
if(strcmp(cmd, "/buyhouse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			new Float:oldposx, Float:oldposy, Float:oldposz;
			GetPlayerName(playerid, playername, sizeof(playername));
			GetPlayerPos(playerid, oldposx, oldposy, oldposz);
			for(new h = 0; h < sizeof(HouseInfo); h++)
			{
				if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
				{
					if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
					{
						format(string, sizeof(string), "You must be Level %d to purchase this !", HouseInfo[h][hLevel]);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						return 1;
					}
					if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
					{
						SendClientMessage(playerid, COLOR_WHITE, "You already own a house");
						return 1;
					}
					if(PlayerInfo[playerid][pCash] > HouseInfo[h][hValue])
					{
						PlayerInfo[playerid][pPhousekey] = h;
						HouseInfo[h][hOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
						PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] -HouseInfo[h][hValue];
						PlayerPlayMusic(playerid);
						SetPlayerInterior(playerid,HouseInfo[h][hInt]);
						SetPlayerVirtualWorld(playerid, HouseInfo[h][hvw]);
						SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
						GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
						PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
						PlayerInfo[playerid][pLocal] = h;
						PlayerInfo[playerid][pvw] = HouseInfo[h][hvw];
						SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
						SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
						OnPropUpdate();
						SavePlayerData(playerid);
                        OnPropTextdrawUpdate(1, h);
                        HouseCP[playerid][h] = CreateDynamicCP(HouseInfo[h][hCPx],HouseInfo[h][hCPy],HouseInfo[h][hCPz],1.3, HouseInfo[h][hvw], HouseInfo[h][hInt], playerid, 50.0);
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that !");
					}
				}
			}
		}
		return 1;
	}
I want just a simple /sellbiz and /sellhouse cmd what make the business/house for sale

Here is the /asellbiz and /asellhouse cmd, make him for players, and just for the biz/house owner:

Код:
if(strcmp(cmd, "/asellbiz", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid, playername, sizeof(playername));
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /asellbiz [bizid]");
				return 1;
			}
			new biz = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
				BizzInfo[biz][bLocked] = 1;
				BizzInfo[biz][bOwned] = 0;
				strmid(BizzInfo[biz][bOwner], "The State", 0, strlen("The State"), 255);
				strmid(BizzInfo[biz][bExtortion], "No-one", 0, strlen("No-one"), 255);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~You have sold the Business");
				GameTextForPlayer(playerid, string, 10000, 3);
				OnPropUpdate();
				SavePlayerData(playerid);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "You are not an admin.");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/asellhouse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid, playername, sizeof(playername));
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /asellhouse [houseid]");
				return 1;
			}
			new house = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
				HouseInfo[house][hHel] = 0;
				HouseInfo[house][hArm] = 0;
				HouseInfo[house][hLock] = 1;
				HouseInfo[house][hOwned] = 0;
				strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~You have sold this property", HouseInfo[house][hValue]);
				GameTextForPlayer(playerid, string, 10000, 3);
				OnPropUpdate();
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "You are not an admin.");
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)