INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME);
new String[50]; format(String, sizeof(String), "Users/%s.ini", GetName(playerid));
INI_ParseFile(String, "LoadPlayerData", .bExtra = true, .extra = playerid);
return 1;
}
forward LoadPlayerData(playerid, name[], value[]);
public LoadPlayerData(playerid, name[], value[])
{
INI_String("password", pInfo[playerid][Password], 128); //That will only load "Password" and put it in pInfo[playerid][Password];
return 1;
}
INI_ParseFile doesn't load the whole file.. You properly don't know how to use it.. Example
pawn Код:
|
So the code in your example will only load the password, because that is the only parameter you added in your function "LoadPlayerData" right?
|
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_String("password",PlayerInfo[playerid][pPassword], sizeof(PlayerInfo[playerid][pPassword]));
return 1;
}
C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(6) : warning 201: redefinition of constant/macro (symbol "MAX_INI_ENTRY_TEXT") C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : error 001: expected token: ")", but found "[" C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : warning 215: expression has no effect C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : error 001: expected token: ";", but found "]" C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : error 029: invalid expression, assumed zero C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
new buf[129];
INI_String("password", buf, sizeof(buf));
PlayerInfo[playerid][pPassword] = strval(buf);
return 1;
}
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new buf[129];
if (WP_Hash(buf, sizeof(buf), inputtext) != PlayerInfo[playerid][pPassword])
{
new string[80 + MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "{FFFF00}Your username: {FFFFFF}%s\n\n{AF0000}Incorrect password!\n\n{FFFF00}Enter your Password to log in",name);
ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_PASSWORD, "Hopes Hills RP Account", string, "Login", "Quit");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "-MSG- Welcome back!");
}