Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. 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.
  2. 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?
  3. 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?
  4. 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.
  5. 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.
  6. 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.
  7. 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...
  8. 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.
  9. 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:
  10. 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
  11. that line of defence is not going to cut the butter.
  12. 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]
  13. 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.
  14. @majqq Getting the ped height from the centre: https://wiki.multitheftauto.com/wiki/GetElementBoundingBox An alternative: getElementPosition - https://wiki.multitheftauto.com/wiki/GetPedBonePosition
  15. Be more specific. What is the result? Also debug the newly added style DOM element: https://wiki.multitheftauto.com/wiki/ToggleBrowserDevTools
  16. executeBrowserJavascript ( webBrowser, [[document.getElementsByTagName('html')[0].innerHTML += "<style>html {position:absolute; width: ]] .. (x * ancho) .. [[px; height:]] .. (y * alto) .. [[px; left: 50%; top: 50%; transform: translate(-50%, -50%); }</style>" ]] ) *
  17. local webBrowser = createBrowser(sx, sy, false, true) -- + enable transparent executeBrowserJavascript ( webBrowser, [[document.getElementsByTagName('html').innerHTML += "<style>html {position:absolute; width: ]] .. x*ancho .. [[px; height:]] ..y*alto .. [[px; left: 50%; top: 50%; transform: translate(-50%, -50%); }</style>" ]] ) You might can solve it this way. Untested. @aka Blue
  18. You could load a small xml file on to the client his computer. (The whole time) When the player reconnects, subtract the ammo that hasn't been synced. (Sync once in a while with the server) Ofcourse add a security layer. Which will prevent players to edit those values. If the file has a mismatch with the account data of the player. Make sure to punish him by deleting all the ammo. Why xml and not a default file? Because you can edit parts of it. And not have to recreating the whole file when there are changes. (And yes for the XML haters, you can also use JSON in XML... cry!)
  19. So what did you do? Else use just a dirty timer or create it clientside.
  20. It might be possible that either by default or by another script the control is enabled. I recommend to use event "onPlayerSpawn" + Put the addEventHandler priority to low. (which is for the onPlayerSpawn event) This will make sure that the control settings are not being overwritten by anything else at serverside.
  21. @jakson did you use this function after the event "onPlayerSpawn"?
  22. https://wiki.multitheftauto.com/wiki/FocusBrowser @aka Blue
  23. What is your ultimate goal? Being able to use m4 and ak47 within the same inventory? In that case you could give just 999999 ammo per weapon. When the table runs out of ammo clientside. Block the shooting button of that weapon. And send a signal to serverside that the weapon is empty. Don't be me, with complex :~ that eats too much network.
  24. RPG counts as weapon that fires bullets. It triggers the event atleast at clientside. Not sure if it also triggers serverside. If not, then trigger the event manually. (It is not as if you can fire a RPG rapidly.) About triggering client to server every time a player shoots. This was a part of something I build a long time ago. It was a script that would sending bullet lines over to serverside. And detect if it hit players. More or less how modern games do their damage model. That is for the onces that actually do the detection serverside. But the issue with that was that it strongly relied on fast internet. If this criteria was not met, I was forced to freeze those players(high packet loss) and that made it even more unplayable for those. (onPlayerWeaponFire was not available yet) If those players where not frozen, they would teleport around everytime they shot a few bullets. TriggerServerEvent's are using TCP. Which is not streaming. Only 1 message can be send and received at the sametime. + causing the network to be blocked all the time. Sending Message from client to server Server receives Server sends a message back.(message: yes it has been delivered) Client sends next message to the server. Well that was my issue/story. My advice: Fake the hud information. Do only sync when it is absolutely necessary.
  25. I am not 100% sure why sending the root to the other side will create more CPU usage. It is not logic when you look at the element tree Element_tree. Most addEventHandlers have by default propagation enabled. Which means that all element (children) in the server will be able to trigger those addEventHandlers, if the eventname is the same and the handler element is root. The situation with using a child should be able to trigger more events than when the root element is used. What is the difference between sending root and resourceRoot from a performance perspective? Can't answer that. Not even sure if it has any relations with the addEventHandler.?
×
×
  • Create New...