01.04.2016, 19:20
So I got a really, really weird problem here.
This is the case:
When the server restarts, it saves the player's position, level, all the other data EXCEPT Admin and Mod.
But when a player disconnects, it saves EVERYTHING.
This is the script:
Can somebody help me or atleast suggest something?
This is the case:
When the server restarts, it saves the player's position, level, all the other data EXCEPT Admin and Mod.
But when a player disconnects, it saves EVERYTHING.
This is the script:
Код:
public OnPlayerDisconnect(playerid, reason)
{
if(IsLogged[playerid] != 1) return 1;
SaveUser(playerid);
return 1;
}
public OnGameModeExit( )
{
for( new i = 0; i < MAX_PLAYERS; i++)
{
if (IsLogged[i] != 0) SaveUser(i);
}
return 1;
}
stock SaveUser(playerid)
{
GetPlayerPos(playerid,PlayerInfo[playerid][pLastX],PlayerInfo[playerid][pLastY],PlayerInfo[playerid][pLastZ]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pLastA]);
new INI:File = INI_Open(UserPath(playerid));
INI_WriteFloat(File,"LastX", PlayerInfo[playerid][pLastX]);
INI_WriteFloat(File,"LastY", PlayerInfo[playerid][pLastY]);
INI_WriteFloat(File,"LastZ", PlayerInfo[playerid][pLastZ]);
INI_WriteFloat(File,"LastA", PlayerInfo[playerid][pLastA]);
INI_WriteInt(File,"VirtualW",GetPlayerVirtualWorld(playerid));
INI_WriteInt(File,"Interior",GetPlayerInterior(playerid));
new Float:health;
GetPlayerHealth(playerid,health);
INI_WriteFloat(File,"Health",health);
new Float:armour;
GetPlayerArmour(playerid, armour);
INI_WriteFloat(File,"Armor",armour);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Mod",PlayerInfo[playerid][pMod]);
INI_WriteInt(File,"Level",GetPlayerScore(playerid));
INI_WriteInt(File,"Hours",PlayerInfo[playerid][pHours]);
INI_WriteInt(File,"Minutes",PlayerInfo[playerid][pMinutes]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteInt(File,"Gender",PlayerInfo[playerid][pGender]);
INI_WriteInt(File,"Money",GetPlayerMoney(playerid));
INI_Close(File);
}

