Jump to content

Feche1320

Members
  • Posts

    461
  • Joined

  • Last visited

Everything posted by Feche1320

  1. He didn't say when the server shutdowns. He just wants to save the data when a player leaves from the server, onClientResourceStop gets called when player disconnects/quits from MTA.
  2. Why are you releasing it compiled? You can't do that.
  3. addEventHandler("onClientResourceStop", getResourceRootElement(), function() triggerServerEvent("savePlayerData", localPlayer) end ) That should do it.
  4. Just look at all my started threads, the only way to learn is to keep trying and if you can't resolve then ask.
  5. Instead of nil use a value of eg -1 so you know that there is 'no value' in there.
  6. Solution: I made an automatic script to change every resource meta.xml and add a clientfile with the function that Necktrox wrote, thanks!
  7. I'm sorry but I meant client-side outputChatBox,
  8. Is there any 'official' way to cancel the outputChatBox from a resource? thanks
  9. It also happends on maps that start at the beach or near SA map.
  10. Yep I tought on those, but my maths skills are -9999..
  11. Hello, I made this little (messy) script -- Size for the scrollbar.. (very messy and inefficient I think) local mapsleft, groups, pos, run = #_mapcache, 0, 0, 0, true while run do pos = pos + 1 if pos == 15 then groups = groups + 1 mapsleft = mapsleft - 15 pos = 0 end if mapsleft <= 15 then groups = groups + 1 run = false end end What this does it gives me the scrollbar height grouping maps by 15, I know there must be a better way.. thanks
  12. 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
  13. Yes I tried with that too and still the same problem.
  14. Objects are created, there is some bug when drawing them, it's either a MTA or SA bug
  15. On maps that have lots of objects.. in orginal race mode this doesn't happend
  16. -- 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 )
  17. 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
  18. It's for a user panel, when panel is open stats are showed, when closed, not.
  19. Hey guys, another of my big questions If I use getElementData in onClientRender, the client will call the server each time the frame is rendered or setElementData sends the data to the client when it is updated and it stores it clienside?
  20. Hello, another of my questions local table = { [271] = 3000 } local table = { [0] = 3000 } Which one is better? I assume that [271] = 0 means that there are 270 empy tables using RAM for nothing, is this like this? The question is regarding a skin system were I am going to put the money on the variable and use the skinid as reference, thanks.
  21. Thanks, by the way, is it faster to have a variable with a copy of my SQL database for like, checking if account is already registered?
×
×
  • Create New...