mint3d Posted May 22, 2014 Posted May 22, 2014 (edited) Ok so I need help on this script I have been working on so basically it sets all vehicles in the faction but I only want it to set all elegys in the faction can someone help me out please? function setHandling() for key,veh in ipairs(getElementsByType("vehicle")) do if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 20) setVehicleHandling(veh, "maxVelocity", 165) setVehicleHandling(veh, "steeringLock", 45) end if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 22) setVehicleHandling(veh, "maxVelocity", 200) setVehicleHandling(veh, "steeringLock", 50) end if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 15) setVehicleHandling(veh, "maxVelocity", 180) setVehicleHandling(veh, "brakeDeceleration", 1000) setVehicleHandling(veh, "tractionMultiplier", 0.9) end if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 22) setVehicleHandling(veh, "maxVelocity", 200) setVehicleHandling(veh, "steeringLock", 50) setVehicleHandling(veh, "brakeDeceleration", 1000) end end end addEventHandler("onResourceStart", getRootElement(), setHandling) Edited May 22, 2014 by Guest Skype: Jordan_Nymph
justn Posted May 22, 2014 Posted May 22, 2014 function setHandling() for key,veh in ipairs(getElementsByType("vehicle")) do if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 20) setVehicleHandling(veh, "maxVelocity", 165) setVehicleHandling(veh, "steeringLock", 45) end if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 22) setVehicleHandling(veh, "maxVelocity", 200) setVehicleHandling(veh, "steeringLock", 50) end if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 15) setVehicleHandling(veh, "maxVelocity", 180) setVehicleHandling(veh, "brakeDeceleration", 1000) setVehicleHandling(veh, "tractionMultiplier", 0)--. end if (getElementData(veh, "faction") == 72) then setVehicleHandling(veh, "engineAcceleration", 22) setVehicleHandling(veh, "maxVelocity", 200) setVehicleHandling(veh, "steeringLock", 50) setVehicleHandling(veh, "brakeDeceleration", 1000) end end end addEventHandler("onResourceStart", getRootElement(), setHandling) Datastore - Store data to a database quickly. (Useful for saving scripted tables)
mint3d Posted May 22, 2014 Author Posted May 22, 2014 Ye line 17 is like that because its 0. 8 ) its a smiley... so I just made it 0.9) to make life easier lol Skype: Jordan_Nymph
tosfera Posted May 22, 2014 Posted May 22, 2014 Double post, you can't bump your post which its latest reply was 9 minutes ago. Way to go man, anyway. If you only want to edit the Elegy, just add a check in there; if ( getElementModel ( veh ) == ) then like so; function setHandling() for key,veh in ipairs ( getElementsByType ( "vehicle" ) ) do if ( getElementModel ( veh ) == 562 ) then if ( getElementData ( veh, "faction" ) == 72 ) then setVehicleHandling ( veh, "engineAcceleration", 20 ); setVehicleHandling ( veh, "maxVelocity", 165 ); setVehicleHandling ( veh, "steeringLock", 45 ); end if ( getElementData ( veh, "faction" ) == 72) then setVehicleHandling ( veh, "engineAcceleration", 22 ); setVehicleHandling ( veh, "maxVelocity", 200 ); setVehicleHandling ( veh, "steeringLock", 50 ); end if ( getElementData ( veh, "faction" ) == 72) then setVehicleHandling ( veh, "engineAcceleration", 15 ); setVehicleHandling ( veh, "maxVelocity", 180 ); setVehicleHandling ( veh, "brakeDeceleration", 1000 ); setVehicleHandling ( veh, "tractionMultiplier", 0.9 ); end if ( getElementData ( veh, "faction" ) == 72) then setVehicleHandling ( veh, "engineAcceleration", 22 ); setVehicleHandling ( veh, "maxVelocity", 200 ); setVehicleHandling ( veh, "steeringLock", 50 ); setVehicleHandling ( veh, "brakeDeceleration", 1000 ); end end end end addEventHandler ( "onResourceStart", getRootElement(), setHandling ) And why do you have the if-statement 4 times btw? I'm talking about this one; if ( getElementData ( veh, "faction" ) == 72 ) then If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
mint3d Posted May 22, 2014 Author Posted May 22, 2014 lol I am being a noob where should I add that? sorry for me being a noob lol new to this Skype: Jordan_Nymph
tosfera Posted May 22, 2014 Posted May 22, 2014 I edited your code, just replace it with your old code. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
mint3d Posted May 22, 2014 Author Posted May 22, 2014 I don't know why I have it stated that many times I don't know how to make it less coding lol Skype: Jordan_Nymph
tosfera Posted May 22, 2014 Posted May 22, 2014 function setHandling() for key,veh in ipairs ( getElementsByType ( "vehicle" ) ) do if ( getElementModel ( veh ) == 562 ) then if ( getElementData ( veh, "faction" ) == 72 ) then setVehicleHandling ( veh, "tractionMultiplier", 0.9 ); setVehicleHandling ( veh, "engineAcceleration", 22 ); setVehicleHandling ( veh, "maxVelocity", 200 ); setVehicleHandling ( veh, "steeringLock", 50 ); setVehicleHandling ( veh, "brakeDeceleration", 1000 ); end end end end addEventHandler ( "onResourceStart", getRootElement(), setHandling ) If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
mint3d Posted May 22, 2014 Author Posted May 22, 2014 Your first script worked for only elegys and ye I have a lot of different values at each of them so I don't know Skype: Jordan_Nymph
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