Y_INI custom saving filename or by ID's -
caki - 18.05.2012
Hello people i'm slowly scripting my gamemode from scratch. Thanks to ***** and his includes all work is quite easy i got nice saving system in deployment but at the moment i'm stuck a bit. I searched all over the forums a few day's now but i'm unable to find what i need. I will be very thankfull for help on this. I know it should be easy but i just can't get it working.
This is what i use
#include <sscanf2>
#include <YSI\y_ini>
#include <YSI\y_commands>
#include <YSI\y_master>
#include <foreach>
#include <streamer>
And little explanation of what i want.
I want to make y_ini file that file name will be based on command text , example: /mycommand something = 0.ini etc
Problem is i never managed to get that working. Other thing i want is that each time i type command if file 0 exists script will automaticly make file 1.ini etc etc...
So i will have 0.ini , 1.ini , 2.ini etc and in each file i would save some data. In other hand question is how to save .ini by id's?
How to save and load that kind of data filename's. ??
Other thing i want to make is smilar example: /mycommand something = something.ini
Problem isn't saving a data into file but getting a proper filename and load it.
Any help would be appreciated.
Thanks
Re: Y_INI custom saving filename or by ID's -
caki - 19.05.2012
Quote:
Originally Posted by ******
The simplest way is to have another file that just stores the ID of the last file saved. Every time you create a new file read the ID from that file (or read the ID when your mode starts), increment it, and write the new file.
|
Well this is how i wanted to make it but i can't manage to get it working.
pawn Код:
CMD:dealership(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 1337)
{
new name, string[128];
if(sscanf(params, "ud", name) return SendClientMessage(playerid, -1, "USAGE: /dealership name")
{
// new Name[35];
format(name, 35, DEALER_FILE, name(playerid));
new
INI:dealerFile = INI_Open(name);
}
else
{
SendClientMessage(playerid, -1, "You are not authorized to use this command!");
return 1;
}
return 1;
}
Can you help me with this?
Re: Y_INI custom saving filename or by ID's -
caki - 27.05.2012
Ok so i made the commande but when i use the command i get file name %s.ini instead of what i input as text. How i can fix that or get dealer when i type /newdealer that file name is either what i typed by command or automatically by id. Any help would be great. Thanks
pawn Код:
YCMD:newdealer(playerid, params[], help)
{
new dealer[32];
if(!(PlayerInfo[playerid][pAdmin] == 1338)) return SCM(playerid, COLOR_INFO,"You are not authorized to use this command");
{
if (sscanf(params, "s[64]",dealer)) SendClientMessage(playerid, COLOR_INFO, "Usage: \"/newdealer name"");
new
Dealer[32];
format(Dealer, sizeof (Dealer), "dealer/%s.ini", dealer);
new
INI:dealerfile = INI_Open(DEALER_FILE);
INI_SetTag(dealerfile, "Dealership Info");
INI_WriteInt(dealerfile, "Owner", DealerInfo[playerid][dOwner]);
INI_Close(dealerfile);
return 1;
}
}
So output is %s.ini and in file is
[Dealership Info]
Owner = 0