How would this be done? - 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: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How would this be done? (
/showthread.php?tid=84453)
How would this be done? -
L30 - 30.06.2009
Okay, so I was woundering how I would script in where when people log/crash they would save their position and when the log back in they would spawn where they logged out.
Re: How would this be done? -
James_Alex - 30.06.2009
use the dini include

and use this code
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(reason == 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(thefile, "CrashX", X);
dini_FloatSet(thefile, "CrashY", Y);
dini_FloatSet(thefile, "CrashZ", Z);
return 1;
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
new Float:X, Float:Y, Float:Z;
X = dini_Float(thefile, "CrashX");
Y = dini_Float(thefile, "CrashY");
Z = dini_Float(thefile, "CrashZ");
SetPlayerPos(playerid, X, Y, Z);
return 1;
}
Re: How would this be done? -
Correlli - 01.07.2009
That will save only if player will timeout (crash), it wouldn't be bad if you use it for other reasons, too.
Re: How would this be done? -
NiGhTWoLFy - 04.07.2009
Quote:
Originally Posted by James_Alex
use the dini include 
and use this code
pawn Код:
public OnPlayerDisconnect(playerid, reason) { if(reason == 0) { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); dini_FloatSet(thefile, "CrashX", X); dini_FloatSet(thefile, "CrashY", Y); dini_FloatSet(thefile, "CrashZ", Z); return 1; } return 1; }
public OnPlayerRequestSpawn(playerid) { new Float:X, Float:Y, Float:Z; X = dini_Float(thefile, "CrashX"); Y = dini_Float(thefile, "CrashY"); Z = dini_Float(thefile, "CrashZ"); SetPlayerPos(playerid, X, Y, Z); return 1; }

|
What is "thefile' from lines "X = dini_Float(thefile, "CrashX");
Y = dini_Float(thefile, "CrashY");
Z = dini_Float(thefile, "CrashZ");" ?

?
Re: How would this be done? -
Anarkien - 04.07.2009
Quote:
Originally Posted by NiGhTWoLFy
Quote:
Originally Posted by James_Alex
use the dini include 
and use this code
pawn Код:
public OnPlayerDisconnect(playerid, reason) { if(reason == 0) { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); dini_FloatSet(thefile, "CrashX", X); dini_FloatSet(thefile, "CrashY", Y); dini_FloatSet(thefile, "CrashZ", Z); return 1; } return 1; }
public OnPlayerRequestSpawn(playerid) { new Float:X, Float:Y, Float:Z; X = dini_Float(thefile, "CrashX"); Y = dini_Float(thefile, "CrashY"); Z = dini_Float(thefile, "CrashZ"); SetPlayerPos(playerid, X, Y, Z); return 1; }

|
What is "thefile' from lines "X = dini_Float(thefile, "CrashX");
Y = dini_Float(thefile, "CrashY");
Z = dini_Float(thefile, "CrashZ");" ?  ?
|
Probably the file you want the coordinates to be saved in
Re: How would this be done? -
Correlli - 04.07.2009
You should save it into the player's account file.
Re: How would this be done? -
L30 - 06.07.2009
What do I put for
"CrashX"
"CrashY"
"CrashZ"
Re: How would this be done? -
FrazZ - 06.07.2009
Nothing. Its just there to symbolize "When someone crashes, it will temporarily replace CrashX, Y and Z with the coords."