Object angle
#1

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;
}
Reply
#2

Object is using rotation and not angle.
Reply
#3

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
Reply
#4

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.
Reply
#5

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

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.
Reply
#7

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..
Reply
#8

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;
}

Reply
#9

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?
Reply
#10

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..


Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)