SII - y_ini - 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)
+--- Thread: SII - y_ini (
/showthread.php?tid=507924)
SII - y_ini -
vassilis - 19.04.2014
I am trying to convert [gf]sassino's house/business/furniture system to y_ini although there some functions that i am a bit confused on how to change them
The errors are of couse INI_Save, INI_Load which y_ini doesn't actually have.. example how could i change this to y_ini
pawn Код:
forward FS_GiveBusinessGoods(shopid, goods);
public FS_GiveBusinessGoods(shopid, goods)
{
if(!strcmp(BusinessInfo[shopid][bOwner], INVALID_OWNER, true)) return 1;
if(BusinessInfo[shopid][bGoods] + goods < 0) return 0;
BusinessInfo[shopid][bGoods] += goods;
new filename[128];
format(filename, 128, SHOP_FILE, shopid);
INI_Open(filename);
INI_WriteInt("Goods", BusinessInfo[shopid][bGoods]);
INI_Save();
INI_Close();
return 1;
}
Re: SII - y_ini -
vassilis - 20.04.2014
bump any help?
Re: SII - y_ini - Emmet_ - 20.04.2014
pawn Код:
forward FS_GiveBusinessGoods(shopid, goods);
public FS_GiveBusinessGoods(shopid, goods)
{
if(!strcmp(BusinessInfo[shopid][bOwner], INVALID_OWNER, true)) return 1;
if(BusinessInfo[shopid][bGoods] + goods < 0) return 0;
BusinessInfo[shopid][bGoods] += goods;
new filename[64], INI:file;
format(filename, 64, SHOP_FILE, shopid);
file = INI_Open(filename);
INI_WriteInt(file, "Goods", BusinessInfo[shopid][bGoods]);
INI_Close(file);
return 1;
}
Basically, remove INI_Save() and create a variable with an INI: tag for each file you wish to open.
Re: SII - y_ini -
AroseKhanNiazi - 20.04.2014
First You need to define the place you want to save
the
Код:
#define OwnerPath "Business/Owners/%s.ini" /*Will define owner path*/
Код:
stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
{
new str[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new d,len = strlen(name); d != len; d++)
name[d] = tolower(name[d]);
format(str,sizeof(str),OwnerPath,name);
return str;
}
Код:
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Business_Owner_Data"); //this will be tag on the file which will save the data
INI_WriteInt(file,"Goods",BusinessInfo[shopid][bGoods]);
INI_Close(file);//Now after we've done saving their data, we now need to close the file
Sorry didn't saw the upper post well i think he got better way