Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. 1. Yea, this will also prioritise the request over the network. 2. The entity you will be using to update the main data is a table. MTA objects/elements are secondary. Ofcourse this doesn't mean you can't use an object to fake the updates before they are actually applied. (Data reduction) 3. A boolean or a custom function in between. The default MTA functions do not have such a feature without creating errors.
  2. If something doesn't exist anymore, then there is nothing to leave from. In fact it will only cause more problems for the onClientMouseLeave event. An event can't just trigger without it's source.
  3. No your can't use that function as it blocked. This is more or less how a require_once module works. So you can also make your own. (NOTE: it is not exactly the same as require, just the logic of it) Untested, if it works or not is irrelevant for now. modules = {["module1"] = {loaded = false}} function requireThis (name) local thisModule = modules[name] if thisModule then if thisModule.loaded then return thisModule.container else local fileName = name .. ".lua" if fileExists ( fileName ) then local theFile = fileOpen(fileName, true) if theFile then local count = fileGetSize(theFile) local data = fileRead(theFile, count) thisModule.container = loadstring(data)() thisModule.loaded = true end fileClose(theFile) return true end end end return false end requireThis("module1") File: module1.lua local thisModule = { collection = {} } function thisModule:add (...) local data = {...} if data[1] then local collection = self.collection collection[#collection + 1] = data return true end return false end return thisModule
  4. Server should be in control at all times. So yes caches on serverside to reduce impact on the database. But keep in mind that if a query fails, it is important that the data is reset. In case of more users are editing the same data. > No caches recommended on clientside. (until the instructions from clientside are perfect) While there are changes made, it is recommended that the client his GUI is disabled until the server is finished. Else the data might not be mirrored correctly, that being said it is not impossible. You can use caches clientside, but it is important that the identifiers remain unique at all cost. The server is in control of the identifiers. Else there is a VERY HIGH risk of data corruption. Clientside should only send retrace able instructions of the modifications and not the modified data. Else there is a risk of VERSION corruption. Instructions also allows you to mirror without freezing the GUI. Each instruction should be validated on both serverside as well as clientside. In case of a failed data-update/query clientside should be restored to it's previous data-structure. It is VERY important to block new instructions and freeze the GUI until both sides are mirrored again. It is not that easy after all And use or build a tool like this: https://gitlab.com/IIYAMA12/mta-communication-enchantment/tree/master/
  5. IIYAMA

    getOffsetFromXYZ

    nvm that is probably not going to work.
  6. IIYAMA

    getOffsetFromXYZ

    local posX, posY, posZ = getElementPosition(hitElement) local offsetX, offsetY, offsetZ = getOffsetFromXYZ(getElementMatrix(hitElement), posX - hitX, posY - hitY, posZ - hitZ) The matrix is already containing the position of the vehicle. Untested and not even sure if this is the right approach. @Xwad P.s this function can return the surface position:https://wiki.multitheftauto.com/wiki/ProcessLineOfSight normalX, normalY, normalZ
  7. function functionName (player, cmd, ...) local name = table.concat({...}, " ") end @Razor70538
  8. @Overkillz dxSetRenderTarget( myRenderTarget, true ) Syntax: bool dxSetRenderTarget ( [ element renderTarget, bool clear = false ] ) The stuff you have drawn before on the paper, will not just clear itself. A render target is like a piece of paper of the REAL WORLD. Once you have drawn on it, you need an eraser to clean it. There are two things you can do. Clear the render target Or paint it black again with a rectangle. If it is just text on it, clearing the render target will do the job. But if you have multiple components on it, which you do not want to re-draw very frame on the render-target, then it might be handy to paint selected area's black. See also blend mode: overwrite : The source textures are overwritten. This can be useful for clearing render targets https://wiki.multitheftauto.com/wiki/DxSetBlendMode (Haven't used it before.) Also keep in minder that you can also use two render targets. One you can update when the text changes and one to move the frame.
  9. Or you can use this function: https://wiki.multitheftauto.com/wiki/IsElementVisibleTo Within the donegobeach function. It is a little bit dirty, but it should do it's job.
  10. Ah yea true, my bad. But afaik that doesn't work for new joined players. Experimental. local normaliseVisibility = createElement("normaliseVisibility") addEventHandler("onPlayerJoin", root, function () setElementVisibleTo(normaliseVisibility, source, false) end) markergobeach = createMarker ( 2945.4387207031, -2053.7338867188, 2.8984375, "cylinder", 2, 255, 0, 0, 50, thePlayer ) BlipDiver = createBlipAttachedTo ( markergobeach , 41, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) setElementParent(markergobeach, normaliseVisibility) setElementParent(BlipDiver, normaliseVisibility)
  11. I am the one that requested this function. They moved it to 1.6 after my request. It was finished and added to 1.6 within a few days. @IIYAMA still wondering why, when it could have been easily added to 1.5.6.
  12. @GodKraken Because there is nothing in the code that sets the marker and blip only available for a specific person. With the function setElementVisibleTo you can make specific elements visible/invisible for some players. https://wiki.multitheftauto.com/wiki/SetElementVisibleTo Or you can create the marker and blip clientside. (Marker created on the CLIENT/PLAYER computer) But you will need to learn to communicate between serverside and clientside. Learn the MTA way: Or a tool you can use to make this easier: https://gitlab.com/IIYAMA12/mta-communication-enchantment Examples Syntax Set-up
  13. Good. No visible issues here except for some missing resource information, which are not required to run code. Now please debug your code Use this tutorial:
  14. How can you start this without a meta.xml?
  15. Yea you can't, OBVIOUS!!!!!, because that is goal of your first iteration of YOUR code. \/
  16. @ArcAngeL Changed root to localPlayer. addEventHandler ( "onClientPlayerDamage", localPlayer, function( attacker, weapon, bodypart ) And attacker exist + attacker isn't the same as the localPlayer. if attacker and attacker ~= localPlayer and getElementType(attacker) == "player" then
  17. IIYAMA

    Mta-Hack

    Probably a resource with commands that is attached to a database. A way to counter this, be picky: And download only resources that look a bit more professional. But where is the fun in that? ? Highly secret + being honest here: @IIYAMA ? That is something similar to what those guys did to your server. But your server was the victim, instead of the ?.
  18. IIYAMA

    Who am I?

    @ShayF Asking that question to strangers, hmmm Ah I know it! You are somebody who wants to be defined by imaginary information. ?
  19. It returns nil/false when: Maybe the vehicle doesn't have that component? (for sure) There is no vehicle. (for sure) Or it might not be counted if it has fallen off. (maybe) Or if the vehicle isn't streamed in. (maybe) etc. So take always in account that something can go wrong. Always validate the output. In most cases this is enough: (especially when it is a MTA function) if rh then end
  20. @Xwad Yup local rh print(rh * 10) input:4: attempt to perform arithmetic on a nil value (local 'rh') https://en.wikipedia.org/wiki/Arithmetic
  21. @GodKraken If it happens on initializing the resources, then probably because of a `on(Client)ResourceStart` event which is attached to a root element. (This is not a mistake, but that might be depending on the context and purpose)
  22. @Xwad You used or copied+past a special/invisible characters on line 3. Fixed: local _, _, rh = getVehicleComponentRotation(v, "misc_a") Which is somehow located in here: local _,_,rh = getVehicleComponentRotation(v, "misc_a")     And if we debug that: local theString = "     " print(string.byte(theString,1,#theString)) 32 239 187 191 239 187 191 32 239 187 191 239 187 191 32 239 187 191 32 32 32 32 32 32 32 32 32 32 32 32 32 239 187 191 239 187 191 32 32 32 32 Holy ?? ?? ?? ?? ?? ?? !
  23. If you do not want that, make your own endpoint, and feed it with: https://wiki.multitheftauto.com/wiki/FetchRemote
×
×
  • Create New...