K4stic Posted November 10, 2013 Share Posted November 10, 2013 i want up only to carID 596: maxVelocity,driveType,engineAcceleration,numberOfGears and it's saying Error at line 3: function speedup() for i, vehicleiD in ipairs ( getElementsByType("vehicle") ) do local Type = ( getElementType ( i ) == "vehicle" ) if ( Type and getVehicleModelFromName( i ) == 596 ) then local handlingTable = getVehicleHandling ( i ) local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) setVehicleHandling ( i, "numberOfGears", 5 ) setVehicleHandling ( i, "driveType", 'awd' ) setVehicleHandling ( i, "maxVelocity", newVelocity ) setVehicleHandling ( i, "engineAcceleration", handlingTable["engineAcceleration"] +8 ) end end end addEventHandler ( "onResourceStart", resourceRoot, speedup ) Link to comment
tosfera Posted November 10, 2013 Share Posted November 10, 2013 the loop you're creating is giving you a small view back. Let me write you the view abit and you'll understand the error; 1 500 ( ex; infernus ) 2 501 ( ex; bullet ) 3 502 ( ex; uranus ) The i is the index of the array, your vehicleiD is the actual data you're getting back Link to comment
K4stic Posted November 10, 2013 Author Share Posted November 10, 2013 No understand -.-" Link to comment
tosfera Posted November 10, 2013 Share Posted November 10, 2013 You have to change your i to vehicleiD. Link to comment
K4stic Posted November 10, 2013 Author Share Posted November 10, 2013 Thx it's work P.S i'm bad understand the ipairs Link to comment
Baseplate Posted November 10, 2013 Share Posted November 10, 2013 function speedup (thePlayer) if (getElementModel(source) == 596) then local handlingTable = getVehicleHandling (source) local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) setVehicleHandling ( source, "numberOfGears", 5 ) setVehicleHandling ( source, "driveType", 'awd' ) setVehicleHandling ( source, "maxVelocity", newVelocity ) setVehicleHandling ( source, "engineAcceleration", handlingTable["engineAcceleration"] +8 ) end end addEventHandler("onVehicleEnter", root, speedup) Link to comment
K4stic Posted November 10, 2013 Author Share Posted November 10, 2013 function speedup (thePlayer) if (getElementModel(source) == 596) then local handlingTable = getVehicleHandling (source) local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) setVehicleHandling ( source, "numberOfGears", 5 ) setVehicleHandling ( source, "driveType", 'awd' ) setVehicleHandling ( source, "maxVelocity", newVelocity ) setVehicleHandling ( source, "engineAcceleration", handlingTable["engineAcceleration"] +8 ) end end addEventHandler("onVehicleEnter", root, speedup) 1. i say Thx it's fixed 2. i was need that to them resource start to that apply all every Car with this ID not them enter a Player to car 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