Unique23 Posted December 18, 2013 Share Posted December 18, 2013 Good Evening everyone, I decided to lock this velocity script for the team but something went wrong. Here is the link of script. http://pastebin.com/ae3cWdKr ERROR: Loading script failed: Enes\unique.lua:2: ')' expected near 'then' Link to comment
Castillo Posted December 18, 2013 Share Posted December 18, 2013 function speedup ( thePlayer ) if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) and ( getElementModel ( source ) == 470 ) then local handlingTable = getVehicleHandling ( source ) local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 200 ) ) setVehicleHandling ( source, "numberOfGears", 5 ) setVehicleHandling ( source, "driveType", 'awd' ) setVehicleHandling ( source, "maxVelocity", newVelocity ) setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) end end addEventHandler ( "onVehicleEnter", root, speedup ) Errors I found: 1: You put the event handler inside the function. 2: You had one extra 'end'. 3: You were using getElementType for the wrong purpose. Link to comment
Unique23 Posted December 19, 2013 Author Share Posted December 19, 2013 Thank you for helping Link to comment
Unique23 Posted December 22, 2013 Author Share Posted December 22, 2013 @Solidsnake I'd like to thank you again but I have a problem with the script. It sometimes works , sometimes doesn't work plus I want to do it for all vehicles(except Boats and Airplanes) Link to comment
Castillo Posted December 22, 2013 Share Posted December 22, 2013 Well, you restricted it to the vehicle model 470, have you removed this restriction? Link to comment
Unique23 Posted December 22, 2013 Author Share Posted December 22, 2013 Well, you restricted it to the vehicle model 470, have you removed this restriction? No,I haven't. Link to comment
Castillo Posted December 22, 2013 Share Posted December 22, 2013 If you want it to work for every vehicle, you must remove it. Link to comment
Unique23 Posted December 22, 2013 Author Share Posted December 22, 2013 function speedup ( thePlayer ) if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) and ( getElementModel ( source ) == ) then local handlingTable = getVehicleHandling ( source ) local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) setVehicleHandling ( source, "numberOfGears", 5 ) setVehicleHandling ( source, "driveType", 'awd' ) setVehicleHandling ( source, "maxVelocity", newVelocity ) setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) end end addEventHandler ( "onVehicleEnter", root, speedup ) Okay, It gives error Unexpected symbol near ')' Link to comment
./BlackBird# Posted December 22, 2013 Share Posted December 22, 2013 function speedup ( thePlayer ) if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) then local handlingTable = getVehicleHandling ( source ) local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) 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
Unique23 Posted December 22, 2013 Author Share Posted December 22, 2013 @Alcatraz, It didn't work for me Link to comment
mint3d Posted December 23, 2013 Share Posted December 23, 2013 Can you finish what you were going to say? Unexpected symbol near ')' Link to comment
Unique23 Posted December 23, 2013 Author Share Posted December 23, 2013 @mint3d function speedup ( thePlayer ) if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) and ( getElementModel ( source ) == ) then local handlingTable = getVehicleHandling ( source ) local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) setVehicleHandling ( source, "numberOfGears", 5 ) setVehicleHandling ( source, "driveType", 'awd' ) setVehicleHandling ( source, "maxVelocity", newVelocity ) setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) end end addEventHandler ( "onVehicleEnter", root, speedup ) It says: ERROR:Loading script failed: Enes\speed.lua:3: unexpected symbol near ')' Link to comment
Perfect Posted December 23, 2013 Share Posted December 23, 2013 Try (not tested) function speedup ( thePlayer ) if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) then local handlingTable = getVehicleHandling ( source ) local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) 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
Unique23 Posted December 23, 2013 Author Share Posted December 23, 2013 @Perfect, The script made DFT-30's max speed 200 but nothing for patriot 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