if(dialogid == 2) //Login
{
if(response)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
INI_ParseFile(file, "LoadUser", .bExtra = true, .extra = playerid);
format(file, sizeof(file), "%s.ini", name);
if(strcmp(inputtext, gPlayerInfo[playerid][pPassword], false))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[SYSTEM]: Error Incorrect Password!");
TogglePlayerSpectating(playerid, 1);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Player Login", "Please Type In Your Password Below:", "Login", "Cancle");
}
else
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
SetPlayerScore(playerid, gPlayerInfo[playerid][pLevel]);
GivePlayerMoney(playerid, gPlayerInfo[playerid][pMoney]);
SetPlayerSkin(playerid, gPlayerInfo[playerid][pSkin]);
SetPlayerHealth(playerid, gPlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, gPlayerInfo[playerid][pArmour]);
TogglePlayerSpectating(playerid, 0);
}
}
}
return 1;
}
public LoadUser(playerid, name[], value[])
{
INI_Int("Password", gPlayerInfo[playerid][pPassword]);
INI_Int("Level", gPlayerInfo[playerid][pLevel]);
INI_Int("Money", gPlayerInfo[playerid][pMoney]);
INI_Int("Skin", gPlayerInfo[playerid][pSkin]);
INI_Int("Health", gPlayerInfo[playerid][pHealth]);
INI_Int("Armour", gPlayerInfo[playerid][pArmour]);
return 1;
}
Why isnt this loading the things I want it to?
pawn Код:
|
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], playerfile[256];
GetPlayerName(playerid, name, sizeof(name));
format(playerfile, sizeof(playerfile), "%s.ini", name);
{
new INI:Accfile = INI_Open(playerfile);
INI_WriteInt(Accfile, "Level", gPlayerInfo[playerid][pLevel]);
INI_WriteInt(Accfile, "Money", GetPlayerMoney(playerid));
INI_WriteInt(Accfile, "Money",GetPlayerMoney(playerid));
new Float:Health; GetPlayerArmour(playerid, Health);
INI_WriteFloat(Accfile, "Health", Health);
new Float:Armor; GetPlayerArmour(playerid, Armor);
INI_WriteFloat(Accfile, "Armour",Armor);
INI_WriteInt(Accfile, "Skin", gPlayerInfo[playerid][pSkin]);
INI_Close(Accfile);
}
return 1;
}
if(dialogid == 1) //Register
{
if(response)
{
new name[MAX_PLAYER_NAME], files[256];
GetPlayerName(playerid, name, sizeof(name));
format(files, sizeof(files), "%s.ini", name);
{
new INI:file = INI_Open(files);
INI_WriteString(file, "Password", inputtext);
INI_WriteInt(file, "Level", 1);
gPlayerInfo[playerid][pLevel] = 1;
SetPlayerScore(playerid,1);
INI_WriteInt(file, "Money", 5000);
gPlayerInfo[playerid][pMoney] = 5000;
GivePlayerMoney(playerid,5000);
INI_WriteInt(file, "Health", 100);
gPlayerInfo[playerid][pHealth] = 100;
SetPlayerHealth(playerid,100);
INI_WriteInt(file, "Armour", 0);
gPlayerInfo[playerid][pArmour] = 0;
SetPlayerArmour(playerid,0);
INI_WriteInt(file, "Skin", 26);
gPlayerInfo[playerid][pSkin] = 26;
SetPlayerSkin(playerid,26);
INI_Close(file);
return 1;
}
}
}
INI_ParseFile(file, "LoadUser", .bExtra = true, .extra = playerid);
format(file, sizeof(file), "%s.ini", name);
format(file, sizeof(file), "%s.ini", name);
INI_ParseFile(file, "LoadUser", .bExtra = true, .extra = playerid);
if(dialogid == 2) //Login
{
if(response)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.ini", name);
INI_ParseFile(file, "LoadUser", .bExtra = true, .extra = playerid);
if(strcmp(inputtext, gPlayerInfo[playerid][pPassword], false))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[SYSTEM]: Error Incorrect Password!");
TogglePlayerSpectating(playerid, 1);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Player Login", "Please Type In Your Password Below:", "Login", "Cancle");
}
else
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
SetPlayerScore(playerid, gPlayerInfo[playerid][pLevel]);
GivePlayerMoney(playerid, gPlayerInfo[playerid][pMoney]);
SetPlayerSkin(playerid, gPlayerInfo[playerid][pSkin]);
SetPlayerHealth(playerid, gPlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, gPlayerInfo[playerid][pArmour]);
TogglePlayerSpectating(playerid, 0);
}
}
}
return 1;
}