IIYAMA

Members
  • Content Count

    4,463
  • Joined

  • Last visited

  • Days Won

    34

IIYAMA last won the day on February 2

IIYAMA had the most liked content!

Community Reputation

536 MTA Ambassador

About IIYAMA

  • Rank
    Hawg
  • Birthday 01/01/2016

Details

  • Gang
    [HB]
  • Location
    Netherlands
  • Occupation
    I have never been to the streets of SA... so who knows?
  • Interests
    Design, scripting, UX/UI

Recent Profile Visitors

6,244 profile views
  1. IIYAMA

    Using server-side table on client-side.

    Clientside local thisTable = {} addEvent("update-------") addEventHandler("update-------", resourceRoot, function (index, data) thisTable[index] = data end, false) Serverside local thisTable = {} function updateTable (target, index, data) thisTable[index] = data triggerLatentClientEvent(target, "update-------", resourceRoot, index, data) end updateTable(target, "index", {"data"}) -- all players updateTable(getElementsByType("player"), "index", {"data"}) -- all players updateTable(getRandomPlayer(), "index", {"data"}) -- just a single player updateTable({getRandomPlayer()}, "index", {"data"}) -- just a single player Keep in mind that when testing this code, it is important to mind "when/timing?" + "triggerClientEvent/communication". As in this example the client hasn't loaded it's scripts yet. Adjust it to your needs. @majqq
  2. IIYAMA

    Using server-side table on client-side.

    Yes, I can't explain it better than this: Client (see my example) Trigger: When vehicle damage Condition: You must be the syncer of the vehicle. Actions: - Save updates for the table. (Not a new version of the main table) - Start the buffer timer. 200ms?(if not running already) In case of firedamage or a minigun you will be preventing a trigger event that is send every frame. --------------- Trigger: When the buffer timer is finished. Action: Send the table updates to the server. _______________ _______________ _______________ Server Trigger: When there is an update from the client. Condition: If a player is closer to the vehicle than 300+ units, do action 1 for him. Else do action 2 for him. Action 1: Send a (latent) trigger event to the selected person. Action 2: Save this message in a table. Start a personal buffer timer for him. This table could contain similar types of updates from different vehicles. The data should contain is a reference to the player and to the vehicle. Which you can use to pick the right and latest update for the player. (Also here start the buffer timer only when it is not running for the selected person) -------------- Trigger: When the personal buffer timer is finished.(action 2) Action: Send the table new table to the client.
  3. IIYAMA

    Using server-side table on client-side.

    It will hurt the sender a bit. But only if he or she has terrible internet. And you can always increase the buffer/delay time. (Remember to test the latent version for your target group) When you are going to send information back it will also hurt the receiver without doubts. But you can use an even bigger delay for players that are far away. So only the players that are closeby should actually receive data immediately. On the other hand elementdata could save you some data for closeby players. The usage require less data, but the target players are not control able. So if there are 500 players in your server, then I do not recommended it. You should test both ways. It is a paradox I know... Why not set elementdata clientside? Because players will overwrite the data from each other. It is something the server should manage. Who is your target group by the way? @majqq
  4. IIYAMA

    Using server-side table on client-side.

    - With parameters I mean the arguments you want to use there. - There are no shared tables. I recommend to first try to use the clean way. Sync with triggerEvents, so that you do not destroy other players their network usage directly. (of course this can still happen) Buffer up to at least 200ms. Check if latent events are fast enough for your target group. If your players have bad internet, then it might be possible that the information never gets send... Latent events will only send information when the network isn't blocked. This means that position and orientation of players should be more accurate while sending information. Element data usage will increase when the player count increases, so test it before you use that type instead. Untested code local damageToSync = {} local syncVehicleDamageTimer local function syncVehicleDamage () syncVehicleDamageTimer = nil -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- triggerServerEvent("syncVehicleDamage", resourceRoot, damageToSync) -- -- or -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- triggerLatentServerEvent("syncVehicleDamage", resourceRoot, damageToSync) -- It will improve the gameplay. >>> BUT this will work ONLY fine if your target players have fast internet. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- damageToSync = {} -- reset table end addEventHandler("onClientVehicleDamage", root, function (attacker, weapon, loss) if isElementSyncer(source) and attacker and getElementType(attacker) == "player" and loss > 0 then -- register vehicle local vehicleDamageTable = damageToSync[source] if not vehicleDamageTable then vehicleDamageTable = {} damageToSync[source] = vehicleDamageTable end -- register attacker + loss of vehicle vehicleDamageTable[attacker] = (vehicleDamageTable[attacker] or 0) + loss -- start sync delay if not syncVehicleDamageTimer then syncVehicleDamageTimer = setTimer(syncVehicleDamage, 200, 1) end end end) The table structure. --[[ -- table structure -- local damageToSync = { [vehicle] = { [attacker] = loss, [attacker] = loss } [vehicle] = { [attacker] = loss, [attacker] = loss } } ]]
  5. IIYAMA

    Using server-side table on client-side.

    Oke, Is there more to it? Because this is not enough to pick the right method. For example: Response time? Delay in between? Network bandwidth limit? Parameters? Is it used for visuals only or has it also influence on gameplay directly? Which players do need to receive this information immediately? Which ones later? (Which ones not? > Players that join later or that are far away.)
  6. IIYAMA

    Using server-side table on client-side.

    @majqq The answer to that depends for 95% on what your endpoint needs. Enough context is essential for coding with responsibility.
  7. IIYAMA

    MTA SA default unit

    6000x6000 https://wiki.multitheftauto.com/wiki/GetPlayerMapBoundingBox
  8. IIYAMA

    [HELP] Map Toptimes on the web?

    You can easily update it every 3 seconds, nobody that notice much of a difference. Except for the ice bears. 🤣
  9. IIYAMA

    [HELP] Map Toptimes on the web?

    Nice! 📣 Btw your update speed is a bit too fast.
  10. IIYAMA

    Help

    https://wiki.multitheftauto.com/wiki/OnClientGUIClick So not the element you clicked on! It is string / text. You need:
  11. IIYAMA

    Help in Function DxDrawtext

    addEvent("startArmour", true) addEventHandler("startArmour", getRootElement(), function () addEventHandler("onClientRender", root, renderArmour) end) function renderArmour () dxDrawText("equipting armour", 342, 259, 907, 322, tocolor(28, 135, 226, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) end You need two separated functions for that. See also this source-code/tutorial if you want to pass arguments:
  12. IIYAMA

    output discord message on mta server

    You probably will need modules for the communication between your bot to discord. There must be a lot of security stuff in it, so you do not want without that. https://discord.js.org/#/ From your bot to MTA, a socket is not required. Nodejs has a build in module https, which you can use. https://www.twilio.com/blog/2017/08/http-requests-in-node-js.html And on the MTA side: There you can create your HTML file which you can use to receive requests. https://wiki.multitheftauto.com/wiki/Resource_Web_Access table form: This is a table containing all the form data submitted to the page using HTTP POST combined with any variables passed in the querystring with HTTP GET. The variable form should be available in your HTML file which can contain the message data from a post request. It can be complicated stuff if you haven't worked without sockets before. But that doesn't mean that you should give up.
  13. IIYAMA

    Which folder is the player's registry?

    server/mods/deathmatch/databases https://wiki.multitheftauto.com/wiki/Database
  14. IIYAMA

    Error loading image @dxDrawImage

    Cheers! 🍾
  15. IIYAMA

    Error loading image @dxDrawImage

    If the issue is 100% related to what @Mr.Loki said. Then the texture will simply fail to load. Which shouldn't cause any laggy errors. Thought it might be a good idea to blacklist failed loaded textures as well or use a delay before retrying to load the texture. The main question is now "will textures use more or less vram incompare to file paths?" I can honestly can't awnser that. Technically textures would need more ram, as it is always in use. But drawing from path requires most likely a lot more cleaning, as I am not sure if it buffers those kinds of textures. If you really want to know that, then you only have to watch the free vram.