SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/01/2015, 12:18 AM   #1
Flokx
Big Clucker
 
Join Date: Sep 2014
Posts: 56
Reputation: 2
Default Move object in one direction from my position

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.
Flokx is offline   Reply With Quote
Old 07/01/2015, 06:46 PM   #2
Flokx
Big Clucker
 
Join Date: Sep 2014
Posts: 56
Reputation: 2
Default Re: Move object in one direction from my position

Bump _--__-__-__-__D -d_D_D-D-asdka;sld;
Flokx is offline   Reply With Quote
Old 08/01/2015, 12:39 PM   #3
ball
Huge Clucker
 
ball's Avatar
 
Join Date: Jul 2012
Location: Poznan, Poland
Posts: 279
Reputation: 33
Default Re: Move object in one direction from my position

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).
ball is offline   Reply With Quote
Old 08/01/2015, 01:19 PM   #4
lwilson
Big Clucker
 
Join Date: May 2014
Posts: 196
Reputation: 8
Default Re: Move object in one direction from my position

Does the Object Attached to Vehicle?? if not maybe you used it on wrong BONE.

__________________
Next Life Roleplay [Refunding/Hiring]
SERVER IP: 172.245.220.133:7108
http://nextlife-rp.boards.net/
lwilson is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Map Mover 1.0 - Move whole map to another position. adri1 Filterscripts 85 27/01/2019 09:41 PM
Object Rotations changed by direction Roai Scripting Help 0 12/12/2013 03:18 PM
Why if I move a box with a Forklift I can't get the new position of the object? CTCCoco Help Archive 1 26/07/2011 01:04 PM
move object wiht command then auto move back slymatt Help Archive 8 25/07/2011 01:27 AM
Calculate required rotation for object to face in camera direction Chaser98 Help Archive 3 15/12/2010 12:39 AM


All times are GMT. The time now is 06:38 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.