Forrest Posted February 28, 2013 Posted February 28, 2013 (edited) Sorted! <3 Edited February 28, 2013 by Guest
Moderators IIYAMA Posted February 28, 2013 Moderators Posted February 28, 2013 if ll > 10 then return end This kind of limits???? if you want more you can put it in a table. local Limit = {1,4} outputChatBox(Limit[2]) --4
Forrest Posted February 28, 2013 Author Posted February 28, 2013 I need it to limit between 2 values, 0.1 and -0.45. However I'm having trouble doing it
Moderators IIYAMA Posted February 28, 2013 Moderators Posted February 28, 2013 if ll > 0.1 or ll < -0.45 then return end
Forrest Posted February 28, 2013 Author Posted February 28, 2013 Upon fail, or typing no value it doesn't output the syntax etc anymore. It's kicking out ".lua:26: attempt to compare number with nil" Current script function llChange ( me, command, ll ) if (exports.global:isPlayerAdmin(me)) then ll = tonumber ( ll ) local veh = getPedOccupiedVehicle ( me ) if ll > 0.1 or ll < -0.45 then outputChatBox ( "Don't be a twat", me, 255, 0, 0 ) return end if ll and veh then local success = setVehicleHandling ( veh, "suspensionLowerLimit", ll ) if success then outputChatBox ( "The vehicle's lower limit has been changed to: "..ll..".", me, 0, 255, 0 ) else outputChatBox ( "Changing lower limit failed. You're probably using an invalid limit.", me, 255, 0, 0 ) end elseif not veh then outputChatBox ( "You're not in a vehicle", me, 255, 0, 0 ) elseif not ll then outputChatBox ( "Syntax: /sll [0.1 to -0.45]", me, 255, 0, 0 ) end end end addCommandHandler ( "sll", llChange )
Moderators IIYAMA Posted February 28, 2013 Moderators Posted February 28, 2013 Note: don't destroy your tabs, else it will be unclear for everybody. function llChange ( me, command, ll ) if (exports.global:isPlayerAdmin(me)) then ll = tonumber ( ll ) local veh = getPedOccupiedVehicle ( me ) if ll and veh then if ll > 0.1 or ll < -0.45 then outputChatBox ( "Don't be a twat", me, 255, 0, 0 ) return end local success = setVehicleHandling ( veh, "suspensionLowerLimit", ll ) if success then outputChatBox ( "The vehicle's lower limit has been changed to: ".. ll ..".", me, 0, 255, 0 ) else outputChatBox ( "Changing lower limit failed. You're probably using an invalid limit.", me, 255, 0, 0 ) end elseif not veh then outputChatBox ( "You're not in a vehicle", me, 255, 0, 0 ) elseif not ll then outputChatBox ( "Syntax: /sll [0.1 to -0.45]", me, 255, 0, 0 ) end end end addCommandHandler ( "sll", llChange )
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