SA-MP Forums Archive
How do I save a players pos and make it their spawn? - 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 do I save a players pos and make it their spawn? (/showthread.php?tid=133846)



How do I save a players pos and make it their spawn? - Richy_Bugger - 14.03.2010

How do I save a players position when they disconnect, and when they spawn, it spawns them at that position? It's like San Andreas Roleplay.


Re: How do I save a players pos and make it their spawn? - Postalityjr - 14.03.2010

well i have a san fierro team deathmatch server that does the exact thing you want I just dont know if its the gamemode you want.AnyWay If you want it take it


Re: How do I save a players pos and make it their spawn? - Richy_Bugger - 14.03.2010

Where would I go to find this code? I found some of it under OnPlayerDisconnect.


Re: How do I save a players pos and make it their spawn? - Postalityjr - 14.03.2010

Quote:
Originally Posted by Richy_Bugger
Where would I go to find this code? I found some of it under OnPlayerDisconnect.
i put the AMX and the PWN for you At my Attachments


Re: How do I save a players pos and make it their spawn? - pierhs - 14.03.2010

Quote:
Originally Posted by Richy_Bugger
Where would I go to find this code? I found some of it under OnPlayerDisconnect.
You need to save their pos at their userfile.Ill give u an example:

pawn Код:
//Lets say that this is ur playerinfo system
enum pinfo
{
//Here is ur other defines
Float:pPos_x, //for the x coord
Float:pPos_y, //for the y coord
Float:pPos_z, //for the z coord
Float:pPos_A, //for the facing angle
};
new PlayerInfo[MAX_PLAYERS][pInfo];

Now to the OnPlayerDisconnect u should at this:
pawn Код:
GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_A]);
//Done all coordinates are saved
Now to spawn at this pos, u need to add this lines to OnPlayerSpawn.If u already use other spawn coords u need to delete them.
pawn Код:
SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_A]);
I hope that will help


Re: How do I save a players pos and make it their spawn? - Richy_Bugger - 14.03.2010

thanks