Stats don't save on disconnect -
Jochemd - 12.09.2010
Hello,
The stats like position don't save on disconnect, and they don't to in a timer. I know that the callback gets called, cause a message with 'It gets called' just gets called.
pawn Код:
public StatsSave(playerid)
{
if(PlayerInfo[playerid][IsLogged] == 1 && PlayerInfo[playerid][IsPlayerSpawned] == 1)
{
new Playername[MAX_PLAYER_NAME];
GetPlayerRPName(playerid,Playername,sizeof(Playername));
format(file,sizeof(file),"JoAdmin/Accounts/%s.ini",Playername);
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
GetPlayerPos(playerid,X,Y,Z);
Int = GetPlayerInterior(playerid);
dini_FloatSet(file, "PosX", X);
dini_FloatSet(file, "PosY", Y);
dini_FloatSet(file, "PosZ", Z);
dini_FloatSet(file, "Interior",Int);
dini_IntSet(file, "InJail",PlayerInfo[playerid][IsJailed]);
SendClientMessage(playerid,COLOR_WHITE," It gets called.");
}
return true;
}
So it doesnt save the stats.. Ain't that weird?
Regards, Jochem
Note: everything is allright. format of file is ok.
Re: Stats don't save on disconnect -
miokie - 12.09.2010
Question: Have you created the folders you're saving it into?
Re: Stats don't save on disconnect -
Jochemd - 12.09.2010
Yes. They are created. The stats load fine, but they dont save
Re: Stats don't save on disconnect -
LifeStyle - 12.09.2010
Do you have onplayerdisconnect
Re: Stats don't save on disconnect -
Jochemd - 12.09.2010
No. But I got all those things into OnPlayerDisconnect. Like save
Re: Stats don't save on disconnect -
Jochemd - 12.09.2010
Ok now I did what you said and it still bugs
Re: Stats don't save on disconnect -
Rudyy - 12.09.2010
Same goes to me
i did
and on OnPlayerConnect
pawn Код:
SetTimer("save",5000,true);
and this
pawn Код:
public save(playerid)
{
new Float:x,Float:y,Float:z;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(isLogged[playerid] == 1 && Spawned[playerid] == 1)
{
dini_IntSet(file, "Score", PlayerInfo[playerid][Score]);
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel]);
GetPlayerPos(playerid,x,y,z);
dini_IntSet(file,"X",floatround(x));
dini_IntSet(file,"Y",floatround(y));
dini_IntSet(file,"Z",floatround(z));
dini_IntSet(file,"haveacar",haveacar[playerid]);
dini_IntSet(file,"Member",Member[playerid]);
dini_IntSet(file,"Leader",Leader[playerid]);
dini_IntSet(file,"InOrg",IsInOrg[playerid]);
dini_IntSet(file,"Requesting",request[playerid]);
dini_IntSet(file,"IsRequesting",IsRequesting[playerid]);
dini_IntSet(file,"Law",IsLaw[playerid]);
dini_IntSet(file, "HoursPlayed", PlayerInfo[playerid][HoursPlayed]);
dini_IntSet(file, "MinsPlayed", PlayerInfo[playerid][MinutesPlayed] );
dini_IntSet(file, "DrivingLic", HaveDrivingLic[playerid] );
dini_IntSet(file,"IsVip",PlayerInfo[playerid][IsVip]);
dini_IntSet(file,"jail",jail[playerid]);
}
}
and it didnt work :S
Re: Stats don't save on disconnect -
Jochemd - 12.09.2010
Yes, but that is just cause you used SetTimer.. I use SetTimerEx.
Re: Stats don't save on disconnect -
Rudyy - 12.09.2010
Maybe decrease the time? Or dont alt+tab.
Re: Stats don't save on disconnect -
Jochemd - 12.09.2010
Actually I need to ALT TAB cause I need to upload the AMX to my server, and start it... But others have this problem to