Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Question

Posted

Salut am si eu urmatoare problema

Cand dau sa cumpar o casa imi zice ca nu am 30 de ore pentru a putea cumpara casa.

Si nu stiu cum sa scot chestia asta din comanda am incercat cu // verificarea dar degeaba nu imi cumpara casa.

YCMD:buybusiness(playerid, params[], help)
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		new string[128],sendername[25],stringcasa[128],strr[256],time,count;
		if(PlayerInfo[playerid][pPbiskey] != 255) return SendClientMessage(playerid, COLOR_GREY, "You already own a business, type /sellbiztostate if you want to buy this one.");
		for(new b = 1; b < sizeof(BizzInfo); b++)
		{
			if(PlayerToPoint(2.0, playerid, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]))
			{
				if(PlayerInfo[playerid][pLevel] < BizzInfo[b][bLevelNeeded])
				{
					format(string, sizeof(string), "You must be level %d to purchase this business.",BizzInfo[b][bLevelNeeded]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					return 1;
				}
				format(strr, sizeof(strr), "SELECT * FROM `timeplayed` WHERE `pid`='%d'", PlayerInfo[playerid][pSQLID]);
				new Cache: salut = mysql_query(SQL, strr);
				for(new i, j = cache_get_row_count (); i != j; ++i)
				{
					if(count < 30)
					{
						time += cache_get_field_content_int(i, "time");
						count++;
					}
				}
				cache_delete(salut);
				if(time < 36000) return SS(playerid, COLOR_LIGHTGREEN3, "Trebuie sa ai 10 ore jucate in ultimele 30 de zile (fara AFK/sleep) pentru a putea cumpara o proprietate.", "You need 10 played hours in last 30 days (without AFK/sleep) to buy a property.");
				if(BizzInfo[b][bOwned] == 0)
				{
					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]);
						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 purchase!");
						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],string2[256];
	 					mysql_real_escape_string(stringcasa, string2);
						mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`) VALUES ('%d','0','%s')", PlayerInfo[playerid][pSQLID],string2);
						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 return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
				}
				else if(BizzInfo[b][bOwned] == 1 && BizzInfo[b][bPrice] > 0)
				{
					if(GetPlayerCash(playerid) < BizzInfo[b][bPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money.");
					new ownerid, query[256];
					GetPlayerName(playerid, sendername, sizeof(sendername));
					PlayerInfo[playerid][pPbiskey] = b;
					BizzInfo[b][bOwned] = 1;
					format(query, sizeof(query), "SELECT * FROM `users` WHERE `name`='%s'", BizzInfo[b][bOwner]);
					new Cache: result = mysql_query(SQL, query);
					for(new i, j = cache_get_row_count (); i != j; ++i)
					{
						ownerid = cache_get_field_content_int(i, "id");
					}
					cache_delete(result);
					format(stringcasa, sizeof(stringcasa), "%s [user:%d] a cumparat bizz-ul [bizz:%d] de la %s [user:%d] pentru $%s.",sendername,PlayerInfo[playerid][pSQLID],b,BizzInfo[b][bOwner],ownerid,FormatNumber(BizzInfo[b][bPrice]));
	                ABroadCast(COLOR_YELLOW, stringcasa, 1);
	                strmid(BizzInfo[b][bOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
					GivePlayerCash(playerid,-BizzInfo[b][bPrice]);
					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 purchase!");
					new var100[256],string2[256];
					mysql_real_escape_string(stringcasa, string2);
 					mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`) VALUES ('%d','%d','%s')", PlayerInfo[playerid][pSQLID], ownerid, string2);
					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',`Prices`='0' WHERE `ID`='%d'", BizzInfo[b][bOwner], b);
					mysql_tquery(SQL,str1,"","");
					mysql_format(SQL,str1,sizeof(str1),"UPDATE users SET Bizz=255, Money=Money+%d WHERE id=%d", BizzInfo[b][bPrice], ownerid);
					mysql_tquery(SQL,str1,"","");
					foreach(new i : Player)
					{
						if(PlayerInfo[i][pSQLID] == ownerid)
						{
							PlayerInfo[i][pPbiskey] = 255;
							GivePlayerCash(i, BizzInfo[b][bPrice]);
							Update(i, pCashx);
						}
					}
					new name[30];
					GetPlayerName(playerid, name, sizeof(name));
					format(string2, sizeof(string2), "%s has bought your business for $%s.", name, FormatNumber(BizzInfo[b][bPrice]));
					mysql_real_escape_string(string2, var100);
					mysql_format(SQL, var100, sizeof(var100), "INSERT INTO `emails` (`playerid`,`Message`) VALUES('%d','%s')", ownerid, var100);
					mysql_tquery(SQL,var100,"","");
					BizzInfo[b][bPrice] = 0;
					OnPropTextdrawUpdate(2,b);
				}
			}
		}
	}
	return 1;
}

 

6 answers to this question

Recommended Posts

  • 0
Posted
if(time < 36000) return SS(playerid, COLOR_LIGHTGREEN3, "Trebuie sa ai 10 ore jucate in ultimele 30 de zile (fara AFK/sleep) pentru a putea cumpara o proprietate.", "You need 10 played hours in last 30 days (without AFK/sleep) to buy a property.");
				

maxresdefault.jpg

 

 

 

  • 0
Posted
Quote

if(time < 36000) return SS(playerid, COLOR_LIGHTGREEN3, "Trebuie sa ai 10 ore jucate in ultimele 30 de zile (fara AFK/sleep) pentru a putea cumpara o proprietate.", "You need 10 played hours in last 30 days (without AFK/sleep) to buy a property.");

scoatel si va merge

  • 0
Posted (edited)
La 18.12.2018 la 13:32, ASGOOD a spus:

if(time < 36000) return SS(playerid, COLOR_LIGHTGREEN3, "Trebuie sa ai 10 ore jucate in ultimele 30 de zile (fara AFK/sleep) pentru a putea cumpara o proprietate.", "You need 10 played hours in last 30 days (without AFK/sleep) to buy a property.");
				

 

Acum 20 ore, VolticHD a spus:

scoatel si va merge

Am scos ala si acu imi spune ca cica am deja un business si eu nu am. Am incercat si dupa alt cont si tot la fel.

 

Edited by Sprite_RoPlayers
  • 0
Posted
Acum 2 ore, Sprite_RoPlayers a spus:

help?

Încearcă la  

if(time < 36000) return 

in loc de 36000 să pui 0

 

  • 0
Posted

Aici ai urmatoarea problema:

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

 

E posibil ca in baza de date la incarcarea datelor sa fie setata pe 0 ce tine de pPbiskey, ea trebuie facuta default cand se inregistreaza jucatorul(adica sa fie definita pe 255 ca sa nu aibe bizz)

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.