SA-MP Forums Archive
Question about dini - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question about dini (/showthread.php?tid=371804)



Question about dini - CoDeZ - 24.08.2012

Hello
i have files saved in dini , but i don't have Names="PlayerName"
Can't i loop through all files , and add Names=PlayerName.ini(The File name) ?
Example : teehee.ini
i want to add into teehee.ini , Name=teehee
Any idea how? :/


Re: Question about dini - Roko_foko - 24.08.2012

OnPlayerConnect, or once you are loading stats, load stat(value) from "PlayerName"( I don't know how you load it, i guess something like this strcat(Variable,INI_GetString("PlayerName"); and if player name doens't match Variable, put save the "PlayerName" using GetPlayerName or something.


Re: Question about dini - LaGrande - 24.08.2012

Quote:

dini_Set(PlayerFileName, "PlayerName", GetPlayerName(playerid));

tbh, i didnt understand your question


Re: Question about dini - CoDeZ - 24.08.2012

Let's say i have a user file called CoDeZ.ini
Inside the file , you have this :
Код:
Kills=10
Death=0
Password=hey
I want to add name inside it so its like this :
Код:
Name=CoDeZ
Problem is , i have about 30 k files , how to loop through all of them and do this?


Re: Question about dini - Roko_foko - 24.08.2012

here you go
pawn Код:
OnPlayerConnect(playerid)
{
    INI_Open(FILE);
    new Name[]=INI_GetString("PlayerName");
    new Name2[128];
    GetPlayerName(playerid,Name2,sizeof(Name2));
    if(strcmp(Name2,Name)==0){}//you have stored the name
    else  INI_SetString("PlayerName",Name2);
 ....
}



Re: Question about dini - LaGrande - 24.08.2012

Quote:
Originally Posted by Roko_foko
Посмотреть сообщение
here you go
pawn Код:
OnPlayerConnect(playerid)
{
    INI_Open(FILE);
    new Name[]=INI_GetString("PlayerName");
    new Name2[128];
    GetPlayerName(playerid,Name2,sizeof(Name2));
    if(strcmp(Name2,Name)==0){}//you have stored the name
    else  INI_SetString("PlayerName",Name2);
 ....
}
he's talking about dini.


Re: Question about dini - Roko_foko - 24.08.2012

Quote:
Originally Posted by LaGrande
Посмотреть сообщение
he's talking about dini.
As I said before, I don't know how to convert it to dini. But I guess, it's not hard to understand what my code does and to convert it to dini ( assuming that he know how to work with dini )


Re: Question about dini - CoDeZ - 24.08.2012

Quote:
Originally Posted by Roko_foko
Посмотреть сообщение
here you go
pawn Код:
OnPlayerConnect(playerid)
{
    INI_Open(FILE);
    new Name[]=INI_GetString("PlayerName");
    new Name2[128];
    GetPlayerName(playerid,Name2,sizeof(Name2));
    if(strcmp(Name2,Name)==0){}//you have stored the name
    else  INI_SetString("PlayerName",Name2);
 ....
}
Ehm sir , this is going to be a bigger problem.
-Names won't be added unless 30 k players login
-It will be Names = CoDeZ instead of Name=CoDeZ ( Spaces will be added )


Respuesta: Question about dini - Vladeksh - 31.08.2012

Hi again,
If you use Windows, you can use a batch script:

loop.bat
Код:
@echo off
FOR %%x IN (*) DO (
	echo Name=%%~nx >> %%x
)
Example:
Код:
Var1=int
Var2=int
Var3=string
Var4=float
Name=NameFileWithoutExtension
If you use linux, please tell me


Re: Question about dini - Tika Spic - 31.08.2012

Can I get your saving stock (the thing that saves the acc on disconnect? )