Jump to content

Recommended Posts

Posted

Vreau ca la comanda /buybiz sa pot cumpara 2 bizzuri:

CMD:buybiz2(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    if(PlayerInfo[playerid][pPremiumAccount] == 1)
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		new string[128],sendername[25],stringcasa[128];
		if(PlayerInfo[playerid][pPbiskey] != 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You already own a business, type /sellbiztostate if you want to buy this one.");
		for(new b = 2; 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), "{FFB870}You must be level %d to purchase this.",BizzInfo[b][bLevelNeeded]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					return 1;
				}
				if(GetPlayerCash(playerid) > BizzInfo[b][bBuyPrice])
				{
					PlayerInfo[playerid][pPbiskey] = b;
					BizzInfo[b][bOwned] = 1;
					GetPlayerName(playerid, sendername, sizeof(sendername));
					strmid(BizzInfo[b][bOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
					GivePlayerCash(playerid,-BizzInfo[b][bBuyPrice]);
					GameTextForPlayer(playerid, "~w~Welcome~n~You can exit at any time by moving to this door and press enter", 5000, 3);
					if(BizzInfo[b][bSbiz] == 0)
					{
						PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
						PlayerInfo[playerid][pLocal] = b ;
						InBussines[playerid] = b;
						SetPlayerInterior(playerid,BizzInfo[b][bInterior]);
						SetPlayerVirtualWorld(playerid, BizzInfo[b][bVirtual]);
						PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
						SetPlayerPosEx(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
					}
					SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
					SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
					format(stringcasa, sizeof(stringcasa), "%s [user:%d] a cumparat bizz-ul [bizz:%d] de la Stat pentru $%s.",sendername,PlayerInfo[playerid][pSQLID],b,FormatNumber(BizzInfo[b][bBuyPrice]));
                    ABroadCast(COLOR_YELLOW, stringcasa,1);
                    new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
					getdate(y,m,d);
					gettime(h,mi,s);
					format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s[user:%d] bought bizz %d for $%s.",d,m,y,h,mi,s,sendername,PlayerInfo[playerid][pSQLID],b,FormatNumber(BizzInfo[b][bBuyPrice]));
 					mysql_real_escape_string(string2, string3);
					mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
					mysql_tquery(SQL,var100,"","");
					new str1[256];
					mysql_format(SQL,str1,sizeof(str1),"UPDATE users SET `Money`='%d',`Bizz`='%d' WHERE `name`='%s'",GetPlayerCash(playerid),PlayerInfo[playerid][pPbiskey],PlayerInfo[playerid][pNormalName]);
					mysql_tquery(SQL,str1,"","");
					mysql_format(SQL,str1,sizeof(str1),"UPDATE `bizz` SET `Owned`='1',`Owner`='%s' WHERE `ID`='%d'",BizzInfo[b][bOwner],b);
					mysql_tquery(SQL,str1,"","");
					OnPropTextdrawUpdate(2,b);
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
					return 1;
				}
			}
		}
	}
	else return SCM(playerid, COLOR_ERROR, "Nu ai un cont premium.
	return 1;
}

 

Posted
Acum 12 minute, Onehitkill a spus:

Vreau ca la comanda /buybiz sa pot cumpara 2 bizzuri:


CMD:buybiz2(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    if(PlayerInfo[playerid][pPremiumAccount] == 1)
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		new string[128],sendername[25],stringcasa[128];
		if(PlayerInfo[playerid][pPbiskey] != 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You already own a business, type /sellbiztostate if you want to buy this one.");
		for(new b = 2; 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), "{FFB870}You must be level %d to purchase this.",BizzInfo[b][bLevelNeeded]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					return 1;
				}
				if(GetPlayerCash(playerid) > BizzInfo[b][bBuyPrice])
				{
					PlayerInfo[playerid][pPbiskey] = b;
					BizzInfo[b][bOwned] = 1;
					GetPlayerName(playerid, sendername, sizeof(sendername));
					strmid(BizzInfo[b][bOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
					GivePlayerCash(playerid,-BizzInfo[b][bBuyPrice]);
					GameTextForPlayer(playerid, "~w~Welcome~n~You can exit at any time by moving to this door and press enter", 5000, 3);
					if(BizzInfo[b][bSbiz] == 0)
					{
						PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
						PlayerInfo[playerid][pLocal] = b ;
						InBussines[playerid] = b;
						SetPlayerInterior(playerid,BizzInfo[b][bInterior]);
						SetPlayerVirtualWorld(playerid, BizzInfo[b][bVirtual]);
						PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
						SetPlayerPosEx(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
					}
					SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
					SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
					format(stringcasa, sizeof(stringcasa), "%s [user:%d] a cumparat bizz-ul [bizz:%d] de la Stat pentru $%s.",sendername,PlayerInfo[playerid][pSQLID],b,FormatNumber(BizzInfo[b][bBuyPrice]));
                    ABroadCast(COLOR_YELLOW, stringcasa,1);
                    new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
					getdate(y,m,d);
					gettime(h,mi,s);
					format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s[user:%d] bought bizz %d for $%s.",d,m,y,h,mi,s,sendername,PlayerInfo[playerid][pSQLID],b,FormatNumber(BizzInfo[b][bBuyPrice]));
 					mysql_real_escape_string(string2, string3);
					mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
					mysql_tquery(SQL,var100,"","");
					new str1[256];
					mysql_format(SQL,str1,sizeof(str1),"UPDATE users SET `Money`='%d',`Bizz`='%d' WHERE `name`='%s'",GetPlayerCash(playerid),PlayerInfo[playerid][pPbiskey],PlayerInfo[playerid][pNormalName]);
					mysql_tquery(SQL,str1,"","");
					mysql_format(SQL,str1,sizeof(str1),"UPDATE `bizz` SET `Owned`='1',`Owner`='%s' WHERE `ID`='%d'",BizzInfo[b][bOwner],b);
					mysql_tquery(SQL,str1,"","");
					OnPropTextdrawUpdate(2,b);
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
					return 1;
				}
			}
		}
	}
	else return SCM(playerid, COLOR_ERROR, "Nu ai un cont premium.
	return 1;
}

 

Daca iti fac comanda nu o sa ai sistemul sa sustina 2 bizuri, este mult mai complicat decat de editat comanda asta.

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Posted
Acum 4 minute, Onehitkill a spus:

Nu poti sa-mi dai niste sfaturi sa pot sa faca asta,

vreau ca la premium sa poata lua 2

 

E usor pentru mine dar complicat pentru tine, o data ce nu poti edita comanda doar sa iti permita sa iei mai mult de 1 biz inseamna ca nu o sa iti pot da informati necesare sa il faci, doar sa ti-l fac eu .. si nu am timp sa fac.

Dar ca ideie practic copiezi tot ce tine de bizul 1 si faci Biz 2 ceva de genul ti-am dat un exemplu.

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Posted (edited)

Lasa comanda aia asa cum e, ma refer la comanda buybiz. Leaga-te de variabila

pPbiskey

 

Fa o noua variabila, pPbiskey2 si cand dai la buybiz sa cumpere pui restrictia asta:
 

if(pPbiskey == 0)
{
	// codul de la cumpararea primului business
	return 1;
}

if(pPbiskey2 == 0)
{
	// codul de la cumpararea celui de-al doilea business
	return 1;
}

 

Sau te duci la enum pInfo si la pPbiskey faci asta:

pPbiskey [MAX_BUSINESSPERPLAYER]

Sus in gamemode, unde vrei tu, pe la defineuri defineste MAX_BUSINESSPERPLAYER.

#define MAX_BUSINESSPERPLAYER 2

Daca alegi varianta asta va trebui sa iti inlocuiesti cam tot din gamemode ce tine de pPbiskey.

Aceasta functie ar trebui sa iti ia slotul liber al afacerilor:

Player_GetFreeBusinessSlot(playerid)
{
    for (new BusSlots; BusSlots < MAX_BUSINESSPERPLAYER; BusSlots++)
        if (PlayerInfo[playerid][pPbiskey][BusSlots] == 0)
            return BusSlots;
    return -1;
}

O folosesti asa: La comanda buybiz pui sa verifice daca playerul are slot liber:

new SlotLiber = Player_GetFreeBusinessSlot(playerid);

if(SlotLiber != -1)
{
	PlayerInfo[playerid][pPbiskey][SlotLiber] = b;
	//restul codului de la cumparare
}

Sper ca ai inteles si ca te-am ajutat. Treaba nu e atat de grea si de complicata daca o intelegi si o faci cu pasi logici.

Edited by BaFFyJunior
  • Thanks 1
Posted
Acum 14 minute, BaFFyJunior a spus:

Lasa comanda aia asa cum e, ma refer la comanda buybiz. Leaga-te de variabila


pPbiskey

 

Fa o noua variabila, pPbiskey2 si cand dai la buybiz sa cumpere pui restrictia asta:
 


if(pPbiskey == 0)
{
	// codul de la cumpararea primului business
	return 1;
}

if(pPbiskey2 == 0)
{
	// codul de la cumpararea celui de-al doilea business
	return 1;
}

 

Sau te duci la enum pInfo si la pPbiskey faci asta:


pPbiskey [MAX_BUSINESSPERPLAYER]

Sus in gamemode, unde vrei tu, pe la defineuri defineste MAX_BUSINESSPERPLAYER.


#define MAX_BUSINESSPERPLAYER 2

Daca alegi varianta asta va trebui sa iti inlocuiesti cam tot din gamemode ce tine de pPbiskey.

Aceasta functie ar trebui sa iti ia slotul liber al afacerilor:


Player_GetFreeBusinessSlot(playerid)
{
    for (new BusSlots; BusSlots < MAX_BUSINESSPERPLAYER; BusSlots++)
        if (PlayerInfo[playerid][pPbiskey][BusSlots] == 0)
            return BusSlots;
    return -1;
}

O folosesti asa: La comanda buybiz pui sa verifice daca playerul are slot liber:


new SlotLiber = Player_GetFreeBusinessSlot(playerid);

if(SlotLiber != -1)
{
	PlayerInfo[playerid][pPbiskey][SlotLiber] = b;
	//restul codului de la cumparare
}

Sper ca ai inteles si ca te-am ajutat. Treaba nu e atat de grea si de complicata daca o intelegi si o faci cu pasi logici.

Bun, dar totusi s-a legat de comanda de asta i-am zis .. nu putem sa facem scripturile pentru toata lumea, ar fi mult prea usor pentru ei si greu pentru noi. Felicitari!

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Posted
Acum 11 minute, Onehitkill a spus:

Imi spune ca am deja un biz 

if(PlayerInfo[playerid][pPbiskey] != 0)

Inlocuieste asta cu ce ti-am dat eu:

new SlotLiber = Player_GetFreeBusinessSlot(playerid);

if(SlotLiber == -1) return SCM(playerid, 0xFF0000CC, "Nu mai ai sloturi disponibile!"):
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.