Move object in one direction from my position - 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: Move object in one direction from my position (
/showthread.php?tid=555198)
Move object in one direction from my position -
Flokx - 07.01.2015
I am in a Bullet(Vehicle) and I added an object on that vehicle. Now I wan't the object to move right font of the car with a command /notoy. I have tried a lot for this but my object moves other way. Please help with this.
Re: Move object in one direction from my position -
Flokx - 07.01.2015
Bump _--__-__-__-__D -d_D_D-D-asdka;sld;
Re: Move object in one direction from my position -
ball - 08.01.2015
Code:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, &Float:z, &Float:a, Float:distance)
{
GetPlayerPos(playerid, x, y ,z);
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid),a);
}
else
{
GetPlayerFacingAngle(playerid, a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return 0;
}
Edit this function on your own. This returns x and y variable in front of player. Add to angle 90 or 270 (I don't know which amount will be good for right movement).
Re: Move object in one direction from my position -
lwilson - 08.01.2015
Does the Object Attached to Vehicle?? if not maybe you used it on wrong BONE.
__________________