-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
Where are the blips located when the rendertarget is not being used? (screenshot ?) And what are the properties of the rendertarget?
-
Your reply is just a status update, nothing more, nothing less... Do Work iterative Creating > Problem? > show code/results and ask for feedback > apply changes > TEST > Does it not work? > show NEW code/results and ask for feedback > apply changes > TEST > Does it not work? > show NEW code/results and ask for feedback > etc.
-
There are no serious changes required for the table. But it might be handy to create an array structure first and then convert it to an object structure. This is the basic: The table local theTable = { ["First Aid Kit"] = {slots = 24, category = "Medicine"}, ["First Aid Kit2"] = {slots = 46, category = "Medicine"}, ["First Aid Kit3"] = {slots = 8, category = "Medicine"}, } Convert to an array structure: local collection = {} for key, data in pairs (theTable) do collection[#collection + 1] = {key = key, data = data} end Sort the damn thing: function sortFunction (a, b) return a.slots < b.slots end table.sort(collection, function (a, b) return sortFunction(a.data, b.data) end) For each: function forEach (key, data) print(key, data) end for i=1, #collection do local item = collection[i] forEach(item.key, item.data) end Which can enchanted with Lua OOP. (not MTA OOP) But as far as I know you do not work with it, never the less:
-
Set the rendertarget recording BEFORE the loop. Your current code only records 1 blip, clears+sets the rendertarget, records 1 blip, clears+sets the rendertarget, etc. Also unset the rendertarget AFTER the loop. Which I can't see in your current code because it is cut off.
-
Use newElement, that is a variable. not elementName which is just a "string". Or in this case an empty variable.
-
@slapz0r You can use also: root -- attach to the mother element of all elements resourceRoot -- attached to the resource which it is currently executed in local newElement = createElement("elementName") -- attach to a new element of your choice
-
With modules. https://wiki.multitheftauto.com/wiki/Modules If you know the program language C++, then you are good to go. Otherwise stay with the export functions.
-
"Line 1\nLine 2" With \n There are also settings within the function itself, to cut down text automatic. https://wiki.multitheftauto.com/wiki/DxDrawText But does not work in combinatie with colour codes enabled:
-
TRUE, but you didn't even bother asking that question, which is very unusual disinterested behaviour. All you asked was: "Do your thing and send the end result to me". You know the criteria my support, which I did pm you yesterday. Try to fit that criteria or ask somebody else who does the whole A to Z thingy without asking the important questions. I am here for scripting learning support, nothing else. Respect that. If you want to start scripting, then at least start from the beginning, start with Lua! Not MTA scripting. Do your desk research. Google, Youtube, inspiration, documentation. Oh nice! Somebody already made a collection for you. There is so much out there for you to use! Ask questions. Ask more questions. Try out. Fail. Debug. Look up what the warnings/errors mean. Still not understanding what they mean? Ask questions. Iterate. Improve. Rewrite. Try out. Delete. Copy. Cut. Disable. Write documentation so that you will not forget what your learned! No time for that? There are no short-cuts, except when you have hacked majqq.
-
Yes, really bad, it hacks your pc and steals all your moneyZzz... and @majqq likes getting hacked, that is why he is using my code. P.s it is his hobby after all. No, no, the main question is: will you run software on your computer that does things you do not understand?
-
Only if you can explain what the code does. It is bad practice to use code you do not understand. For you, your server and your players. Example: What if my code contains something that would expose your password? Steals your resources? Or makes the performance even worse?
-
If the loop isn't invert, this will not work well: -- This will go wrong function theFunction () -- first function removeRenderEvent(theFunction) end addRenderEvent(theFunction) -- add multiple functions, else the context isn't valid for i=1, 9 do addRenderEvent(function () end) end functions: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Looping: from 1 t/m 10 | = index 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Deleting 1 during the loop: | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Going on: | > > > > > > > > 2, 3, 4, 5, 6, 7, 8, 9, 10, nothing error: | 2, 3, 4, 5, 6, 7, 8, 9, 10, nothing If the loop is inverted, the loop will not have problems when items are removed.
- 21 replies
-
- 1
-
- onclienthudrender
- onclientprerender
-
(and 1 more)
Tagged with:
-
Technically yes, as other wise the message order gets mixed up. The implementation of http2 could help, but I have no idea if that is implemented for the the trigger events. It is at least used for the steamer. So if you want to know how this works, I suggest asking a developer about it. I am making a lot of assumptions, but the one that build it might give you the exact details. Note clients their traffic shouldn't block each other, unless the server is out of bandwidth.
-
If you want to load a map from a MySQL database, you will still have to create a XML node. So double work + extra management and no basic support for extra files as in mods, audio, scripts etc. So mapmanager, unless you know what you are doing. The comparison of your statement is: resources(maps) vs database Not mapmanager, that is only the manager, which you have to rebuild for databases.
-
I noticed after applying Kenix his update that 1 of the loops wasn't inverted. Which is important for removing addRenderEvent's within the same process. -- for i = 1, len( targetFunctions ) do -- old for i = len( targetFunctions ), 1, -1 do Just like with domino, when you take a domino out of the line, it will not work well...
- 21 replies
-
- onclienthudrender
- onclientprerender
-
(and 1 more)
Tagged with:
-
Yes In case of database functions connected to it, it is very recommended. Filereading and writing (even with a database) is a very slow operation. If a player spams commands that are requesting database info, the HDD/SSD will be busy doing their slow operations. In case of an SSD the issue is partly solved. But even so it is a SSD, the response time is not really comparable with the speed of ram. ---- Putting limits on non db operations as well? Yes, The event system will have a hard time. The network packet system will have a bit harder time, but there is a messages buffer limit on clientside. Everything goes over TCP, so only one (trigger) message can be send per request. ----- With no block, does it bother other player directly? (Without the server having a hard time) Possible, If for example the function setElementPosition is used serverside, all players in the server will receive data from it.
-
At places with this kind of loops: for element,ped in pairs(attached_ped) do If you want to optimise this, it will take at least an hour to implement the new table structure. Ask yourself the question: "Do you want to spend your time on that?" Also the code from your previous reply could be merged with:
-
if the javascript injection function is blocked because it is a remote browser, then there is not much we can do about. But you can try to use a second website with iframe which where you load the youtube page in. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
-
that line of defence is not going to cut the butter.
-
server by default. A critical one: Loop over an array table structure. Not an object table structure. But that doesn't mean you can't use both. local boneAttachments_array = {} local boneAttachments_object = {} local newAttachment = { posX, posY, ped -- etc. } boneAttachments_array[#boneAttachments_array + 1] = newAttachment boneAttachments_object[ped] = newAttachment Access the (same) data: for i=1, #boneAttachments_array do local boneAttachment = boneAttachments_array[i] end local boneAttachment = boneAttachments_object[ped]
-
For the vehicle the same steps. But in case of doing it clientside. https://wiki.multitheftauto.com/wiki/IsElementSyncer It is important that you as player only edit the vehicles that are synchronized by yourself. In case of doing it serverside, you need to send the explosion to serverside. And do the steps there. Note: explosions without owner should be ignored or not cancelled.
-
@majqq Getting the ped height from the centre: https://wiki.multitheftauto.com/wiki/GetElementBoundingBox An alternative: getElementPosition - https://wiki.multitheftauto.com/wiki/GetPedBonePosition