13.08.2010, 10:34
A simple variable would probably help you,
Hope this works im not sure about auto deleting the cache files do it by hand once a week or something (this puts some people off djson) it is faster than dini though.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
djAutocommit(false);
new Float:x,Float:y,Float:z,fstr[35];
GetPlayerPos(playerid,x,y,z);
format(fstr,35,"%s.json",playername(playerid));
djSetFloat(fstr,"pos/x",x);
djSetFloat(fstr,"pos/y",y);
djSetFloat(fstr,"pos/z",z);
djCommit(fstr);
djAutocommit(true);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid,"firstspawn",0)//if first spawn is 0.
{
new fstr[35];
format(fstr,35,"%s.json",playername(playerid));
SetPlayerPos(playerid,djFloat(fstr,"pos/x"),djFloat(fstr,"pos/y"),djFloat(fstr,"pos/z"));
SetPVarInt(playerid,"firstspawn",1);//set to one to make the above 'if' statment false.
}
return 1;
}