-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
That part is only used for the initialization (loading the lowLOD objects). When that is over, there will be hardly any Lua activity what so ever except for the break-able objects. I highly recommend to check how the code actually works. ? And a nice fact, there is only 1 timer active at the same time in the whole resource. That is the whole purpose of the second Lua file timer_c.Lua = Timer lag reduction.
- 27 replies
-
- repository
- draw
-
(and 8 more)
Tagged with:
-
I am not sure, I don't have anybody that I can test it with. For hardware that can run basic GTA properly, it should be fine. If anybody that has an old computer, I would be very happy if that person could make a benchmark.
- 27 replies
-
- repository
- draw
-
(and 8 more)
Tagged with:
-
You can't, since it is not an element. If you really want this, then you have to make and manage fires yourself. https://wiki.multitheftauto.com/wiki/CreateElement https://wiki.multitheftauto.com/wiki/SetTimer https://wiki.multitheftauto.com/wiki/GetElementsByType https://wiki.multitheftauto.com/wiki/CreateFire https://wiki.multitheftauto.com/wiki/ExtinguishFire
- 1 reply
-
- 1
-
Hi there, what are you looking at?
Ah this,
I have uploaded V1.0.2 of the draw distance resource. This resource helps with displaying objects that are normally streamed out. Your maps (even if you are not a mapper) will become a lot more beautiful!
Enjoy the resource as well as your well deserved WEEKEND!!!!
-
Draw distance v1.0.2 This resource improves the draw distance of all your resources that make use of map files. It makes your maps 10x more beautiful in my opinion! Greatly improves the draw distance of map objects Maxed out the draw-distance for peds and vehicles. (See MTA settings > video: Render vehicles always in high detail + Render peds always in high detail ) Multi-resources support (this effect is applied on every mapRoot element) Parallel loading method is used, but the loading speed is in that case reduced to improve performance. The effect is not only applied on resources that are starting, but also resources that are already running. Download here This resource is uncompiled! Repository: https://gitlab.com/IIYAMA12/draw-distance Video - Created by @Anx1ty Comparison Starting at 200 units distance 400 units distance (this is the distance where a lot of objects will be unloaded, but in this case switched with lowLOD objects) And even on 600 units distance, it is technically visible -> (while the fog is slowly eating it up... ) Download here Can all hardware run this? --> I have no idea... most likely ?. Just give it a try.
- 27 replies
-
- 16
-
- repository
- draw
-
(and 8 more)
Tagged with:
-
local adminLevelTitels = {"admin-1","admin-2","admin-3","admin-4","admin-5","admin-6"} {"AD",-0.05, "right", function (p) return adminLevelTitels[getElementData(p,"admin_level")] or "I am level 0! HA!" end},
-
I have no idea if engineSetAsynchronousLoading works as Addlibs replied. << I truly hope this solves your issue to be honest But the loading process of that function probably doesn't include the reading of the mod files. In case of loading things in general, I recommend to align the process operation with the user his FPS. Because when you are loading a mod, you are blocking everything, so you can't go to the next frame until it is finished. > That is why loading 2 or more mods on a single frame can cause frame drops. > Large mods will cause frame drops, that is inevitable. If you load a mod every 1, 2 or 3 frames, you will balance performance with processing speed. This example is for loading a mod every frame. Speedy , but with performance impact. So more frames between each execution is better for performance. local table = {{}, {}, {}} function test () local item = table[1] if item then table.remove(table, 1) else removeEventHandler("onClientRender", root, test) end end addEventHandler("onClientRender", root, test)
-
@SoManyTears Because the local declaration ensures that the value is deleted at the end of the function. if cities[city] then if not isElement(sound) then sound = playSound("ambiance.mp3",true) end elseif isElement(sound) then stopSound (sound) sound = nil end setTimer(change_weather, 1000, 0) -- 1 too 0
-
If you enable shared, this is what will happen: <script src="file.Lua" type="shared"/> becomes <script src="file.Lua" type="client"/> <script src="file.Lua" type="server"/> The file is now used for serverside as well as clientside. But they are still loaded on 2 different applications. And as you know, you can't share your memory across the internet without taking the connection delay `ping` in consideration. The concept behind `shared` is a feature to make (utility) functionalities that work on both sides (client/server). Main purpose: Less maintenance The following content could be useful for in a shared file: https://wiki.multitheftauto.com/wiki/FindRotation https://wiki.multitheftauto.com/wiki/Table.random https://wiki.multitheftauto.com/wiki/Table.compare etc.
-
You can tighten the timing a little bit by align it manual. https://wiki.multitheftauto.com/wiki/OnClientPreRender https://wiki.multitheftauto.com/wiki/OnClientRender See example on the following page: https://wiki.multitheftauto.com/wiki/GetTickCount
-
Because the moment of execution is aligned with your fps. (Or internal clock) I assume this decision is made in order to reduce constantly activity of the CPU and not blocking processes of other applications.
-
Because you are creating for each event a new gridlist. The following code will create a gridlist if it does not exist if not pedGridList then pedGridList = guiCreateGridList(0, 0, 50, 50, false) end
-
1 second is a lot of frames. Too many to be honest, it loses it's purpose if you do that. The whole purpose is to slowly push those peds aside, instead of blocking. NOTE: This is still a concept, there are no guarantees that it will work. You can use my callNextFrame function if you want. source --[[ -- callNextFrame function ]] local tableRemove = table.remove local serverSide = triggerClientEvent and true or false do local nextFrameCalls = {} local serverSideTimer local processing = false local function process () --[[ Do an empty check at the beginning of the function, this will make sure to make an extra run in case of heavy work load. If the timer is killed or the addEventHandler is removed, then this has to be re-attached again every frame. This is not very healthy... ]] if #nextFrameCalls == 0 then if serverSide then if serverSideTimer then if isTimer(serverSideTimer) then killTimer(serverSideTimer) end serverSideTimer = nil end else removeEventHandler("onClientRender", root, process) end processing = false return end -- In case of calling the function callNextFrame within the process, the loop type `repeat until` is required. repeat local item = nextFrameCalls[1] item.callback(unpack(item.content)) tableRemove(nextFrameCalls, 1) until #nextFrameCalls == 0 end function callNextFrame (callback, ...) if type(callback) == "function" then local newIndex = #nextFrameCalls + 1 nextFrameCalls[newIndex] = {callback = callback, content = {...}} if not processing then if serverSide then serverSideTimer = setTimer(process, 50, 0) else addEventHandler("onClientRender", root, process) end processing = true end return true end return false end end
-
You could disable the collision between the car and ped for 1 or 2 frames after you ram it. https://wiki.multitheftauto.com/wiki/OnClientVehicleCollision https://wiki.multitheftauto.com/wiki/SetElementCollidableWith This way it could be more easy to ran them over.
-
I am not sure if you can run this with dbQuery, but never the less give it a try. SHOW FULL TABLES
-
The very basic. local example = {} function saveExample (object, player) example[object] = player return true end function loadExample (object) return example[object] end
-
If synchronization is enabled, the server as well as all players have that performance penalty. If disabled, it is just the server (and exclusive network packets management). It is not bad practice, but if you could use Lua instead, it would be even better since it is a lot faster (and doesn't trigger the event system)
-
You have more debugging to do with debuglines.
-
local findGroup = xmlLoadFile(":startup/dbconfig.xml", true) local findGroup = xmlFindChild(loadConfig, "config", 0)
-
How does your xml file looks like? local loadConfig = xmlLoadFile(":startup/dbconfig.xml", true) btw this will give you already the rootNode. (it doesn't matter what tagname you gave it) <rootNode> <child></child> </rootNode>
-
By nesting them, so that you know which table belongs to which gate. local gates = { { openPosition = {x = 1023.599609375, y = -367.7001953125, z = 74.099998474121}, closePosition = {cx = 1029.3000488281, cy = -367.7001953125, cz = 74.099998474121}, colshapes = { {colX = 1021,colY = -371.5,colWidth = 5,colHeight = 8}, -- {colX = 1021,colY = -371.5,colWidth = 5,colHeight = 8} 2 colshapes? }, state = "closed", gateElement = nil }, --[[{ another gate }]] } --[[ While creating the elements, make the link between element and table. When you have access to the element, you have direct access to the data that belongs to the gate. ]] local dataByColshapes = {} local gateElement = createObject(...) local colshapeElement = createColRectangle(...) local gate = gates[i] gate.gateElement = gateElement -- save the gate element also inside of this table -- Make the link dataByColshapes[colshapeElement] = gate -- hit colshape?: local gate = dataByColshapes[source] if gate then local gateElement = gate.gateElement -- move gate! gate.openPosition, gate.closePosition end
-
Then you will need xml functions. If you added the file as a config file in the meta.xml, then you can get the file like this: https://wiki.multitheftauto.com/wiki/GetResourceConfig Else you will need this function https://wiki.multitheftauto.com/wiki/XmlLoadFile All of them -> https://wiki.multitheftauto.com/wiki/Xmlnode
-
I don't think it can be a simple example, but here you go. local bone_attach = {} local bone_attach_render = {} local queue = {} local queueProcessStatus = false local queueNextCycleTime = 0 local tableRemove = table.remove function prepareQueue () queueProcessStatus = true for i=1, #bone_attach do local item = bone_attach[i] if not item.rendered then queue[#queue + 1] = item end end end function processQueue () for i=#queue, math.max(#queue - 50, 1), -1 do local item = queue[i] local element = item.element if isElement(element) and isElementStreamedIn(element) then item.rendered = true bone_attach_render[#bone_attach_render + 1] = item end tableRemove(queue, i) end if #queue == 0 then queueProcessStatus = false end end addEventHandler("onClientRender", root, function () for i=#bone_attach_render, 1, -1 do local item = bone_attach_render[i] local element = item.element if isElement(element) and isElementStreamedIn(element) then else item.rendered = false tableRemove(bone_attach_render, i) end end -- cycle management local timeNow = getTickCount() if not queueProcessStatus then if timeNow > queueNextCycleTime then prepareQueue() queueNextCycleTime = timeNow + 3000 end else processQueue () end end)