Jump to content

In Need Of Change Vehicle Help


heavy air

Recommended Posts

Hello

i am trying to create a console command that lets me change vehicle model while in the vehicle

EG. buffalo - ibto - AT400

i have managed to add speed boost, stick to vehicles and spawn ramp commands

but i just cant figure this one out

mostly i borrow and edit scripts from other resources in mta but i cant seem

to find anything that does this

i have also tried using createpickup to set a vehicle change pickup but i dont know what the ID number is

ANY HELP OR IDEAS GREATLY APPRECIATED :D

Link to comment

I have tried writing the function according to this

but i just cant get the syntax right

i am very new to scripting and really dont know what im doing tbh :oops:

so far ive been able to look at the way things are donr in other scripts

and figure out what i need to write to get the effect i want

but this ones really difficult for some reason

thanx for the help though i am still workin on it and will post if have any progress

THANX AGAIN :D

edit:

is this even close :roll:

function consoleChangeVehicle ( player, command, id )

if ( player ) then

local = getPlayerOccupiedVehicle x, y, z, rx, ry, rz

x, y, z = getElementPosition ( player )

rx, ry, rz = getVehicleRotation ( player )

then setVehicleModel ( player, id )

end

end

Link to comment

Uhm, should the second then be there? you could just remove that I think, and why are you getting the coords and rotation? it just changes the model of the vehicle, so I think it'd be like

  
 function consoleChangeVehicle ( player, command, id ) 
     if ( id ) then 
      local newCar = tonumber( id ) 
      local oldCar = getPlayerOccupiedVehicle( player ) 
      setVehicleModel ( oldCar, newCar ) 
      else 
      outputChatBox( "You forgot to specify the car id", player ) 
     end 
 end 
  

But I cant test it cause my game freezes up when I play, so I dont know if it works :P

Link to comment

A_mazing my friend

works perfect and even keeps the same colors

THANK U VERY MUCH!!!!!!!!!!!!!!!!!!!! :D:lol:

confused my self a bit in my scripti was basing my script on the

createvehicle command and didnt realize getoccupiedvehicle would

give me all the position data for the new vehicle :roll:

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