Feche1320 Posted October 17, 2014 Share Posted October 17, 2014 I am using my custom map object loader, load .map objects, send them to client and create them there, but I have this issue: No objects on the middle as you can see.. If I move around you can see that now objects load After moving again to the start position, objecs are now loaded.. is there any fix for this? creating objects server-side does the same thing.. thanks Link to comment
ZL|LuCaS Posted October 17, 2014 Share Posted October 17, 2014 is loading objects into the wrong positions? obs:are you sure you getting all the position: [x,y,z] rotation: [x,y,z] Link to comment
Anubhav Posted October 17, 2014 Share Posted October 17, 2014 I guess its a MTA/GTA bug. LuCaS @ You don't a make script to load objects Link to comment
King12 Posted October 17, 2014 Share Posted October 17, 2014 show your codes, we can't help you from images. Link to comment
ZL|LuCaS Posted October 17, 2014 Share Posted October 17, 2014 I guess its a MTA/GTA bug.LuCaS @ You don't a make script to load objects yes i did, show part of your code. Link to comment
Feche1320 Posted October 17, 2014 Author Share Posted October 17, 2014 -- This gets all objects, markers, spawnpoints -- getAll(resource, "object") -- getAll(resource, "spawnpoint") -- etc.. function getAll(res, name) local idx = 0 local xml = xmlLoadFile(":" ..getResourceName(res).. "/meta.xml") local child = xmlFindChild(xml, "map", idx) if child and xml then local mapsrc = xmlNodeGetAttribute(child, "src") xmlUnloadFile(xml) local map = xmlLoadFile(":" ..getResourceName(res).. "/" ..mapsrc) if map then local result = {} local node = xmlFindChild(map, name, 0) while node do local row = {} local attr = xmlNodeGetAttributes(node) for k, v in pairs(attr) do row[k] = v end table.insert(result, row) idx = idx + 1 node = xmlFindChild(map, name, idx) end -- Search for if name == "object" then local index = 0 local node = xmlFindChild(map, "track", index) while node do outputDebugString("server_maps: found , loading..") local idx = 0 local child = xmlFindChild(node, "object", idx) while child do local row = {} local attr = xmlNodeGetAttributes(child) for k, v in pairs(attr) do row[k] = v end table.insert(result, row) idx = idx + 1 child = xmlFindChild(node, "object", idx) end index = index + 1 node = xmlFindChild(map, "track", index) end end xmlUnloadFile(map) return result end end end -- Load new objects _objs = getAll(res, "object") triggerClientEvent("createMapObjects", root, _objs) -- Client side addEventHandler("createMapObjects", root, function(_objs) local id = nil for i = 1, #_objs do if _objs[i].collisions == "false" then id = createObject(tonumber(_objs[i].model), tonumber(_objs[i].posX), tonumber(_objs[i].posY), tonumber(_objs[i].posZ), tonumber(_objs[i].rotX) or 0, tonumber(_objs[i].rotY) or 0, tonumber(_objs[i].rotZ) or 0, true) else id = createObject(tonumber(_objs[i].model), tonumber(_objs[i].posX), tonumber(_objs[i].posY), tonumber(_objs[i].posZ), tonumber(_objs[i].rotX) or 0, tonumber(_objs[i].rotY) or 0, tonumber(_objs[i].rotZ) or 0) end setElementDimension(id, tonumber(_objs[i].dimension) or 0) setElementInterior(id, tonumber(_objs[i].interior) or 0) setObjectScale(id, tonumber(_objs[i].scale) or 1.0) end end ) -- And this gets triggered before loading a new map addEventHandler("deleteMapObjects", root, function() -- Destroy previous objects if exists local o = 0 local objs = getElementsByType("object") if #objs > 0 then for i, tmp in ipairs(objs) do destroyElement(tmp) o = o + 1 end end outputDebugString("server_maps: " ..o.. " objects were destroyed.") end ) Link to comment
ZL|LuCaS Posted October 17, 2014 Share Posted October 17, 2014 it happens to all maps? Link to comment
Feche1320 Posted October 17, 2014 Author Share Posted October 17, 2014 On maps that have lots of objects.. in orginal race mode this doesn't happend Link to comment
ZL|LuCaS Posted October 17, 2014 Share Posted October 17, 2014 On maps that have lots of objects.. in orginal race mode this doesn't happend I had this problem on a map, you're only carrying objects called object into xml, some maps have objects within other nodes. Link to comment
Feche1320 Posted October 17, 2014 Author Share Posted October 17, 2014 Objects are created, there is some bug when drawing them, it's either a MTA or SA bug Link to comment
ZL|LuCaS Posted October 17, 2014 Share Posted October 17, 2014 Objects are created, there is some bug when drawing them, it's either a MTA or SA bug I will analyze your code on my server soon give you an answer. Link to comment
Saml1er Posted October 17, 2014 Share Posted October 17, 2014 You can check map extension script https://wiki.multitheftauto.com/wiki/En ... ODDistance Link to comment
Feche1320 Posted October 17, 2014 Author Share Posted October 17, 2014 You can check map extension script https://wiki.multitheftauto.com/wiki/En ... ODDistance Yes I tried with that too and still the same problem. Link to comment
Saml1er Posted October 17, 2014 Share Posted October 17, 2014 You can check map extension script https://wiki.multitheftauto.com/wiki/En ... ODDistance Yes I tried with that too and still the same problem. Can you show me the code where you used this function? Link to comment
Feche1320 Posted October 18, 2014 Author Share Posted October 18, 2014 You can check map extension script https://wiki.multitheftauto.com/wiki/En ... ODDistance Yes I tried with that too and still the same problem. Can you show me the code where you used this function? I used it on onClientResourceStart Link to comment
Moderators IIYAMA Posted October 21, 2014 Moderators Share Posted October 21, 2014 how far are you from the boundary ? Because after an amount of units this happens. Link to comment
Feche1320 Posted October 22, 2014 Author Share Posted October 22, 2014 how far are you from the boundary ?Because after an amount of units this happens. It also happends on maps that start at the beach or near SA map. Link to comment
Anubhav Posted October 23, 2014 Share Posted October 23, 2014 Maybe it's your PC? Update you drivers may make it work. Link to comment
toxicsmoke11 Posted October 23, 2014 Share Posted October 23, 2014 not sure but it could be problem like this http://bugs.mtasa.com/view.php?id=4298 Link to comment
Moderators IIYAMA Posted October 23, 2014 Moderators Share Posted October 23, 2014 @toxicsmoke11 Yes that is a bug, but that won't matter so much because the rounded numbers are accurate enough. Also by not doing that(not convert to string), it saves you some bandwidth. @Feche1320 I think it is more a kind of streamed in bug. I have a sort of similar bug: When I attach an object(with disable col) to my car. It will only be visible when I start driving. (before moving it is only at the position I created it) What if you force them to be not stream able and enabled that later? https://wiki.multitheftauto.com/wiki/Se ... Streamable It would be a logic explanation. 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