pawn Код:
/*================================================================================================
This Code was created by James_Aex to help Jokerr_mayne
==================================================================================================*/
//=======================================|Includes|================================================//
#include <a_samp>
#include <dini>
public OnPlayerDisconnect(playerid, reason)
{
new str[128];
new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname));
format(str, sizeof(str), "Stats/%s.cfg", plname);
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A);
dini_FloatSet(str, "CrashX", X); dini_FloatSet(str, "CrashY", Y); dini_FloatSet(str, "CrashZ", Z); dini_FloatSet(str, "CrashAngle", A);
dini_IntSet(str, "CrashInt", GetPlayerInterior(playerid));
dini_IntSet(str, "Skin", GetPlayerSkin(playerid));
if(reason == 0)
{
dini_IntSet(str, "Crashed", 1);
return 1;
}
return 1;
}
public OnPlayerSpawn(playerid)
{
new str[128];
new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname));
format(str, sizeof(str), "Stats/%s.cfg", plname);
if(dini_Exists(str))
{
new crashed = dini_Int(str, "Crashed");
if(crashed == 1)
{
SetPlayerPos(playerid, dini_Float(str, "CrashX"), dini_Float(str, "CrashY"), dini_Float(str, "CrashZ"));
SetPlayerInterior(playerid, dini_Int(str, "CrashInt")); SetPlayerFacingAngle(playerid, dini_Float(str, "CrashAngle"));
GameTextForPlayer(playerid, "~r~crashed. ~w~returning to your last position.", 7000, 1);
dini_IntSet(str, "Crashed", 0);
SetPlayerSkin(playerid, dini_Int(str, "Skin"));
return 1;
}
return 1;
}
else
{
dini_Create(str);
}
return 1;
}