Jump to content

IIYAMA

Moderators
  • Posts

    6,092
  • Joined

  • Last visited

  • Days Won

    216

IIYAMA last won the day on September 1 2025

IIYAMA had the most liked content!

About IIYAMA

Member Title

  • Global Moderator

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

73,411 profile views

IIYAMA's Achievements

Gangsta

Gangsta (45/54)

1.5k

Reputation

  1. Not sure what kind of backend you use. But here is an npm packets that could be used for inspiration. Probably some dependencies are deprecated. https://github.com/4O4/node-mtasa/tree/master The authOptions: https://github.com/4O4/node-mtasa/blob/aeac8ab9417a7b6a65f117491d1e648a6ad62422/src/client.ts#L107C17-L107C28 Using it in request: https://github.com/4O4/node-mtasa/blob/aeac8ab9417a7b6a65f117491d1e648a6ad62422/src/client.ts#L62 But under the hood (in JS) it is something like this: const credentials = `${username}:${password}`; const encodedCredentials = Buffer.from(credentials).toString('base64'); const result = "Authorization: Basic " + encodedCredentials The header is: Authorization The value is something like: Basic bWlqblVzZXI6Z2VoZWltV2FjaHR3b29yZA==
  2. It should be for security concerns. You wouldn't want to visit a site that is designed to look for 'new functions' and starts call them. If you take a look at this page: https://wiki.multitheftauto.com/wiki/Meta.xml You can see that it is possible to call an export function over http What syntax do you need for calling an export function? http://<your IP>:<your port>/<resource_name>/call/<exported_function_name> https://wiki.multitheftauto.com/wiki/Resource_Web_Access How does authentication works? https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side A 'basic' authentication should the way to go. It requires login credentials of an MTA user account with the correct permissions. This has to be passed every request. When you connect through the browser: http://127.0.0.1:22005/resourcebrowser/ You more or less understand what to expect. There is also a section about 'Router', which is new. Might be useful. https://wiki.multitheftauto.com/wiki/Resource_Web_Access#Router For inspiration https://community.multitheftauto.com/index.php?p=resources&s=details&id=18781 This resource is about fetching data from MTA to a (remote) host. This is the opposite of what you are trying to achieve, but probably still useful. Fetching from MTA to remote host Creating a MTA user (installation_s.lua) that only has the correct permissions.
  3. Just to verify, does this actually work? Because 'target' is afaik set by the player that fired the weapon and not by the player that got hit. And therefore there are a lot false positives, unless you let remote players decide the damage done to the localPlayer (which is not handy). addEventHandler("onPlayerWeaponFire", root, function(weapon, _, _, _, _, _, target)
  4. I am working with Cursor. Which is a fork of Visual Studio Code modified with AI in mind. It is my daily driver. The free version should give you enough monthly requests to finish your script. An no this is not a stupid AI, it is a optimised version for coding after all. You can even choose which AI you want to use, but some advanced may be behind a paywall.
  5. There is also a baked in option in the map editor (extension). Make sure your editor is up to date and your map contains the latest extension file. For manual upgrades: https://github.com/multitheftauto/mtasa-resources/blob/master/[editor]/editor_main/server/mapEditorScriptingExtension_s.lua https://github.com/multitheftauto/mtasa-resources/blob/master/[editor]/editor_main/client/mapEditorScriptingExtension_c.lua Example map meta.xml with useLODS option enabled:
  6. There is also this function : https://wiki.multitheftauto.com/wiki/EnginePreloadWorldArea
  7. IIYAMA

    Fuel system

    Might be because the (player/server) network can't catchup. -- (un)subscribe to the vehicle fuel element data of a specific vehicle addEventHandler("onVehicleEnter", getRootElement(), function(thePlayer, seat) if seat~=0 then return end -- Wiki Note: Before using addElementDataSubscriber you need to setup an initial value of element data in "subscribe" mode, otherwise the subscriber will not be added. if not getElementData(source, "plane:fuel") and getVehicleType(source) == "Plane" then setElementData(source, "plane:fuel", 0.18, "subscribe", "deny") end addElementDataSubscriber(source, "plane:fuel", thePlayer) end) addEventHandler("onVehicleExit", getRootElement(), function(thePlayer, seat) if seat~=0 then return end removeElementDataSubscriber(source, "plane:fuel", thePlayer) end) setTimer(function() -- Start with all players instead of all vehicles, because there are often more vehicles than players local players = getElementsByType("player") for i=1, #players do local player = players[i] local vehicle = getPedOccupiedVehicle(player) if vehicle and getVehicleType(vehicle) == "Plane" and getVehicleEngineState(vehicle) then local fuel = getElementData(vehicle, "plane:fuel") or 0.18 if fuel > 0 then -- do not update if fuel is 0 or lower, else you are wasting bandwidth by setting the data to the same value fuel = fuel - fuelUsePerSecond if fuel < 0 then fuel = 0 end setElementData(vehicle, "plane:fuel", fuel, "subscribe", "deny") end end end end, 1000, 0) Please let me know if the addElementDataSubscriber function works as expected, haven't used it myself yet.
  8. You might be able to detect it using: https://wiki.multitheftauto.com/wiki/WasEventCancelled Though I do not know if this functions works correctly for native events. Something you have to test yourself. Make sure to set the addEventHandler to low priority.
  9. You have to put it at the location where you want to make your trace. If you do not put it inside of another function, it will return "in main chunk", because it is tracing function calls starting from the main chunk. For example: function test1() test2() -- call test2 end function test2() test3() -- call test3 end function test3() test4() -- call test4 end function test4() -- ENDS HERE print(debug.traceback()) end test1() -- STARTS HERE Will return: stack traceback: Main.lua:14: in function 'test4' Main.lua:10: in function 'test3' Main.lua:6: in function 'test2' Main.lua:2: in function 'test1' Main.lua:17: in main chunk [C]: in ? It will show all functions that have been called. And for your current code, it might give you the function(s) where, your onClick got lost.
  10. Like this? function createButton(config) local self = setmetatable({}, Button) iprint(debug.traceback()) self.x = config.x self.y = config.y self.width = config.width self.height = config.height self.text = config.text or "Button" self.color = config.color or "blue" self.fade = config.fade ~= false self.onClick = config.onClick or false -- // This always returns false, even if I added onClick function. self.alpha = self.fade and 0 or 255 self.fade_step = 15 self.visible = true self.currentColor = Theme.colors.button[self.color].background table.insert(activeButtons, self) return self end
  11. Hmm. Can you show a trackback from your button constructor? iprint(debug.traceback()) Just to get an idea trough how many other functions it's constructed. Not sure what the results are, but it might give you some other places to look at and find where your value gets lost. Make sure to only construct one thing at the time, else it generates too much.
  12. One of the common problems is that function values are not clone able. Functions rely on their context and can therefore not being copied to another context. But not sure if that is the issue. For the Button class I am missing some context. In the first file it is used as a metatable. And in the second file it is used as a function. (which might also be a metatable, but I am unable to verify it because it is missing) Is this export importing Button.lua? Other: Watch out for setTimer parameters cloning Export cloning TriggerEvent cloning Original metatable data is modified by another button creation Might need to use raw(get/set) (context based): https://www.lua.org/manual/5.1/manual.html#pdf-rawset https://www.lua.org/manual/5.1/manual.html#pdf-rawget
  13. It is on the top of the code, just running once at the beginning. Could you explain why you put it there? Just so that I can understand the context of that variable placement, because normally you wouldn't put it there unless there is a specific reason.
  14. It is indeed a kind of attack. It means that the player is able execute clientside-code on demand. The attacker is triggering 'known generic events' which might be handled by the server. The ones that are unknown are in your logs, the ones that are known and trigger able are not. But that does not mean that the ones that did trigger didn't cause unwanted results. You might want to consider to restart the resources, just to make sure there is no memory leak. The event which AngelAlpha mentioned can indeed help with detecting that kind of attacks. As an extend you can also add a honeypot, which in this case are 'unkown' events for your server but know for other servers. When a player uses this kind of attack again, you can ban them automatic. You might want take a closer look at your logs for candidates (for example money related). There is also this event: https://wiki.multitheftauto.com/wiki/OnPlayerTriggerEventThreshold But be careful with automating things, always test these kind of stuff or you might accidentally nuke your own player base.
  15. You can either download the newest here: https://github.com/multitheftauto/mtasa-resources Or go back to a specific commit: https://github.com/multitheftauto/mtasa-resources/commits/master Download button can be found under 'Code':
×
×
  • Create New...