Spawn on last pos - 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: Spawn on last pos (
/showthread.php?tid=89629)
Spawn on last pos -
Kanji_Suzuki - 03.08.2009
hello im trying to make it so people spanw on there last pos
the codes are:
Код:
public OnPlayerSpawn(playerid)
{
new string[256];
SetPlayerInterior(playerid,PlayerAccount[playerid][pPlayerINT]);
SetPlayerPos(playerid,PlayerAccount[playerid][pPlayerX],PlayerAccount[playerid][pPlayerY],PlayerAccount[playerid][pPlayerZ]);
SetPlayerFacingAngle(playerid,PlayerAccount[playerid][pPlayerA]);
format(string, sizeof(string), "~w~Position~n~Loaded");
GameTextForPlayer(playerid, string, 5000, 3);
}
public OnPlayerDisconnect(playerid, reason)
{
new Float:x,Float:y,Float:z;
new Float:a;
new Int = GetPlayerInterior(playerid);
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
PlayerAccount[playerid][pPlayerX] = x;
PlayerAccount[playerid][pPlayerY] = y;
PlayerAccount[playerid][pPlayerZ] = z;
PlayerAccount[playerid][pPlayerA] = a;
PlayerAccount[playerid][pPlayerINT] = Int;
return 1;
}
but they crash when they spawn
why?
Re: Spawn on last pos -
dice7 - 03.08.2009
You need to save the last location info into a file and then load it.
And It crashes, because the parameters in
pawn Код:
SetPlayerPos(playerid,PlayerAccount[playerid][pPlayerX],PlayerAccount[playerid][pPlayerY],PlayerAccount[playerid][pPlayerZ]);
are blank
Re: Spawn on last pos -
Hecky - 03.08.2009
Quote:
Originally Posted by dice7
You need to save the last location info into a file and then load it.
And It crashes, because the parameters in
pawn Код:
SetPlayerPos(playerid,PlayerAccount[playerid][pPlayerX],PlayerAccount[playerid][pPlayerY],PlayerAccount[playerid][pPlayerZ]);
are blank
|
I was going to say, are these the only bits of code you have in these sections? You'll need to have it so that users who haven't visited before are given a default spawn point.
Re: Spawn on last pos -
Kanji_Suzuki - 03.08.2009
yeah on there first spawn its ok it works they are given a defolt spawn its when they login second time, and ys its saving to a file
Re: Spawn on last pos -
Kanji_Suzuki - 03.08.2009
any one..
Re: Spawn on last pos -
SkyWinder - 12.08.2009
I have the Exact same problem can any1 help?
Re: Spawn on last pos -
[LF]Mr.Lucci - 25.08.2009
I am also trying to implement something like this, anyone??
Re: Spawn on last pos -
Mauka4 - 26.08.2009
I got same problem with postion save.