SA-MP Forums Archive
Save Positions. - 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: Save Positions. (/showthread.php?tid=209793)



Save Positions. - GaB1TzZzu - 11.01.2011

I have add'ed this:

In enum pInfo:
Код:
	Float:pCrashPos_x,
	Float:pCrashPos_y,
	Float:pCrashPos_z,
In OnPlayerConnect(playerid):
Код:
	SetPlayerPos(playerid, PlayerInfo[playerid][pCrashPos_x], PlayerInfo[playerid][pCrashPos_y], PlayerInfo[playerid][pCrashPos_z]);
In OnPlayerDisconnect(playerid):
Код:
	GetPlayerPos(playerid, PlayerInfo[playerid][pCrashPos_x], PlayerInfo[playerid][pCrashPos_y], PlayerInfo[playerid][pCrashPos_z]);
WHAT I WANT TO DO? : When you disconnect from the server, your positions save, and after you log in to be in that positions ..


Re: Save Positions. - JaTochNietDan - 11.01.2011

What's going wrong?

Although I do suspect that the position gotten from OnPlayerDisconnect is going to be wrong, as by the stage that code runs the character will have already been removed. Also using that in OnPlayerConnect won't work properly, they have to spawn first.


Re: Save Positions. - GaB1TzZzu - 11.01.2011

When i connect, i am spawned where is the faction spawn ..


Re: Save Positions. - JaTochNietDan - 11.01.2011

Well your position is probably being set after you've already set it to the CrashPos, so you're going to have to work your way around that. I can't help you there, I don't have your script.


Re: Save Positions. - GaB1TzZzu - 11.01.2011

Tell me a solution, how can i resolve this ..


Re: Save Positions. - JaTochNietDan - 11.01.2011

Okay, the solution is to put the SetPlayerPos code in OnPlayerSpawn instead, and you need to stop the SetPlayerPos part for the faction if you've already set the players position to the crash position.

I don't know how else we can solve things for you if we don't know what your script contains mate.


- GaB1TzZzu - 11.01.2011

THANKS MAN !

Worked !

NO! I have another problem..

Now when i DIE, i have my last QUIT position ..



Re: Save Positions. - DVDK - 11.01.2011

Use this code when you login, and not at OnPlayerSpawn.


Re: Save Positions. - GaB1TzZzu - 11.01.2011

That doesn't work. Look at first reply.. I do that first time, and it doesn't work.


Re: Save Positions. - KaleOtter - 11.01.2011

Make a something like FirstSpawn[MAX_PLAYERS];
At OnPlayerConnet you put FirstSpawn[playerid] = 1;
At onplayerspawn:
Код:
if(FirstSpawn[playerid] == 1)
{
	FirstSpawn[playerid] = 0;
 	// Set the quit pos
}