13.08.2010, 00:27
(
Последний раз редактировалось iggy1; 13.08.2010 в 00:46.
)
This is what i have (not tested but absolutly no reason why it should not work). Obviously put ur own conditions in OnPlayerSpawn like if player is regged ect.
Using djson FOUND HERE.
OnGameModeInit/OnFilterScriptInit
OnGameModeExit/OnFilterScriptExit
Then OnPlayerDisconnect
then OnPlayerSpawn
Then at bottom a function to return players name
Hope it works. dont see why not if not let me know what happened u may also need to save interior and vw.
Edit: i changed the later djAutocommit() to djAutocommit(true); silly mistake by me. Make sure you change the original code i posted to the edited one above (it is slghtly different).
Using djson FOUND HERE.
OnGameModeInit/OnFilterScriptInit
pawn Код:
djson_GameModeInit();
pawn Код:
djson_GameModeExit();
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
djAutocommit(false);//correct
new Float:x,Float:y,Float:z,fstr[35];
GetPlayerPos(playerid,x,y,z);//put co-ords in variables x,y,z.
format(fstr,35,"%.json",playername(playerid));//file string (players name)
djSetFloat(fstr,"pos/x",x);//save co-ords
djSetFloat(fstr,"pos/y",y);
djSetFloat(fstr,"pos/z",z);
djCommit(fstr);
djAutocommit(true);//This is the edit make sure this is in your code(here) and not djAutocommit(false)
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
new fstr[35];
format(fstr,35,"%.json",playername(playerid));
SetPlayerPos(playerid,djFloat(fstr,"pos/x"),djFloat(fstr,"pos/y"),djFloat(fstr,"pos/z"));
return 1;
}
pawn Код:
stock playername(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
return pname;
}
Edit: i changed the later djAutocommit() to djAutocommit(true); silly mistake by me. Make sure you change the original code i posted to the edited one above (it is slghtly different).