Y_ini to Dini
#1

Hello Friends.I want to ask you how can i convert Y_ini system to Dini?
Reply
#2

Why would you want to do that?
Y_INI is way way way faster then dini and way updated, dini is outdated like hek.
Reply
#3

Because
I a creating gm with Y_ini and it's not saving any data.
Reply
#4

just delete your yini saving system and create dini system
Reply
#5

I am not that good can you make i want to convert Gagi_Corleone house systemv1.1
Reply
#6

bump
Reply
#7

Quote:
Originally Posted by Dziugsas
Посмотреть сообщение
Because
I a creating gm with Y_ini and it's not saving any data.
I said so cuz you are saying here you are creating GM , but you are actually editing
Reply
#8

Hard to use y_ini, and dini is outdated.
use SII or HSA or etc..
search for tuts, and u can make it
Reply
#9

Not sure if you actually can convert y_ini to dini, both of them are way different from each other, they do not come from the same family of savings.
Reply
#10

I would just create it...Here's an example

pawn Код:
#define strcpy(%0,%1,%2) \
    strcat((%0[0] = '\0', %0), %1, %2)
//Above is just a way of copying our string from the file into our string (I didn't make above (I believe ****** did))

#define PlayerPath "Mydirectory/%s.ini" //Our file path where we store our player data
//You'll see more how it's used in the Save and Load functions

enum InfoExample //Our info for our players enum
{
    Int, //We have 2 ints
    String[30], //1 string
    Float:OurFloat, //and a float to store
    AnotherInt
}
new PlayerArray[MAX_PLAYERS][InfoExample]; //We create our array so we can use the enum above in it
//The array is the size of max_players. the second dimension is the size of our enum (with things in it)

stock Save(playerid) //A simple save function
{
    new file[50], Name[MAX_PLAYER_NAME]; //We need 2 strings here, one to store the name of the player. The other to store the file path
    GetPlayerName(playerid, Name, sizeof(Name)); //Here we store the players name in our Name string
    format(file, sizeof(file), PlayerPath, Name); //Here we format the %s in the file path to the Name variable
    dini_IntSet(file, "Int", PlayerArray[playerid][Int]); //How we save an int
    dini_Set(file, "String", PlayerArray[playerid][String]); //How we save a string
    dini_FloatSet(file, "OurFloat", PlayerArray[playerid][OurFloat]); //How we save a float
    dini_IntSet(file, "AnotherInt", PlayerArray[playerid][AnotherInt]); //How we save an int again
}

stock Load(playerid) //A simple load function
{
    new file[50], Name[MAX_PLAYER_NAME]; //Same as the Save function
    GetPlayerName(playerid, Name, sizeof(Name)); //Same as the Save function
    format(file, sizeof(file), PlayerPath, Name); //Same as the Save function
    PlayerArray[playerid][Int] = dini_Int(file, "Int"); //Get our int from the file and store it where it belongs
    strcpy(PlayerArray[playerid][String], dini_Get(file, "String"), sizeof(PlayerArray[playerid][String])); //Get our string
    PlayerArray[playerid][OurFloat] = dini_Float(file, "OurFloat"); //Store our Float we just got from the file into PlayerArray[playerid][OurFloat]
    PlayerArray[playerid][AnotherInt] = dini_Int(file, "AnotherInt"); //We get the variable we stored earlier
}

OnPlayerDisconnect(playerid, reason)
{
    Save(playerid); //Calls the function we created to save their data when they leave
}
OnPlayerConnect(playerid)
{
    Load(playerid); //This would actually go on your login stuff - just an example
}
Here's the dini functions I used
pawn Код:
dini_Int(filepath[], "line_to_get_from_file"); //Get's an int from the file
dini_IntSet(filepath[], "name_to_store_it_as", AnInteger); //Sets an int to the file

dini_Get(filepath[], "line_to_get_from_file"); //Get's a string from the file
dini_Set(filepath[], "name_to_store_it_as", our_string_to_store[]); //Sets a string to the file

dini_Float(filepath[], "line_to_get_from_file"); //Get's a float from the file
dini_FloatSet(filepath[], "name_to_store_it_as", Float:afloat); //Sets a float to the file
It's actually pretty simple to do (re-creating the entire thing).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)