Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <DOF2>
- #pragma unused DOF2_Exit
- new Name[MAX_PLAYER_NAME];
- public OnPlayerConnect(playerid) return GetPlayerName(playerid, Name, sizeof(Name));
- public OnPlayerDisconnect(playerid, reason)
- {
- if(reason == 0)
- {
- new Float:Pos[3];
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- DOF2_CreateFile(CrashFile(playerid));
- DOF2_SetFloat(CrashFile(playerid), "PosX", Pos[0]);
- DOF2_SetFloat(CrashFile(playerid), "PosY", Pos[1]);
- DOF2_SetFloat(CrashFile(playerid), "PosZ", Pos[2]);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(DOF2_FileExists(CrashFile(playerid)))
- {
- SetPlayerPos(playerid, DOF2_GetFloat(CrashFile(playerid), "PosX"), DOF2_GetFloat(CrashFile(playerid), "PosY"), DOF2_GetFloat(CrashFile(playerid), "PosZ"));
- DOF2_RemoveFile(CrashFile(playerid));
- }
- else return 0;
- return 1;
- }
- stock CrashFile(playerid)
- {
- new CF[64];
- format(CF, sizeof(CF), "Crash/%s.ini", Name[playerid]);
- return CF;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement