SA-MP Forums Archive
Object angle - 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: Object angle (/showthread.php?tid=81624)



Object angle - JoeDaDude - 12.06.2009

Im creating a roadblock command,
It creates the roadblock fine, But its current angle is 0,0,0
How do i get the script to get the players angle and apply it to the object,
Current code:

pawn Код:
if (strcmp(cmd, "/roadblock", true) == 0)
{
  new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
   
    CreateObject(981,x,y,z,0,0,0);
    SetPlayerPos(playerid,x,y,40);
    return 1;
}



Re: Object angle - Correlli - 12.06.2009

Object is using rotation and not angle.


Re: Object angle - JoeDaDude - 12.06.2009

Quote:
Originally Posted by Don Correlli
Object is using rotation and not angle.
Well rotation, but still how do i get the object to copy the players angle


Re: Object angle - Correlli - 12.06.2009

You can get player's angle with GetPlayerFacingAngle but what are you going to do with it? Object is using x, y and z rotation.


Re: Object angle - GTA_Rules - 12.06.2009

I suggest you do it manually, it won't take that long.


Re: Object angle - ziomal396 - 12.06.2009

I think that the command should look like this:

Код:
if (strcmp(cmd, "/roadblock", true) == 0)
{
	new Float:x, Float:y, Float:z, Float:a;
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, a);

	CreateObject(981, x, y, z, 0, 0, a);
	SetPlayerPos(playerid, x, y, z + 20);
	return 1;
}
EDIT: Don Correlli, yes.


Re: Object angle - Correlli - 12.06.2009

Quote:
Originally Posted by ziomal396
I think that the command should look like this:

Код:
if (strcmp(cmd, "/roadblock", true) == 0)
{
	new Float:x, Float:y, Float:z, Float:a;
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, a);

	CreateObject(981, x, y, z, 0, 0, a);
	SetPlayerPos(playerid, x, y, z + 20);
	return 1;
}
With this you're going to make object's z rotation same as player's angle..


Re: Object angle - ziomal396 - 12.06.2009

Don Corelli, I haven't remember to define Float:a.

Quote:

if (strcmp(cmd, "/roadblock", true) == 0)
{
new Float, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);

CreateObject(981, x, y, z, 0, 0, a);
SetPlayerPos(playerid, x, y, z + 20);
return 1;
}




Re: Object angle - Correlli - 12.06.2009

You've posted this after i edited my post, after i saw that you defined it.
But still, that isn't correct, object's z rot. as player's angle?


Re: Object angle - yom - 12.06.2009

Quote:
Originally Posted by Don Correlli
Object is using rotation and not angle.
That's interesting, i would like to know what you mean.

Quote:
Originally Posted by Don Correlli
But still, that isn't correct, object's z rot. as player's angle?
Z rotation of the object is it's rotation around the Z axis... which is the same thing that GetPlayerFacingAngle return - the rotation of the player, around the Z axis, also called Z angle, or yaw..