/buybiz (give someone cash while he is offline help) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /buybiz (give someone cash while he is offline help) (
/showthread.php?tid=145219)
/buybiz (give someone cash while he is offline help) -
MafiaGuy™ - 01.05.2010
Код:
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.
Re: /buybiz (give someone cash while he is offline help) -
BLAbla93 - 01.05.2010
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
Re: /buybiz (give someone cash while he is offline help) -
MafiaGuy™ - 01.05.2010
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.
Re: /buybiz (give someone cash while he is offline help) -
MafiaGuy™ - 02.05.2010
12 hour passed. Bump.