[Help]Last Position - Spawn
#10

A simple variable would probably help you,
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;
}
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.
Reply


Messages In This Thread
[Help]Last Position - Spawn - by igal4576 - 12.08.2010, 23:56
Re: [Help]Last Position - Spawn - by iggy1 - 13.08.2010, 00:06
Re: [Help]Last Position - Spawn - by igal4576 - 13.08.2010, 00:16
Re: [Help]Last Position - Spawn - by iggy1 - 13.08.2010, 00:27
Re: [Help]Last Position - Spawn - by igal4576 - 13.08.2010, 00:30
Re: [Help]Last Position - Spawn - by iggy1 - 13.08.2010, 01:07
Re: [Help]Last Position - Spawn - by igal4576 - 13.08.2010, 01:12
Re: [Help]Last Position - Spawn - by iggy1 - 13.08.2010, 01:16
Re: [Help]Last Position - Spawn - by igal4576 - 13.08.2010, 01:45
Re: [Help]Last Position - Spawn - by iggy1 - 13.08.2010, 10:34

Forum Jump:


Users browsing this thread: 3 Guest(s)