/buybiz (give someone cash while he is offline help)
#1

Код:
if(strcmp(cmd, "/buybiz", true) == 0)
 	{
 	  for(new h = 0; h < sizeof(BizzInfo); h++)
		{
        if(IsPlayerInRangeOfPoint(playerid, 2.0, BizzInfo[h][bEntranceX], BizzInfo[h][bEntranceY], BizzInfo[h][bEntranceZ]) && BizzInfo[h][bForSell] == 1)
			{
			  if(GetPlayerScore(playerid) < BizzInfo[h][bLevelNeeded])
			  {
			    SendClientMessage(playerid, LIGHTRED, "You need to be level 4+ to buy this.");
			  }
			  else if(GetPlayerMoneyEx(playerid) > BizzInfo[h][bBuyPrice])
			  {
					format(string,sizeof(string),"D-RP/Accounts/%s.ini", BizzInfo[h][bOwner]);
					BizPrice[playerid] = dini_Int(string, "Money");
					BizPrice[playerid] += BizzInfo[h][bBuyPrice];
					dini_IntSet(string,"Money",BizPrice[playerid]);
					BizPrice[playerid] = 0;
					GivePlayerMoneyEx(playerid, -BizzInfo[h][bBuyPrice]);
					strmid(BizzInfo[h][bOwner], PlayerName(playerid), 0, strlen(PlayerName(playerid)), 255);
                    BizzInfo[h][bOwned] = 1;
                    SendClientMessageEx(playerid, YELLOW_GREEN, "You bought a business. Name: %s, Price: %d. (/businesshelp)",BizzInfo[h][bMessage],BizzInfo[h][bBuyPrice]);
                    Update3DLabels();
					PropUpdate();
					AccountUpdate(playerid);
				}
			}
			return 1;
		}
 	}
Well is this possible ? To buy this bizz while the owner is offline and give him money when someone buys it using dini. This doesnt give any errors but it doestn work. Nothing happens.
Reply
#2

put the players name in a string and so when he logs off you can set the money he makes from his business when he/she is offline.

basically use the variable you set with the players name to find his account file and save the new money to his account =p

but if you restart your server this data is lost you can also make a dini file for the server that stores all the businesses and there owners so you can reload there names to the variables
Reply
#3

Well i dont get it exacly. But i do have a complete business system. (File system) I load them from files, from script files. The problem is only this cmd.
Reply
#4

12 hour passed. Bump.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)