17.04.2014, 15:58
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.
2.you can create your first db.
3.you must Make your players stats (player values to save at first login) (Maybe on player register)
and you can do it if you want just for each player ...
you must create files with each player name for it like
4.you can always read database with
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 ...
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>
Код:
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.
Код:
// 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
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);
Код:
//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");
i think it is helpful because i found nowhere that explain it ...
so i wrote it for new scriptwriters to understand ...