SA-MP Forums Archive
SetPlayerPos isn't working properly. - 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)
+--- Thread: SetPlayerPos isn't working properly. (/showthread.php?tid=438231)



SetPlayerPos isn't working properly. - total3clipse - 19.05.2013

Hello, I am using SetPlayerPos to teleport a player to the hitmans base when they press a key, however when I press the defined key it just teleports me to a random position nowhere near the actual co-ordinates the player should be at.

Код:
	if(newkeys == KEY_SECONDARY_ATTACK)
	{
	 	if(IsPlayerInRangeOfPoint(playerid, 10.0,-831.0634,1985.0758,9.4007))
	        {
			SetPlayerPos(playerid, -571.6187, 2003.2090, -360.5818);
			return 1;
		}

It just teleports me to -827.1250,1975.1250,7.6998.
Unless it's because I am teleporting deep beneath the ground and it's bugging out I am totally confused any help is greatly appreciated.


Re: SetPlayerPos isn't working properly. - Tamer - 19.05.2013

Probably the coordinates are wrong,go ingame and do /save where you want the player to get teleported.,grab the Coordinates from GTA SA User Files (Saved positions.txt)

AddPlayerClass(287,1127.7100, 2861.0835, 10.8203, 40.7175,0,0,0,0,0,0);

Red part is the coordinates.


Re: SetPlayerPos isn't working properly. - total3clipse - 19.05.2013

Quote:
Originally Posted by Tamer T
Посмотреть сообщение
Probably the coordinates are wrong,go ingame and do /save where you want the player to get teleported.,grab the Coordinates from GTA SA User Files (Saved positions.txt)

AddPlayerClass(287,1127.7100, 2861.0835, 10.8203, 40.7175,0,0,0,0,0,0);

Red part is the coordinates.
That isn't possible due to the fact that I mapped it in myself and cannot get there to do /save because the coding above doesn't teleport me there, but clicking on one of the objects using Map Construction gives the Co-ordinates that I want the player to be teleported to, so I don't know.


Re: SetPlayerPos isn't working properly. - Tamer - 19.05.2013

The problem is exactly that,the map editor can give false coordinates,actually,the player's body will appear cutted of (in other terms,the player is not exactly on the coordinate you want them to be!)right in the object,therefore you are falling on ground,you should go ingame (using test) and doing /save there.


Re: SetPlayerPos isn't working properly. - total3clipse - 19.05.2013

Quote:
Originally Posted by Tamer T
Посмотреть сообщение
The problem is exactly that,the map editor can give false coordinates,actually,the player's body will appear cutted of (in other terms,the player is not exactly on the coordinate you want them to be!)right in the object,therefore you are falling on ground,you should go ingame (using test) and doing /save there.
I cannot get there mate, I just tried to test pointing at exaclty the position it should be then hit Test and it spawned me at the random location.


Re: SetPlayerPos isn't working properly. - Abhishek. - 19.05.2013

well sir map editor gives you your cameras pos not objects point where you clicked
there is a test button click button click on it to get to the clicked pos


Re: SetPlayerPos isn't working properly. - total3clipse - 19.05.2013

Quote:
Originally Posted by Abhishek.
Посмотреть сообщение
well sir map editor gives you your cameras pos not objects point where you clicked
there is a test button click button click on it to get to the clicked pos
I am sorry, but I don't understand you. How do I select which point I will be tped to when I click test?


Re: SetPlayerPos isn't working properly. - mineralo - 19.05.2013

you written Z coordonate -360.5818, I think this is why setting you in wrong place, its too under position, since the water level is around 0.0


Re: SetPlayerPos isn't working properly. - total3clipse - 19.05.2013

Quote:
Originally Posted by mineralo
Посмотреть сообщение
you written Z coordonate -360.5818, I think this is why setting you in wrong place, its too under position, since the water level is around 0.0
I thought it must be something along the lines of this. I will change it and thanks to everyone who helped.