Question about dini
#1

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? :/
Reply
#2

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.
Reply
#3

Quote:

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

tbh, i didnt understand your question
Reply
#4

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?
Reply
#5

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);
 ....
}
Reply
#6

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.
Reply
#7

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 )
Reply
#8

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 )
Reply
#9

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
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)