^_^ LOL ^_^ Posted February 3, 2014 Share 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 Link to comment
xXMADEXx Posted February 4, 2014 Share 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") Link to comment
^_^ LOL ^_^ Posted February 5, 2014 Author Share 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)) Link to comment
Castillo Posted February 5, 2014 Share Posted February 5, 2014 Where is 'parts' defined? Link to comment
^_^ LOL ^_^ Posted February 5, 2014 Author Share Posted February 5, 2014 Can you add me on skype? Pm. Link to comment
xXMADEXx Posted February 5, 2014 Share 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)) Link to comment
^_^ LOL ^_^ Posted February 5, 2014 Author Share Posted February 5, 2014 @xXMADEXx not working Link to comment
Gtagasje Posted February 5, 2014 Share 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. Link to comment
^_^ LOL ^_^ Posted February 5, 2014 Author Share 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) Link to comment
^_^ LOL ^_^ Posted February 5, 2014 Author Share Posted February 5, 2014 And here is image, if that error is. Link to comment
Castillo Posted February 5, 2014 Share Posted February 5, 2014 I don't see 'parts' getting defined in the code you posted, you should post the whole thing. Link to comment
^_^ LOL ^_^ Posted February 5, 2014 Author Share 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. Link to comment
Castillo Posted February 5, 2014 Share Posted February 5, 2014 I sent you a PM with a possible fix. Link to comment
^_^ LOL ^_^ Posted February 5, 2014 Author Share Posted February 5, 2014 Thank you solidsnake14. Fixed. Link to comment
HueKING Posted September 25, 2015 Share 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. 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