12.05.2013, 11:10
INI_String is a function of 'y_INI' which gets a string from a file. For example, if you want to get your password; you gotta do this:
A bit more elaborated:
pawn Код:
INI_String(Path, "Password", User[playerid][Password]);
pawn Код:
#define pPath "Users/%s.ini" //User path.
stock Path(playerid)
{
new s[128], l[24];
GetPlayerName(playerid, l, sizeof(l));
format(s, sizeof(s), pPath, l);
return s;
} //This functions returns the path with the name of the playerid.
forward LoadPlayer_Password(playerid, name[], value[]); //Forwarding to load the player password. playerid is the player's id, name the line to get, and value is it's value.
public LoadPlayer_Password(playerid, name[], value)
{
INI_String(Path(playerid), "Password", User[playerid][Pass]); //Gets the password from player's path and stores in the 'user[playerid][pass]' array.
return 1;
}
//Execute this function in INI_Parse to perform.
public OnPlayerConnect(playerid)
{
INI_ParseFile(Path(playerid), "LoadPlayer_Password", .bExtra = true, .extra = playerid);
return 1;
}