Jump to content

Help with script


KryngeerPL

Recommended Posts

Hi, i'm having a problem with this:

function changeType ( theVehicle, typ, id ) 
    local typ = getVehicleType ( theVehicle ) 
    local id = getElementModel ( theVehicle ) 
    if id == 492 then 
        typ == "tank" 
    end 
end 

My server drop me error:

SCRIPT ERROR: greenwoo\test.lua:5: '=' expected near '=='

ERROR: Loading script failed: greenwoo\test:lua:5: '=' expected near '=='

I want to change type of Greenwood to "tank". Can anyone help me?

Link to comment

You can use this. But it's only change the variable. It's not change vehicle type.

function changeType ( theVehicle, typ, id ) 
    local typ = getVehicleType ( theVehicle ) 
    local id = getElementModel ( theVehicle ) 
    if id == 492 then 
        typ = "tank" 
    end 
end 

As far as I know, not possible change element type.

If you want to change model 492 to rhino model, use this:

function changeType ( theVehicle, typ, id ) 
    local typ = getVehicleType ( theVehicle ) 
    local id = getElementModel ( theVehicle ) 
    if id == 492 then 
        setElementModel(theVehicle, 432) -- Change element model to 432(Rhino). 
    end 
end 

Other vehicles: Here

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