[Tool/Web/Other] Return to your position after a crash. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tool/Web/Other] Return to your position after a crash. (
/showthread.php?tid=439790)
Return to your position after a crash. -
JacobWilkerson - 26.05.2013
Hello, good evening to all.
I want to tell you that I am not English, I try to get by English level, if some words are incomprehensible, it's normal.
I decided to give you a code to return to the last position or character was after a crash.
Rather embettant back to our spawn point after a crash for example.
Here's the code to put in OnPlayerCommandText.
If you have errors, tell me the following subject.
You just have to place pJailed, pCrashed in your pInfo.
Similarly for pCrashX-Y-Z and your OnPlayerDisconnect of course.
pawn Code:
if(strcmp(cmd, "/gocrash", true) == 0)
{
if(PlayerInfo[playerid][pJailed] == 0)
{
if(PlayerInfo[playerid][pCrashed] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You are returned to your position or you have exceeded the maximum time.");
return 1;
}
if(PlayerInfo[playerid][pCrashed] == 1)
{
SetPlayerPos(playerid,PlayerInfo[playerid][pCrashX],PlayerInfo[playerid][pCrashY],PlayerInfo[playerid][pCrashZ]);
SetPlayerInterior(playerid,PlayerInfo[playerid][pCrashInt]);
SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pCrashW]);
PlayerInfo[playerid][pCrashed] = 0;
OnPlayerUpdatex(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You are back at your last position after your crash.");
return 1;
}
}
return 1;
}