PashaBiceps Posted May 17, 2021 Posted May 17, 2021 Im having an error ( attempt to compare number with nil ), i need some help to fix it! Thanks for all help local vehFuel = dbPoll(dbQuery(database, "SELECT * FROM playersConce WHERE Account = ?", getAccountName(getPlayerAccount(source))), -1) if vehFuel["Fuel"] > 0 then <<---- Line with the error setElementData(vehicleConces[source], "DNL:Combustivel", vehFuel) else setElementData(vehicleConces[source], "DNL:Combustivel", 100) end
Other Languages Moderators androksi Posted May 17, 2021 Other Languages Moderators Posted May 17, 2021 Hello. I guess you should get the index before the column name. Try changing from vehFuel["Fuel"] to vehFuel[1]["Fuel"] 1
PashaBiceps Posted May 17, 2021 Author Posted May 17, 2021 @andr0xy Ty for the reply, but replacing this i got an error ( attemp to compare number with string )
Other Languages Moderators androksi Posted May 17, 2021 Other Languages Moderators Posted May 17, 2021 tonumber(vehFuel[1]["Fuel"]) 1
PashaBiceps Posted May 17, 2021 Author Posted May 17, 2021 @andr0xy if tonumber(vehFuel[1]["Fuel"]) > 0 then ( Attempt to compare number with table )
Other Languages Moderators androksi Posted May 17, 2021 Other Languages Moderators Posted May 17, 2021 Whaaaa. Use iprint function to debug the value of vehFuel[1]["Fuel"]
PashaBiceps Posted May 17, 2021 Author Posted May 17, 2021 (edited) @andr0xy I tried but i dont know how to use it Edited May 17, 2021 by PashaBiceps
Other Languages Moderators androksi Posted May 18, 2021 Other Languages Moderators Posted May 18, 2021 Oh, my bad. I didn't explain where the iprint function outputs. It outputs on /debugscript 3. The only thing you need to do is run the command which you are having problems, then you will see on Debugger, some green message.
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