^_^ LOL ^_^ Posted February 3, 2014 Posted February 3, 2014 (edited) I try add tank part, by copying engine. And i do all right im sure it. but when i go in vehicle shows this And the 1360 line: local w = dxGetTextWidth(parts.."/"..needparts.." Tank Parts",1.02,"default-bold") Thanks. Edited February 5, 2014 by Guest
xXMADEXx Posted February 4, 2014 Posted February 4, 2014 The error means "needparts" is return nothing, but to simply fix it use tostring() local w = dxGetTextWidth(tostring(parts).."/"..tostring(needparts).." Tank Parts",1.02,"default-bold")
^_^ LOL ^_^ Posted February 5, 2014 Author Posted February 5, 2014 Thank you it works. But have another ERROR: [DayZ-MTA]\DayZ\vehicle_spawns.lua:325: bad argument #2 to 'random' (number expected, got nil) 325 line: setElementData(vehCol,"Parts_inVehicle",math.random(0,parts))
xXMADEXx Posted February 5, 2014 Posted February 5, 2014 Well, I can't be entirely sure, but I think that parts is a table, so try this: setElementData(vehCol,"Parts_inVehicle",math.random(0,#parts))
Gtagasje Posted February 5, 2014 Posted February 5, 2014 Then, as Castillo said, you'd have to tell us where parts is defined. Because the error means that 'parts' is not a number(which math.random needs), it is a nil value meaning it's nothing.
^_^ LOL ^_^ Posted February 5, 2014 Author Posted February 5, 2014 Here it is, i think so. setElementData(veh,"needparts",parts) if ((getElementData(col,"Parts_inVehicle") or 0) < tonumber(parts)) then setVehicleEngineState ( veh, false ) return end (getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0) > tonumber(parts)
^_^ LOL ^_^ Posted February 5, 2014 Author Posted February 5, 2014 And here is image, if that error is.
Castillo Posted February 5, 2014 Posted February 5, 2014 I don't see 'parts' getting defined in the code you posted, you should post the whole thing.
^_^ LOL ^_^ Posted February 5, 2014 Author Posted February 5, 2014 I dont will give all script, who really want help or know very good lua. Pm me i will give script.
HueKING Posted September 25, 2015 Posted September 25, 2015 post on the topic how to solve ... I have the same problem ... SOLVED. I understood what the Solidsnake14 wanted to talk.
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