Posts: 89
Threads: 27
Joined: Jan 2011
Reputation:
0
Hey,
I've got a .ini file and I want to read some things out of it. For example the password. How and where can I do this?
Posts: 89
Threads: 27
Joined: Jan 2011
Reputation:
0
I try to get it since a few minutes but I don't understand it, someone got a little example for for example to get the password out of a file with y_ini?
EDIT: Noone knows it?
Posts: 54
Threads: 2
Joined: Dec 2010
Reputation:
0
INI_ParseFile(PlayerInfo[playerid][userfile], "ParsePlayerPass", false, true, playerid);
forward ParsePlayerPass(playerid, name[ ], value[ ]);
public ParsePlayerPass(playerid, name[ ], value[ ])
{
if (!strcmp(name, "Passwort" ))
{
PlayerInfo[playerid][pass] = value;
}
}
Posts: 54
Threads: 2
Joined: Dec 2010
Reputation:
0
INI_ParseFile(PlayerInfo[playerid][userfile], "ParsePlayerPass", false, true, playerid); //this calls function named ParsePlayerPass that we created(you can call it whatever you want) under to read whatever you want you can read other data too its makes y_ini faster to read data once not to exit and open again to read thats why PlayerInfo[playerid][pass] = value; is inside brackets { }
forward ParsePlayerPass(playerid, name[ ], value[ ]);
public ParsePlayerPass(playerid, name[ ], value[ ])
{
if (!strcmp(name, "Passwort" )) // this checks if your setted name exist
{
PlayerInfo[playerid][pass] = value; then we set in variable pass value that we get from file
}
}
sorry for bad english
Posts: 89
Threads: 27
Joined: Jan 2011
Reputation:
0
Well but now I want to read 3 different things. How can I do so?
Posts: 54
Threads: 2
Joined: Dec 2010
Reputation:
0
forward LoadUser( playerid, name[ ], value[ ] );
public LoadUser( playerid, name[ ], value[ ] )
{
if ( !strcmp(name, "REG_DATE" ) )SetPVarString( playerid, "Date", value );
if ( !strcmp(name, "MONEYS" ) )SetPVarInt( playerid, "Moneys", strval( value ) );
if ( !strcmp(name, "SCORE" ) )SetPVarInt( playerid, "Score", strval( value ) );
}