KryngeerPL Posted September 21, 2014 Share Posted September 21, 2014 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
undefined Posted September 21, 2014 Share Posted September 21, 2014 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
KryngeerPL Posted September 21, 2014 Author Share Posted September 21, 2014 But then it will spawn Rhino, but i want to change Greenwood to Rhino, but with Greenwood ID. Link to comment
TAPL Posted September 21, 2014 Share Posted September 21, 2014 This not even a type it's vehicle name -_-". Link to comment
undefined Posted September 21, 2014 Share Posted September 21, 2014 But then it will spawn Rhino, but i want to change Greenwood to Rhino, but with Greenwood ID. Explain a little more. Link to comment
KryngeerPL Posted September 21, 2014 Author Share Posted September 21, 2014 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. Link to comment
undefined Posted September 21, 2014 Share Posted September 21, 2014 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! Link to comment
KryngeerPL Posted September 21, 2014 Author Share Posted September 21, 2014 Thanks, but i try do this otherway. But htnaks for help! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now