SA-MP Forums Archive
Coords infront of a player - 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: Coords infront of a player (/showthread.php?tid=386441)



Coords infront of a player - Anthony © - 20.10.2012

I've looked, so don't say "USE THE SEARCH FUNCTION", what I've found is stuff which isn't explained enough. If someone can explain how I can get the coords INFRONT of a player?


Re: Coords infront of a player - newbienoob - 20.10.2012

Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	// Created by ******

	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: Coords infront of a player - Anthony © - 20.10.2012

CreateVehicle(vID,x + 2*floatcos(90+a, degrees), y+ 2*floatsin(90-a, degrees), z, col1, col2, 0);

number of arguments does not match definition, what am I missing? Can't seem to find it.


Re: Coords infront of a player - Mauzen - 20.10.2012

https://sampwiki.blast.hk/wiki/CreateVehicle

Youre missing the angle.


Re: Coords infront of a player - Virus. - 20.10.2012

add 2 to x, if its wrong say me, but I did it this way.


Re: Coords infront of a player - Anthony © - 20.10.2012

Stupid me. Thanks fellers.