[HELP] Y_INI Does not save accounts - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Y_INI Does not save accounts (
/showthread.php?tid=628114)
[HELP] Y_INI Does not save accounts -
INKISICION - 06.02.2017
My Code
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][Logued] == 1)
{
Date(playerid);
}
else
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][Logued] == 0)
{
SendClientMessage(playerid,0xFF0000C8,"* This account is not saved.");
}
return 1;
}
Date(playerid)
{
if(PlayerInfo[playerid][Logueado] == 1)
{
new INI:FileCE = INI_Open(UserPath(playerid));
INI_SetTag(FileCE,"data");
INI_WriteInt(FileCE,"Oro",PlayerInfo[playerid][Oro]);
INI_WriteInt(FileCE,"Admin",PlayerInfo[playerid][Level]);
INI_WriteInt(FileCE,"Vip",PlayerInfo[playerid][Kit]);
INI_WriteInt(FileCE,"Score",GetPlayerScore(playerid));
INI_WriteInt(FileCE,"Kills",PlayerInfo[playerid][Kills]);
INI_WriteInt(FileCE,"Incremento",PlayerInfo[playerid][Incremento]);
INI_WriteInt(FileCE,"Deaths",PlayerInfo[playerid][Deaths]);
INI_WriteInt(FileCE,"Color", GetPlayerColor(playerid));
INI_WriteInt(FileCE,"Skin", GetPlayerSkin(playerid));
INI_WriteInt(FileCE,"HeadShoots", PlayerInfo[playerid][HeadShoot]);
INI_WriteInt(FileCE,"Nivel", PlayerInfo[playerid][LevelUp]);
INI_WriteInt(FileCE,"Faction", PlayerInfo[playerid][Clan]);
INI_WriteInt(FileCE,"SpecialUser", PlayerInfo[playerid][SpecialUser]);
INI_Close(FileCE);
}
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),GuardarInfo,playername);
return string;
}
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
Re: [HELP] Y_INI Does not save accounts -
JesterlJoker - 06.02.2017
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
Date(playerid);
//You don't need the IsPlayerConnected part since the player is disconnecting
}
Date(playerid)
{
//You don't to know if the player is loggedin I assumed Logguedo to be loggedin since I really don't understand it.
new INI:FileCE = INI_Open(UserPath(playerid));
INI_SetTag(FileCE,"data");
INI_WriteInt(FileCE,"Oro",PlayerInfo[playerid][Oro]);
INI_WriteInt(FileCE,"Admin",PlayerInfo[playerid][Level]);
INI_WriteInt(FileCE,"Vip",PlayerInfo[playerid][Kit]);
INI_WriteInt(FileCE,"Score",GetPlayerScore(playerid));
INI_WriteInt(FileCE,"Kills",PlayerInfo[playerid][Kills]);
INI_WriteInt(FileCE,"Incremento",PlayerInfo[playerid][Incremento]);
INI_WriteInt(FileCE,"Deaths",PlayerInfo[playerid][Deaths]);
INI_WriteInt(FileCE,"Color", GetPlayerColor(playerid));
INI_WriteInt(FileCE,"Skin", GetPlayerSkin(playerid));
INI_WriteInt(FileCE,"HeadShoots", PlayerInfo[playerid][HeadShoot]);
INI_WriteInt(FileCE,"Nivel", PlayerInfo[playerid][LevelUp]);
INI_WriteInt(FileCE,"Faction", PlayerInfo[playerid][Clan]);
INI_WriteInt(FileCE,"SpecialUser", PlayerInfo[playerid][SpecialUser]);
INI_Close(FileCE);
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),GuardarInfo,playername);
return string;
}
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
That should fix it