Jump to content

Help with script


KryngeerPL

Recommended Posts

Posted

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?

Posted

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

Posted

I want to change Greenwood on Rhino, because i want to load 2 models for tank, Rhino = M1 Abrams and Greenwood = T-90, so when i change the type of Greenwood to tank, then i can move turret and shoot.

Posted

First replace the new tank model on greenwood.

You can use Handling.cfg for vehicle handling. Then createExplosion for tank shoot. You can't change turret rotation for fake tanks. But you can use other method. For example: Find a turret object and attach object to on tank. And set rotation with camera rotation. Maybe it's not easy. Good luck!

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