PDA

View Full Version : SetPlayerPos isn't working properly.


total3clipse
19/05/2013, 10:52 AM
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.

Tamer
19/05/2013, 11:04 AM
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.

total3clipse
19/05/2013, 11:07 AM
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.

Tamer
19/05/2013, 11:10 AM
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.

total3clipse
19/05/2013, 11:47 AM
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.

Abhishek.
19/05/2013, 11:52 AM
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

total3clipse
19/05/2013, 12:17 PM
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?

mineralo
19/05/2013, 12:23 PM
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

total3clipse
19/05/2013, 12:33 PM
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.