Jump to content

[Question] Setting element speed of a vehicle


kieran

Recommended Posts

I honestly have no clue how to set the element speed of a vehicle, but I want to make this taxi script for RPG servers, basically when you first register a taxi will be created and move to a certain point, it will stop and then I plan to use setPedControlState to make the player enter the vehicle, so far I've created the vehicle and warped the ped in.... but I don't know what else I need.  :oops:

function CreateTaxi ( theVehicle, seat, jacked )
--How to make it so it happens first time player joins?
taxi = createVehicle( 420, 1797.4000244141, -2321.8000488281, 13.02748298645, 0, 0, 90 )
setVehicleColor ( taxi, 189, 200, 12 )     
x,y,z = getElementPosition( taxi )
driver = createPed ( 120, x, y, z+3 )
warpPedIntoVehicle ( driver, taxi)      

--New stuff to me, don't know anything about controlling ped speed, just been crossing fingers and hoping
	kph = getElementSpeed(taxi)
	local veh = getPedOccupiedVehicle(driver)
	--I know I need this after getElementSpeed
		if (veh) then
		setElementSpeed(veh, "kph", 5)
		end
end

addEventHandler ( "onPlayerLogin", getRootElement(), CreateTaxi ) 

Basically only works server side, can I even put it client side?  Will I need to just make a cut scene at start?

Thanks for help. :D 

Link to comment

As far as I know client side vehicles are just useless. There are very limited things you can do with them, what you would need to do (or what I did in my cut-scenes), I created like 10-15 vehicles, put them in a table and triggered that table with triggerClientEvent then warp the peds and use setPedAnalogControlState

 

And to set the vehicle velocity, you would need to use onClientRender client-side.

Edited by pa3ck
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...