21.07.2011, 15:33
I did it .
Well, i understood that the distance between the player and the the yellow point is 10 , and i don't know what is the distance between the yellow point and the two red points, but you can modify this things in the code :
Or, if you want that both angles in the yellow point have 90 degrees of measure (in other words, always exactly equal to the image you posted) :
I hope that i have helped .
Well, i understood that the distance between the player and the the yellow point is 10 , and i don't know what is the distance between the yellow point and the two red points, but you can modify this things in the code :
pawn Код:
stock GetXYInFrontOfPlayer(playerid,Float:X1, Float:Y1, Float:X2, Float:Y2)
{
new Float:Temp, Float:Angle;
GetPlayerPos(playerid,X1,Y1,Temp);
GetPlayerPos(playerid,X2,Y2,Temp);
GetPlayerFacingAngle(playerid, Angle);
if(Angle >= 180 && Angle < 360) Angle -= 180;
X1 += floatcos(Angle, degrees) * 10;
X2 += floatcos(Angle, degrees) * 10;
Y1 += floatsin(Angle, degrees) * 10;
Y2 += floatsin(Angle, degrees) * 10;
X1 -= 5; //Change 5 to the Distance between the left Red Point and the Yellow Point
X2 += 2; //Change 2 to the Distance between the rigth Red Point and the Yellow Point
return true;
}
Or, if you want that both angles in the yellow point have 90 degrees of measure (in other words, always exactly equal to the image you posted) :
pawn Код:
stock GetXYInFrontOfPlayer(playerid,Float:X1, Float:Y1, Float:X2, Float:Y2)
{
new Float:Temp;
GetPlayerPos(playerid,X1,Y1,Temp);
GetPlayerPos(playerid,X2,Y2,Temp);
Y1 += 10;
Y2 += 10;
X1 -= 5; //Change 5 to the Distance between the left Red Point and the Yellow Point
X2 += 2; //Change 2 to the Distance between the rigth Red Point and the Yellow Point
return true;
}
I hope that i have helped .