Jump to content
  • 0

Bug /sellbiz /buybiz


Madu99

Question

Am un bug la /buybiz cand cumpar un biz si vr sa il vand si dau /sellbiz zice ca nu detin un biz  iar cand vreau sa cumpar un biz zice ca am deja un biz ...

[pawn]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, type /sellbiz if you want to buy this one.");

return 1;

}

for(new b = 0; b < sizeof(SBizzInfo); b++)

{

if(PlayerToPoint(2.0, playerid, SBizzInfo[sbEntranceX], SBizzInfo[sbEntranceY], SBizzInfo[sbEntranceZ]) && SBizzInfo[sbOwned] == 0)

{

if(PlayerInfo[playerid][pLevel] < SBizzInfo[sbLevelNeeded])

{

format(string, sizeof(string), "You Must Be Level %d To Purchase This",SBizzInfo[sbLevelNeeded]);

SendClientMessage(playerid, COLOR_GRAD5, string);

return 1;

}

if(GetPlayerMoney(playerid) > SBizzInfo[sbBuyPrice])

{

                        Delete3DTextLabel(Text3D:SBizzLabel);

PlayerInfo[playerid][pPbiskey] = b+100;

SBizzInfo[sbOwned] = 1;

GetPlayerName(playerid, sendername, sizeof(sendername));

strmid(SBizzInfo[sbOwner], sendername, 0, strlen(sendername), 255);

GivePlayerMoney(playerid,-SBizzInfo[sbBuyPrice]);

PlayerPlayMusic(playerid);

SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");

SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");

SendClientMessage(playerid, COLOR_LIGHTRED, "ATENTIE: Daca vinzi biz-ul nu o sa primesti banii de la buy !");

                        DateProp(playerid);

OnPropUpdate();

OnPlayerUpdateEx(playerid);

return 1;

}

else

{

SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");

return 1;

}

}

}

for(new b = 0; b < sizeof(BizzInfo); b++)

{

if(PlayerToPoint(2.0, playerid, BizzInfo[bEntranceX], BizzInfo[bEntranceY], BizzInfo[bEntranceZ]) && BizzInfo[bOwned] == 0)

{

if(PlayerInfo[playerid][pLevel] < BizzInfo[bLevelNeeded])

{

format(string, sizeof(string), "You Must Be Level %d To Purchase This",BizzInfo[bLevelNeeded]);

SendClientMessage(playerid, COLOR_GRAD5, string);

return 1;

}

if(GetPlayerMoney(playerid) > BizzInfo[bBuyPrice])

{

PlayerInfo[playerid][pPbiskey] = b;

BizzInfo[bOwned] = 1;

GetPlayerName(playerid, sendername, sizeof(sendername));

strmid(BizzInfo[bOwner], sendername, 0, strlen(sendername), 255);

GivePlayerMoney(playerid,-BizzInfo[bBuyPrice]);

PlayerPlayMusic(playerid);

SetPlayerInterior(playerid,BizzInfo[bInterior]);

PlayerInfo[playerid][pInt] = BizzInfo[bInterior];

SetPlayerPos(playerid,BizzInfo[bExitX],BizzInfo[bExitY],BizzInfo[bExitZ]);

GameTextForPlayer(playerid, "~w~Welcome~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);

PlayerInfo[playerid][pInt] = BizzInfo[bInterior];

PlayerInfo[playerid][pLocal] = b ;

SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");

SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");

                        DateProp(playerid);

OnPropUpdate();

OnPlayerUpdateEx(playerid);

return 1;

}

else

{

SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");

return 1;

}

}

}

}

return 1;

}

[/pawn]

Si

if(strcmp(cmd, "/sellbiz", true) == 0)

{

    if(IsPlayerConnected(playerid))

{

GetPlayerName(playerid, playername, sizeof(playername));

if(PlayerInfo[playerid][pPbiskey] == 255)

{

SendClientMessage(playerid, COLOR_WHITE, "Nu deti un Bizz.");

return 1;

}

if(PlayerInfo[playerid][pMarried] > 0)

    {

        SendClientMessage(playerid, COLOR_GREY, "Esti Casatorit nu poti vinde Bizul");

        return 1;

    }

if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)

{

new bouse = PlayerInfo[playerid][pPbiskey]-100;

//GivePlayerMoney(playerid,SBizzInfo[bouse][sbTill]);

SBizzInfo[bouse][sbLocked] = 1;

SBizzInfo[bouse][sbOwned] = 0;

GetPlayerName(playerid, sendername, sizeof(sendername));

strmid(SBizzInfo[bouse][sbOwner], "The State", 0, strlen("The State"), 255);

strmid(SBizzInfo[bouse][sbExtortion], "No-one", 0, strlen("No-one"), 255);

ConsumingMoney[playerid] = 1;

PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);

format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", SBizzInfo[bouse][sbTill]);

GameTextForPlayer(playerid, string, 10000, 3);

SBizzInfo[bouse][sbTill] = 0;

PlayerInfo[playerid][pPbiskey] = 255;

OnPropUpdate();

OnPlayerUpdateEx(playerid);

return 1;

}

if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)

{

new bouse = PlayerInfo[playerid][pPbiskey];

BizzInfo[bouse][bLocked] = 1;

BizzInfo[bouse][bOwned] = 0;

GetPlayerName(playerid, sendername, sizeof(sendername));

strmid(BizzInfo[bouse][bOwner], "The State", 0, strlen("The State"), 255);

strmid(BizzInfo[bouse][bExtortion], "No-one", 0, strlen("No-one"), 255);

ConsumingMoney[playerid] = 1;

GivePlayerMoney(playerid,BizzInfo[bouse][bTill]);

PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);

format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", BizzInfo[bouse][bTill]);

GameTextForPlayer(playerid, string, 10000, 3);

BizzInfo[bouse][bTill] = 0;

PlayerInfo[playerid][pPbiskey] = 255;

OnPropUpdate();

OnPlayerUpdateEx(playerid);

return 1;

}

else

{

SendClientMessage(playerid, COLOR_WHITE, "Nu deti un Bizz.");

}

}

return 1;

}

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Sterge comenzile sellbiz si buybiz si adauga comenzile astea:

if(strcmp(cmd, "/sellbiz", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid, playername, sizeof(playername));
			if(PlayerInfo[playerid][pPbiskey] == 255)
			{
				SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Ne pare rau, dar nu detineti un Business");
				return 1;
			}
			if(PlayerInfo[playerid][pBiz] == 0)
			{
			SendClientMessage(playerid, COLOR_GRAD1, "{30a030}[saveG]: {ffffff}Ne pare rau, dar trebuie sa fie un Admin de fata cand vindeti un Business.");
			return 1;
			}
			if(PlayerInfo[playerid][pMarried] > 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "{30a030}[saveG]: {ffffff}Ne pare rau, dar sunteti Casatorit asa ca nu puteti vinde acest Business.");
		        return 1;
		    }
			if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
			{
                Delete3DTextLabel(Text3D:SBizz3D);
				new bouse = PlayerInfo[playerid][pPbiskey]-100;
				GivePlayerMoney(playerid, 1000);
				SBizzInfo[bouse][sbLocked] = 1;
				SBizzInfo[bouse][sbOwned] = 0;
				SBizzInfo[bouse][sbBuyPrice] = 1000;
				GetPlayerName(playerid, sendername, sizeof(sendername));
				strmid(SBizzInfo[bouse][sbOwner], "The State", 0, strlen("The State"), 255);
				strmid(SBizzInfo[bouse][sbExtortion], "No-one", 0, strlen("No-one"), 255);
				ConsumingMoney[playerid] = 1;
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Ati vandut business-ul ~n~~g~1000");
				GameTextForPlayer(playerid, string, 10000, 3);
				SBizzInfo[bouse][sbTill] = 0;
				PlayerInfo[playerid][pPbiskey] = 255;
				Delete3DTextLabel(Text3D:SBizz3D);
				OnPropUpdate();
				OnPlayerUpdate(playerid);
				PlayerInfo[playerid][pBiz] = 0;
				return 1;
			}
			if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
			{
                Delete3DTextLabel(Text3D:Bizz3D);
				new bouse = PlayerInfo[playerid][pPbiskey];
				BizzInfo[bouse][bLocked] = 1;
				BizzInfo[bouse][bOwned] = 0;
				BizzInfo[bouse][bBuyPrice] = 1000;
				GetPlayerName(playerid, sendername, sizeof(sendername));
				strmid(BizzInfo[bouse][bOwner], "The State", 0, strlen("The State"), 255);
				strmid(BizzInfo[bouse][bExtortion], "No-one", 0, strlen("No-one"), 255);
				ConsumingMoney[playerid] = 1;
				GivePlayerMoney(playerid, 1000);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Ati vandut business-ul ~n~~g~1000");
				GameTextForPlayer(playerid, string, 10000, 3);
				BizzInfo[bouse][bTill] = 0;
				PlayerInfo[playerid][pPbiskey] = 255;
				Delete3DTextLabel(Text3D:Bizz3D);
				OnPropUpdate();
				OnPlayerUpdate(playerid);
				PlayerInfo[playerid][pBiz] = 0;
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Ne pare rau, dar nu detineti un Business.");
			}
		}
		return 1;
	}
        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, "{30a030}[saveG]: {ffffff}Ne pare rau, dar detii deja un Business, scrie /sellbiz pentru al Vinde.");
				return 1;
			}
			for(new b = 0; b < sizeof(SBizzInfo); b++)
			{
				if(PlayerToPoint(2.0, playerid, SBizzInfo[b][sbEntranceX], SBizzInfo[b][sbEntranceY], SBizzInfo[b][sbEntranceZ]) && SBizzInfo[b][sbOwned] == 0)
				{
					if(PlayerInfo[playerid][pLevel] < SBizzInfo[b][sbLevelNeeded])
					{
						format(string, sizeof(string), "{30a030}[saveG]: {ffffff}Ne pare rau, dai ai nevoie de Level %d pentru a cumpara acest Business.",SBizzInfo[b][sbLevelNeeded]);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						return 1;
					}
					if(GetPlayerMoney(playerid) > SBizzInfo[b][sbBuyPrice])
					{
                        Delete3DTextLabel(Text3D:SBizz3D);
						PlayerInfo[playerid][pPbiskey] = b+100;
						SBizzInfo[b][sbOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(SBizzInfo[b][sbOwner], sendername, 0, strlen(sendername), 255);
						GivePlayerMoney(playerid,-SBizzInfo[b][sbBuyPrice]);
						PlayerPlayMusic(playerid);
						SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Felicitari, aceast Business va apartine.");
						SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Scrie /businesshelp, pentru a vedea comenzile disponibile.");
						Delete3DTextLabel(Text3D:SBizz3D);
						DateProp(playerid);
						OnPropUpdate();
						OnPlayerUpdate(playerid);
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Ne pare rau, dar nu ai suficienti bani pentru a cumpara aceat 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), "{30a030}[saveG]: {ffffff}Ne pare rau, dai ai nevoie de Level %d pentru a cumpara acest Business.",BizzInfo[b][bLevelNeeded]);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						return 1;
					}
					if(GetPlayerMoney(playerid) > BizzInfo[b][bBuyPrice])
					{
                        Delete3DTextLabel(Text3D:Bizz3D);
						PlayerInfo[playerid][pPbiskey] = b;
						BizzInfo[b][bOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(BizzInfo[b][bOwner], sendername, 0, strlen(sendername), 255);
						GivePlayerMoney(playerid,-BizzInfo[b][bBuyPrice]);
						PlayerPlayMusic(playerid);
						SetPlayerInterior(playerid,BizzInfo[b][bInterior]);
						PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
						SetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
						GameTextForPlayer(playerid, "~w~Bun venit ~n~ ~w~Apasa ~g~F ~w~sau ~g~Enter ~w~pentru a iesi", 5000, 3);
						PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
						PlayerInfo[playerid][pLocal] = b ;
						SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Felicitari, aceast Business va apartine.");
						SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Scrie /businesshelp, pentru a vedea comenzile disponibile.");
						Delete3DTextLabel(Text3D:Bizz3D);
                        DateProp(playerid);
						OnPropUpdate();
						OnPlayerUpdate(playerid);
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "{30a030}[saveG]: {ffffff}Ne pare rau, dar nu ai suficienti bani pentru a cumpara aceat Business.");
						return 1;
					}
				}
			}
		}
		return 1;
	}

LISTA - GAMEMODE-URI SA-MP - Le gasiti pe toate aici: http://twiriock.com/3MGP

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.