How to work with dini.inc
#1

Hi dudes
I want to teach you how to work with dini include ...
First of all i want to tell you what exactly dini is.
if you want to use a database file you can use this inc , thats easy but you have to know about it a lot
1.We must define <dini> at the top of our FilterScript.
Код:
#define FILTERSCRIPT
#include <a_samp>
#include <dini>
2.you can create your first db.
Код:
new value[32]; //Define an string, Its the name of your db.
format(value,sizeof(value),"where to make db, Ex: "/Accounts/MyFile.txt""); //Format your string and set db file for save your values
dini_Create(value); //create your first dini database.
3.you must Make your players stats (player values to save at first login) (Maybe on player register)
Код:
// these lines needs something else ill explain just down
dini_Set(value,"Password",Key); //to set player password as an string at first, Key is player password
dini_IntSet(value,"Money",200000); //to set player money at first login ... and it will give player automatically 200000$ for start. its  an action to save Integers
dini_IntSet(value,"Score",100); //to set player score , just like before
dini_IntSet(value,"Skin",271); //to set player skin, just like before
and you can do it if you want just for each player ...
you must create files with each player name for it like
Код:
new value[32];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(value,sizeof(value),"/Accounts/%s.txt",pname);
dini_Create(value);
4.you can always read database with
Код:
//to get an string you must format it
new string[64];
format(string,sizeof(string),"%s",dini_Get(value,"Password")); // string is now player password
new mny = dini_Int(value,"Money");
new scr = dini_Int(value,"Score");
new skn = dini_Int(value,"Skin");
Done , you did it it was easy, wasnt it ?
i think it is helpful because i found nowhere that explain it ...
so i wrote it for new scriptwriters to understand ...
Reply
#2

Appreciate your effort but a) wrong section and b) terribly outdated and slow method that no one should ever use anymore.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Appreciate your effort but a) wrong section and b) terribly outdated and slow method that no one should ever use anymore.
Thank you , but why wrong section ? )
Thanks for your advice , but can you tell me another fast and easy include like that ? )
Reply
#4

y_ini. And there is a section for this inside "Scripting help" called "Scripting Tutorials"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)