SkatCh Posted June 25, 2014 Posted June 25, 2014 guys please i need some help here : example : jobsLocation = { {job = "Police Officer", x = 249.6259765625,y = 67.8125,z = 1002.9, r = 67, g = 156, b = 255, int = 6 , dim = 1 , team = "Police Force", skin = {280, 281, 282, 283, 284, 288}, jobEvent = "policeTaken", maxWL = 0, description =" bla bla bla bla bla"}, function ceateJobLocations() for index, val in pairs(jobsLocation) do marker = createMarker(val.x, val.y, val.z-0.5, "cylinder", 1.5, val.r, val.g, val.b, 255) name[marker] = val.job setElementDimension (marker , val.dim ) setElementInterior (marker , val.int) addEventHandler("onMarkerHit", marker, enteredMarker) end end addEventHandler("onResourceStart", resourceRoot, ceateJobLocations) warnings : "setElementinterior " [Excepted number at argument 2 , got nil ] and the same warnig with setElementDimension , so please how can i fix it . Failure is simply an opportunity to begin again more intelligently - Henry Ford
aintaro Posted June 25, 2014 Posted June 25, 2014 Try different name then int when declaring it in the array None of us is as smart as all of us.
SkatCh Posted June 25, 2014 Author Posted June 25, 2014 i don't undrestand you can you post an example . Failure is simply an opportunity to begin again more intelligently - Henry Ford
Anubhav Posted June 25, 2014 Posted June 25, 2014 function ceateJobLocations() for index, val in pairs(jobsLocation) do marker = createMarker(val.x, val.y, val.z-0.5, "cylinder", 1.5, val.r, val.g, val.b, 255) name[marker] = val.job setElementDimension (marker , val.dimen ) setElementInterior (marker , val.inter) addEventHandler("onMarkerHit", marker, enteredMarker) end end addEventHandler("onResourceStart", resourceRoot, ceateJobLocations) jobsLocation = { {job = "Police Officer", x = 249.6259765625,y = 67.8125,z = 1002.9, r = 67, g = 156, b = 255, inter = 6 , dimen = 1 , team = "Police Force", skin = {280, 281, 282, 283, 284, 288}, jobEvent = "policeTaken", maxWL = 0, description =" bla bla bla bla bla"}, See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
SkatCh Posted June 25, 2014 Author Posted June 25, 2014 lol :fp: , can any other one help me . Failure is simply an opportunity to begin again more intelligently - Henry Ford
Et-win Posted June 25, 2014 Posted June 25, 2014 function ceateJobLocations() for index, val in pairs(jobsLocation) do marker = createMarker(val.x, val.y, val.z-0.5, "cylinder", 1.5, val.r, val.g, val.b, 255) name[marker] = val.job setElementDimension (marker , val[1][8] ) setElementInterior (marker , val[1][9]) addEventHandler("onMarkerHit", marker, enteredMarker) end end addEventHandler("onResourceStart", resourceRoot, ceateJobLocations) ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
SkatCh Posted June 25, 2014 Author Posted June 25, 2014 didn't work : Failure is simply an opportunity to begin again more intelligently - Henry Ford
Et-win Posted June 25, 2014 Posted June 25, 2014 Oops, nvm what I said :3 ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Moderators IIYAMA Posted June 25, 2014 Moderators Posted June 25, 2014 There is only 1 way to find out. Which a scripter should first do, before posting his code here on the forum. ALSO KNOWN AS DEBUGGING jobsLocation = { {job = "Police Officer", x = 249.6259765625,y = 67.8125,z = 1002.9, r = 67, g = 156, b = 255, interior = 6 , dimension = 1 , team = "Police Force", skin = {280, 281, 282, 283, 284, 288}, jobEvent = "policeTaken", maxWL = 0, description =" bla bla bla bla bla"} } function ceateJobLocations() for index, val in pairs(jobsLocation) do local marker = createMarker(val.x, val.y, val.z-0.5, "cylinder", 1.5, val.r, val.g, val.b, 255) if marker then name[marker] = val.job local dimension = tonumber(val.dimension) if dimension then setElementDimension (marker, dimension ) else outputDebugString("Failed to set dimension, variable is nil/false. Table index: " .. index .. " .") end local interior = tonumber(val.interior) if interior then setElementInterior (marker, interior) else outputDebugString("Failed to set interior, variable is nil/false. Table index: " .. index .. " .") end addEventHandler("onMarkerHit", marker, enteredMarker) else outputDebugString("Failed to create marker. Table index: " .. index .. " .") end end end addEventHandler("onResourceStart", resourceRoot, ceateJobLocations) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Et-win Posted June 25, 2014 Posted June 25, 2014 May I ask why 'tonumber' if the number is already given in the table? ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Moderators IIYAMA Posted June 25, 2014 Moderators Posted June 25, 2014 You never know, because I have the feeling he has more items inside his table then he is showing us at the moment. He may have defined one with a string or even a userdata. If you want to know what is going wrong, you have to keep open all options and possibility's. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Et-win Posted June 25, 2014 Posted June 25, 2014 You never know, because I have the feeling he has more items inside his table then he is showing us at the moment.He may have defined one with a string or even a userdata. If you want to know what is going wrong, you have to keep open all options and possibility's. +1 ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
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