Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. More or less the same way scriptDataString .. "\n do \n" .. loopData .. "\n end \n"
  2. @Overkillz For each script you run, you are destroying the previous environment by overwriting the 'enviroment' variable. That does not go well. To be honest I haven't worked much with environments. But you will need to use setfenv function for cutting off the environment. Here a tutorial about the way to go, on the very BOTTOM of this page: http://lua-users.org/wiki/EnvironmentsTutorial A recommendation, based on just things that might be handy. Merge all the strings/scripts together and wrap each of them with: do --script end This will make sure that all local variables stay in their scope. An IIFE will do as well: (in case of an overflow of 200+ local variables in total) (function () -- script end)()
  3. This function can be used to repeat the same image, it might be possible that they use the rotation/rotationCenterOffsetX/rotationCenterOffsetY property for each new repeated image as offset. But I have never seen anybody do that. So that is UNKNOWN territory for me.
  4. Hmm, you could try to generate it with a browser. > browser https://wiki.multitheftauto.com/wiki/CreateBrowser > html + css <section style="width:300px;height:100;background-color:white;border-radius: 25px;"></section> > get https://wiki.multitheftauto.com/wiki/DxGetTexturePixels https://wiki.multitheftauto.com/wiki/DxGetPixelsSize > set https://wiki.multitheftauto.com/wiki/DxCreateTexture https://wiki.multitheftauto.com/wiki/DxSetTexturePixels (or just generate the corners, color = white = #fff is recommended)
  5. See example on this page: https://wiki.multitheftauto.com/wiki/DxDrawCircle (not sure if it works as you want it)
  6. yup!
  7. Yes those will work just fine. But keep in mind that other resources might also add other children. So it's better to be a little bit more specific. local colshapes = getElementChildren ( vehicle, "colshape" ) local colshape = colshapes[1] -- is the colshape not a direct child? Use: local colshapes = getElementsByType ( "colshape", vehicle ) local colshape = colshapes[1]
  8. @ArcAngeL Just to be sure: /start runcode /srun setTeamFriendlyFire ( root, false )
  9. Are you sure this code has been executed last?
  10. ERROR404 becomes ERROR406 Even though I did hope these posts remain ERROR404...
  11. Remove the return statement, the break statement also stops the loop. The return statement has no purpose for events, except for stopping the code. If you want to return the value, you need to use a triggerClientEvent. And add another handler on clientside. Or use this tool: https://gitlab.com/IIYAMA12/mta-communication-enchantment Which does all the magic for you.
  12. For the items you can use the previous code. And this for attaching the data to elements: Instead of the enchanted table you can also use a regular table. But afaik it is a good match with your set-up. Note: this code works clientside as well as serverside. So keep in mind that you could write the system in a shared file. local elementDataCollection = {} function registerElement (element) local newTable = enchantedTable:create() elementDataCollection[element] = newTable end function getItemsFromElement (element) local thisTable = elementDataCollection[element] if thisTable then return thisTable:get() end return false end
  13. Tickcount is system based. This value is not compare able between the server and client. Especially when it is running on a different device. Using a combination of trigger event and elementdata will not really matter.
  14. @Overkillz 1. Yes the performance will be affected depending on the hardware. The bigger the render target the more V-RAM it will be using. And ofcourse more pixels will be drawn. 2. If you want to focus on performance, then try to draw as less as possible times on the render target. Repeating operation is not necessary, unless the content is changing. Your 2 methods will work just fine. Just the method[1]: reducing the render target size might have better performance.
  15. See also the reply before this one. @Knuck You can also try to run the older version. Which I have personally validated.
  16. This is also an issue, you are using the wrong syntax when removing the event: removeRenderEvent(renderInventory, "onClientRender") @Knuck
  17. And when does that occur?
  18. Add some debug lines, so that you can inform me what doesn't work.
  19. This is something you can do yourself, it isn't really that hard...
  20. I just gave you an example?
  21. @Knuck See this tool: It makes it easier to pass arguments. function viewInventory (argument1, argument2) end addRenderEvent(viewInventory, "onClientRender", argument1, argument2) removeRenderEvent(viewInventory, "onClientRender")
  22. @GodKraken Your database must have failed to load. That uncludes more warnings that you have forgot to mention. Make sure to unzip the resource before using it.
  23. There is a huge difference, MTA can create 10000+ of objects and the streamer can only load a part of it. Very hardware limited. The first example I gave you does not fix your issue directly, but it does answer your topic question. (except for the texture layer on the objects)
  24. @Overkillz Objects will only be loaded when they are streamed in. This also means that they can be unloaded and reloaded. for i=550,20000 do removeWorldModel(i,10000,0,0,0) end setOcclusionsEnabled(false) setWaterLevel(-5000) local container = createElement("container") local count = 0 local function elementCounter () count = count + 1 iprint("Streamed in: ", source, ", ", count, "/", #garageObjects) end addEventHandler("onClientElementStreamIn", container, elementCounter) for k,objects in ipairs(garageObjects) do -- garageObjects table is already defined and with values local a,b,c,d,e,f,g,h,i = unpack(objects) local object = createObject ( a,b,c,d,e,f,g ) setObjectScale(object,h or 1) setElementDoubleSided(object, i or false ) setElementDimension(object,arenaCDimension) setElementParent(object, container) -- !important end fadeCamera(true) Keep in mind that this doesn't mean that the texture has been loaded. It doesn't have to be painted to exist. I recommend to use lowLOD objects instead, those will show up faster. https://wiki.multitheftauto.com/wiki/SetLowLODElement See this useful function: https://wiki.multitheftauto.com/wiki/AssignLod function assignLOD(element) local lod = createObject(getElementModel(element),0, 0 ,0, 0, 0, 0, true) setElementDimension(lod,getElementDimension(element)) setElementPosition(lod, getElementPosition(element)) setElementRotation(lod, getElementRotation(element)) setElementCollisionsEnabled(lod,false) setLowLODElement(element,lod) return lod end
  25. Maybe: https://wiki.multitheftauto.com/wiki/GuiSetProperty http://static.cegui.org.uk/static/WindowsLookProperties.html
×
×
  • Create New...