y_ini problems -
Facerafter - 04.06.2013
Im working on a /adjustrankname but i have some problems with y_ini (Don't have much expierence with it)
After making this:
pawn Код:
new
fileToWrite[] = "factionranks.INI",
INI:iniFile = INI_Open(fileToWrite);
new rank1[128],rank2[128],rank3[128],rank4[128],rank5[128],rank6[128],rank7[128],rank8[128],rank9[128],rank10[128]
INI_SetTag(iniFile, "lspd");
INI_WriteString(iniFile, "rank1",rank1, sizeof(rank1);
INI_WriteString(IniFile, "rank2",rank2, sizeof(rank2);
INI_WriteString(IniFile, "rank3",rank3, sizeof(rank3);
INI_WriteString(IniFile, "rank4",rank4, sizeof(rank4);
INI_WriteString(IniFile, "rank5",rank5, sizeof(rank5);
INI_WriteString(IniFile, "rank6",rank6, sizeof(rank6);
INI_WriteString(IniFile, "rank7",rank7, sizeof(rank7);
INI_WriteString(IniFile, "rank8",rank8, sizeof(rank8);
INI_WriteString(IniFile, "rank9",rank9, sizeof(rank9);
INI_WriteString(IniFile, "rank10",rank10, sizeof(rank10);
INI_Close(iniFile);
If i try to compile i get the error Pawn Compiler has stopped working.
Solutions, Any help?
Re: y_ini problems -
Facerafter - 04.06.2013
Oh, I didn't knew it needed brackets. I just used your
How to use y_ini tutorial. And saw no brackets there. Also what do you mean? i thought what i just made did this in factionranks.ini
pawn Код:
[lspd]
rank1 = rank1
OR
rank1 =
I didn't knew that for sure.
Can you explain me what im doing wrong?
Re: y_ini problems -
NvidiaForTheWin - 04.06.2013
Quote:
Originally Posted by Facerafter
Oh, I didn't knew it needed brackets. I just used your How to use y_ini tutorial. And saw no brackets there. Also what do you mean? i thought what i just made did this in factionranks.ini
pawn Код:
[lspd] rank1 = rank1 OR rank1 =
I didn't knew that for sure.
Can you explain me what im doing wrong?
|
about brackets , i will try to explain.
let say you want to save a float value that is 0.
you would do
Код:
INI_WriteFloat(IniFile, "MyFloatValueBlaBlaBla", 0);
now , if you want to save let say player health
Код:
INI_WriteFloat(IniFile, "ThePlayerHealthText", GetPlayerHealth(playerid));
do you see the difference with brackets ?
i mean you cant do something like this
Код:
yesterday my sister ( daisy came back to home ( in canada )
you have to do
Код:
yesterday my sister ( daisy ) came back to home ( in canada )
each opening bracket need closing bracket
now your code should be like this
Код:
INI_SetTag(iniFile, "lspd");
INI_WriteString(iniFile, "rank1",rank1, sizeof(rank1));
INI_WriteString(IniFile, "rank2",rank2, sizeof(rank2));
INI_WriteString(IniFile, "rank3",rank3, sizeof(rank3));
INI_WriteString(IniFile, "rank4",rank4, sizeof(rank4));
INI_WriteString(IniFile, "rank5",rank5, sizeof(rank5));
INI_WriteString(IniFile, "rank6",rank6, sizeof(rank6));
INI_WriteString(IniFile, "rank7",rank7, sizeof(rank7));
INI_WriteString(IniFile, "rank8",rank8, sizeof(rank8));
INI_WriteString(IniFile, "rank9",rank9, sizeof(rank9));
INI_WriteString(IniFile, "rank10",rank10, sizeof(rank10));
Re: y_ini problems -
Facerafter - 04.06.2013
OH Now i see it... Sorry i really missed that...
Edit: Sorry for this im still a noob with y_ini and also not a very expierenced scripter.
But under what do i need to put this? Under a callback or do need to create a stock...?
Re: y_ini problems -
NvidiaForTheWin - 04.06.2013
Quote:
Originally Posted by Facerafter
OH Now i see it... Sorry i really missed that...
Edit: Sorry for this im still a noob with y_ini and also not a very expierenced scripter.
But under what do i need to put this? Under a callback or do need to create a stock...?
|
you are creating file , writing to file , saving file.
that mean you have two solution.
1: create a function and a timer which run this function each x time. ( the faster the timer is , the more lag you will have )
2 : THE BEST put that on OnPlayerDisconnect
and never put that genre of things on OnPlayerUpdate because this callback is called like each 500ms ( IF not faster ! ).
let say you have 15 player online , it mean you open , write , save afile 15 time per 500ms.
1 second = 30 time
Re: y_ini problems -
Facerafter - 04.06.2013
Thats not what i mean. I mean only with creating. I thought if i put the creating under OnGameModeInit
it creates the file agian everytime the servers turns on.
Re: y_ini problems -
NvidiaForTheWin - 04.06.2013
leave it under OnPlayerDisconnect.
if file exist = just write
if file not exist = create and write
thats what you asked ?
Re: y_ini problems -
Facerafter - 04.06.2013
Does it do that automaticly? To check if it exists or not?
Re: y_ini problems -
NvidiaForTheWin - 04.06.2013
no. you need something like this
Код:
if(fexist(Path(playerid)))
{
this is just an exemple !
i cant give you a full code you wont learn ( im still elarning too and i can tell you its true )
read some y_ini tutorial like register login you will get how it work