-
Posts
6,089 -
Joined
-
Last visited
-
Days Won
216
Everything posted by IIYAMA
-
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.
-
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
-
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.
-
@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.
- 1 reply
-
- 1
-
-
See also the reply before this one. @Knuck You can also try to run the older version. Which I have personally validated.
-
This is also an issue, you are using the wrong syntax when removing the event: removeRenderEvent(renderInventory, "onClientRender") @Knuck
-
And when does that occur?
-
Add some debug lines, so that you can inform me what doesn't work.
-
This is something you can do yourself, it isn't really that hard...
-
I just gave you an example?
-
@Knuck See this tool: It makes it easier to pass arguments. function viewInventory (argument1, argument2) end addRenderEvent(viewInventory, "onClientRender", argument1, argument2) removeRenderEvent(viewInventory, "onClientRender")
-
@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.
-
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)
-
@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
-
Maybe: https://wiki.multitheftauto.com/wiki/GuiSetProperty http://static.cegui.org.uk/static/WindowsLookProperties.html
-
guiGridListAddRow(scoreBoardGridList, getTeamName(team), getPlayerName(v)) It is not very flexible, but you should consider each row an item with mutiple properties. If the two columns aren't related, then you need two gridlists. @majqq
-
1. Try to attach the checkboxes later than the scrollbar. 1. + 2. The scroll bar is on top of the checkboxes. And the checkboxes might be on top of the scrollbar. Which focusing on an element, the order might change. This is incorrect: (main issue) guiPanel[1] = guiCreateCheckBox(0.65, 0.1, 10, 10, "Show HUD", true, true, userPanel) guiPanel[2] = guiCreateCheckBox(0.65, 0.3, 100, 100, "Show GPS", true, true, userPanel) guiPanel[2] = guiCreateCheckBox(0.65, 0.5, 100, 100, "Show Debug", true, true, userPanel) guiPanel[3] = guiCreateCheckBox(0.65, 0.7, 100, 100, "Low blood effect", true, true, userPanel) guiPanel[4] = guiCreateScrollBar(0.02, 0.3, 0.60, 0.070, true, true, userPanel) guiPanel[5] = guiCreateScrollBar(0.02, 0.5, 0.60, 0.070, true, true, userPanel) guiPanel[6] = guiCreateScrollBar(0.02, 0.7, 0.60, 0.070, true, true, userPanel) guiPanelTexts[1] = guiCreateLabel(0.14, 0.23, 30, 30, "Weapon sounds", true, userPanel) guiPanelTexts[2] = guiCreateLabel(0.54, 0.23, 30, 30, "100%", true, userPanel) guiPanelTexts[3] = guiCreateLabel(0.14, 0.43, 30, 30, "Actions sounds", true, userPanel) guiPanelTexts[4] = guiCreateLabel(0.54, 0.43, 30, 30, "100%", true, userPanel) guiPanelTexts[5] = guiCreateLabel(0.14, 0.63, 30, 30, "Radio sounds", true, userPanel) guiPanelTexts[6] = guiCreateLabel(0.54, 0.63, 30, 30, "100%", true, userPanel) 30 = 3000% 100 = 10000% @majqq = 100000000%
-
Saving??????? This is about loading! Maybe you use it like this: local trabalhotr = playerTraficante[source] I have 0% knowledge about your system. You should know that better than me.
-
As @Overkillz said, you can wrap Lua(tables in tables) and in JSON (objects/arrays in objects/arrays). Or, you can use XML to manage the JSON/tables as I said before.
-
playerTraficante = {} Is a table, tables can't be called. playerTraficante ( ) Only functions can be called. The reason why it is table instead of a function is unknown to me. Please ask the one that created the script for the reason why. Or if it is created by yourself, then ask yourself the same question. Also it might be handy to inspect the table first. iprint(playerTraficante) It might give you information about how to use it.
-
yes, every time you are going to write.
-
@ryders Try to use this function. (read the wiki carefully) https://wiki.multitheftauto.com/wiki/SetOcclusionsEnabled It needs to be is a script.
-
Might be the reason for writing incomplete data. The file isn't flushed, so it might handy to do that as well: https://wiki.multitheftauto.com/wiki/FileFlush Oh and empty(recreate) the file each time you start writing data. @majqq The file is incorrect. There has been double written as you can see. (from a few moments before) se ] ] from: false, false ] ] Clean the file and try again.
