SA-MP Forums Archive
Get player pos after seting it - 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: Get player pos after seting it (/showthread.php?tid=544076)



Get player pos after seting it - ignas1125 - 30.10.2014

Hi, I cant get my player pos when i set it :/

new Floatos[3];
SetPlayerFacingAngle(playerid, ExitAngle);
SetPlayerPos(playerid, ExitX, ExitY, ExitZ);
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetXYInFrontOfPlayer(playerid, pos[0], pos[1], 4.0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);

and i spawn at the same position i was onlye interior and virtual world changes...
HELP!


Re: Get player pos after seting it - ignas1125 - 30.10.2014

anyone know what is the problem ?
Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) {

	new Float:a;
	
	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);
	
	if (GetPlayerVehicleID(playerid)) {
	
	    GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	    
	}
	
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
	
}



Re: Get player pos after seting it - BornHuman - 30.10.2014

Try changing

pawn Код:
GetPlayerPos(playerid, x, y, a);
to
pawn Код:
GetPlayerPos(playerid, x, y, z);
You're getting the z coordinate, but assigning it to variable a which isn't what I think you wnat.


Re: Get player pos after seting it - Stinged - 31.10.2014

Quote:
Originally Posted by BornHuman
Посмотреть сообщение
Try changing

pawn Код:
GetPlayerPos(playerid, x, y, a);
to
pawn Код:
GetPlayerPos(playerid, x, y, z);
You're getting the z coordinate, but assigning it to variable a which isn't what I think you wnat.
This has nothing to do with the problem.
****** is the creator of that function (GetXYInFrontOfPlayer)
He used "a" instead of "z" as he isn't going to use "z" but he is going to re-assign the angle to "a"


Re: Get player pos after seting it - Pottus - 31.10.2014

Obviously because the player has not sent an update to the server with their new position.