Jump to content

Vehiclechange problem


Eddyxd

Recommended Posts

Hi, how are you? I hope is fine

I have a problem when cars change (with vehiclechange) , when i change the vehicle in zones hard, the vehicle

appear bad like this example

f-mta_screen_2013_52ab32300014d354.png

how can fix this :(

Other example:

I finishing this world:

f-mta_screen_2013_52ab34040014d357.png

I got the hunter and appear bad :?

f-mta_screen_2013_52ab35300014d35a.png

I want it then appears as follows: Look that video in min 6: 45 - 6:52

www.youtube.com/watch?v=rihDOvWPV4M

In this video does not pass the error happens to me? (Vehiclechange to Hunter), as I can fix it?

Link to comment
  • Moderators

Try this(fill in the location)

local x,y,z = 0,0,0 -- fill in 
  
addEventHandler("onElementModelChange", root, 
function (oldModel,newModel) 
    if newModel == 425 and getElementType(source) == "vehicle" then --425 = hunter 
        setElementPosition(source,x,y,z) 
    end 
end) 

Link to comment

I tired from try with SetElementRotation but i dont know how script, Im noob scripting

I use this :

local x,y,z = 0,0,0 -- fill in

addEventHandler("onElementModelChange", root,

function (oldModel,newModel)

if newModel == 425 and getElementType(source) == "vehicle" then --425 = hunter

local rotX, rotY, rotZ = getElementRotation(425) -- get the local client's vehicle rotation

setElementRotation(localVehicle,rotX,rotY+10)

end

end)

Dont work! :/

btw: sorry for bad english

Link to comment

You are trying to get the rotation of a number.

addEventHandler("onElementModelChange", root, 
function (oldModel,newModel) 
if newModel == 425 and getElementType(source) == "vehicle" then --425 = hunter 
local rotX, rotY, rotZ = getElementRotation(source) -- get the local client's vehicle rotation 
setElementRotation(source,rotX,rotY+10, rotZ)  
end 
end) 

Edited by Guest
Link to comment
  • Moderators
I tired from try with SetElementRotation but i dont know how script, Im noob scripting

I use this :

local x,y,z = 0,0,0 -- fill in

addEventHandler("onElementModelChange", root,

function (oldModel,newModel)

if newModel == 425 and getElementType(source) == "vehicle" then --425 = hunter

local rotX, rotY, rotZ = getElementRotation(425) -- get the local client's vehicle rotation

setElementRotation(localVehicle,rotX,rotY+10)

end

end)

Dont work! :/

btw: sorry for bad english

If you don't know how an event or function works. There is this page to help you with finding out what the source is, etc.

addEventHandler("onElementModelChange", root, 
function (oldModel,newModel) 
    if newModel == 425 and getElementType(source) == "vehicle" then --425 is the model of the hunter 
        local rotX, rotY, rotZ = getElementRotation(source) -- source is the variable of the vehicle 
        setElementRotation(source,rotX,rotY+10,0) -- always define all required fields.   
    end 
end) 
  

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