09.09.2012, 09:50
Hello,
i want to ask something.
My y_ini is working fine until this day it work like crazy.
It doesn't save anything when Player Disconnect.
Here is my code OnPlayerDisconnect
Note:
I discover this while i'm testing the Vip and Admin commands.
And when i check the data files it says:
Admin=0
VIP=0
i want to ask something.
My y_ini is working fine until this day it work like crazy.
It doesn't save anything when Player Disconnect.
Here is my code OnPlayerDisconnect
Note:
I discover this while i'm testing the Vip and Admin commands.
And when i check the data files it says:
Admin=0
VIP=0
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new str[128];
if(PlayerAcc[playerid][Log] == 1)
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file, "account");
GetPlayerIp(playerid, PlayerAcc[playerid][Ip], 16);
INI_WriteString(file, "Ip", PlayerAcc[playerid][Ip]);
INI_WriteInt(file, "Cookies", PlayerAcc[playerid][Cookies]);
INI_WriteInt(file, "Jail", PlayerAcc[playerid][Jail]);
INI_WriteInt(file, "Mute", PlayerAcc[playerid][Mute]);
INI_WriteInt(file, "MuteTime", PlayerAcc[playerid][MuteTime]);
INI_WriteInt(file, "Admin", PlayerAcc[playerid][Admin]);
INI_WriteInt(file, "Vip", PlayerAcc[playerid][Vip]);
INI_WriteInt(file, "WantedLevel", GetPlayerWantedLevel(playerid));
if(ServerInfo[ScoreSaving] == 1)
{
INI_WriteInt(file, "Score", GetPlayerScore(playerid));
}
INI_WriteInt(file, "Money", GetPlayerMoney(playerid));
INI_WriteInt(file, "Kills", PlayerAcc[playerid][Kills]);
INI_WriteInt(file, "Deaths", PlayerAcc[playerid][Deaths]);
}
if(ServerInfo[ConnectMsg] == 1)
{
switch(reason)
{
case 0: format(str, sizeof(str), "%s(%d) has left the server (Timeout/Crash)", GetName(playerid), playerid);
case 1: format(str, sizeof(str), "%s(%d) has left the server (Left)", GetName(playerid), playerid);
case 2: format(str, sizeof(str), "%s(%d) has left the server (Kicked/Banned)", GetName(playerid), playerid);
}
SendClientMessageToAll(COLOR_GREY, str);
#if defined IRC == true
format(str, sizeof(str), "02 03*** %s(%d) has left the server", GetName(playerid), playerid);
IRC_GroupSay(groupID, IRC_CHANNEL, str);
#endif
}
if(IsBeingSpeced[playerid] == 1)
{
foreach(Player, i)
{
if(spectatorid[i] == playerid)
{
KillTimer(SpecTimer[i]);
StopSpectate(i);
IsSpecing[i] = 0;
IsBeingSpeced[i] = 0;
format(str, sizeof(str), "Your spectating to %s(%d) has been ended (Reason: Player Disconnected)", GetName(playerid), playerid);
SendClientMessage(i, COLOR_YELLOW, str);
}
}
}
KillTimer(HealthTimer[playerid]);
KillTimer(MuteTimer[playerid]);
PlayerAcc[playerid][Log] = 0;
PlayerAcc[playerid][Pm] = -1;
PlayerAcc[playerid][God] = 0;
PlayerAcc[playerid][GainPoints] = 0;
TogglePlayerControllable(playerid, 1);
PlayerAcc[playerid][Freeze] = 0;
PlayerAcc[playerid][Hide] = 0;
PlayerAcc[playerid][pDuty] = 0;
PlayerAcc[playerid][Warn] = 0;
IsSpecing[playerid] = 0;
IsBeingSpeced[playerid] = 0;
return 1;
}