Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Posts posted by IIYAMA

  1. 2 hours ago, Ryan167 said:

    how could I make the marker only trigger on dimension 11?

    If the parameter matchingDimension contains the value true, the marker is hit in the same dimension.

    2 hours ago, Ryan167 said:

    What I'm trying to do is have a marker in dimension 11 and when the player joins the marker the player can't use a jetpack (it works but it stays working even outside the marker) and the weapons disabled, which works fine.

    Instead of setting a timer. Which currently is being created infinity > crashing the server at a given point.

    Do the following:

    When giving a jetpack, check if the player is inside of the marker. Based on that, give the Jetpack yes / no.

    -- Making the marker find able inside of another resource
    local antiJetpack = createElement ( "antiJetpackType", "antiJetpackID" )
    
    local marker = createMarker ( 0, 0, 0, "cylinder", 1.5, 255, 255, 0, 170 )
    
    setElementParent(marker, antiJetpack)

    (Other resource)

    local parent = getElementByID ("antiJetpackID")
    if not parent then return end  
    
    local marker = getElementChildren ( parent )[1]
    
    local status =  isElementWithinMarker ( thePlayer, marker )

    https://wiki.multitheftauto.com/wiki/IsElementWithinMarker

     

     

  2. 23 hours ago, RandomRambo said:

    and one more thing...where I can download mta 1.6n?Cus it says I need it to join the server on mta-1.6.0-unstable-7976-net41DA build on which it works...

    Can't you just copy your Program Files (x86)\MTA San Andreas 1.6\server to the server? (maybe I am missing something, but a windows server should be able to start up windows stuff)

  3. 3 hours ago, pixel77 said:

    data[1] and data[2] are numbers. 

    For example: inUseData[12][5] = true

    The client is clicking on a dxDraw button, that is rendered on the 3D World. 

    Then the code looks fine. Unless the numbers are a mixture of numbers and strings. 123 vs "123"

     

    16 hours ago, pixel77 said:

    So they can run the "--some more code here to do things" in the same time, and I don't want to allow this.

    In theory it shouldn't be possible because this function is ran single threaded. There will always be one that is first. The whole function chain-call should have been ended before a new call can be made.

    The following should be finished before the root function can be called again.

    16 hours ago, pixel77 said:
    --some more code here to do things

     

     

    • Thanks 1
  4. 3 hours ago, RandomRambo said:

    Config changed after I installed latest build so config isn't the real problem.

    It can be an issue if you used the config of an older build.

     

    3 hours ago, RandomRambo said:

    It works perfectly on 1.5.9 builds,but on 1.6 it just restarts all time and no errors in console -_-

    You checked the logs as well? (sometimes not all errors are visible in the console)

    And what kind of server are you running? Windows or linux?

    If it is Windows, you should be able to copy over your local server and try that one.

    If Linux, you might consider starting it up with sudo, so that it does not run in to any permission issues while creating/moving the initial files.

     

     

  5. On 17/02/2024 at 21:20, RandomRambo said:

    So,what is the problem that my server doesn't start on stable 1.6 build?:(

    Is this server installed with MTA or did you download the stable version separately?

    Things to check/do:

  6. 5 hours ago, pixel77 said:

    Any other methods?

    A hard function skip maybe, just to figure out if it is actually the models. 🤔

    addDebugHook( "preFunction", function ( ) return "skip" end, {"engineLoadCOL", "engineReplaceCOL", "engineLoadTXD", "engineImportTXD", "engineLoadDFF", "engineReplaceModel"})

    (if possible run the hook on a resource with higher download priority)

     

    If that is the issue, then rewrite the resources so that the models are loaded slower. For example load a model every X frame(s).

  7. 1 hour ago, aRRRtem said:

    So my question is how can I track other client`s software to block players with rippers?

    I believe you should first understand the underlying problem.

     

    1 hour ago, aRRRtem said:

    steal my game client files

    They are not stealing your files. You are sending those files to them. When they host your files, this is where they are using your files without permission.

     

    Quote

    where they use your files without permission

    This is where I recommend to solve your problem. They are using your files because they are appealing to be used. If you make them less appealing, for example by adding branding to them, this will become advertisement for your server (in their server).

  8. 5 hours ago, Turbe$Z said:

    what wrong with the loop?

     

    You have to index the variable veh one time less. Since the pairs loop did the first index already for you.

    Quote

    dxDrawText(veh[k][1].." | "..veh[k][2], sx/2-370,sy/2-297,sx/2,sy/2, tocolor(255, 255, 255, 220), 3, "default-bold", "left", "top", false, false, false, true )

    dxDrawText(veh[1].." | "..veh[2], sx/2-370,sy/2-297,sx/2,sy/2, tocolor(255, 255, 255, 220), 3, "default-bold", "left", "top", false, false, false, true )
    	
    • Thanks 1
  9. 6 hours ago, Snow-Man said:

    what confuses me that when i get table into another tables inside and when i try to get a return from what?

     

    Sometimes it really helps when you use the iprint function to print the current table. It shows you the current depth and helps you to decide how to index the next table.

     

    When I for example I am working with a secret table.

    iprint(result)

    >

    {
    	["test"] = {
    		{
    			{
    				[133]="found me!"
    			}
    		}
    	}
    }

     

    The first step is to peel it down.

     

    Layer 1

    iprint(result["test"])

    >

    {
    	{
    		{
    			[133]="found me!"
    		}
    	}
    }

     

    Layer 2

    iprint(result["test"][1])

    >

    {
    	{
    		[133]="found me!"
    	}
    }

     

    Layer 3

    iprint(result["test"][1][1])

    >

    {
    	[133]="found me!"
    }

     

    Layer 4

    iprint(result["test"][1][1][133])

    >

    "found me!"

     

     

     

  10. 21 hours ago, Snow-Man said:

    im lost through a lot of tables 

    It helps if you write every table modification inside of a new function. This way you keep your code more readable.

    The following examples are re-written code. You could use this as a start, but make sure to test it, because I didn't test it for you.

     

    local farm = createFarm(123, 1, 1, 1)

     

    local horse = createHorse(player, horseId)
    
    local farm = getFarmFromID (123)
    -- If the farm does exist
    if farm then
        addHorseToFarm(horse, farm)
    end

     

     

    local horseCollection = {} -- all horses
    local farmCollection = {} -- all farms
    
    ---@param player userdata
    ---@param horseId integer
    ---@return table
    function createHorse(player, horseId)
    
        local horse = { id = horseId }
        horseCollection[horseId] = horse
    
        return horse
    end
    
    ---@param farmId integer
    ---@param x number
    ---@param y number
    ---@param z number
    ---@return table
    function createFarm (farmId, x, y, z)
    
        local marker = createMarker(x, y, z)
    
        local farm =  {
            marker = marker, 
            id = farmId, 
            location = { x, y, z }, 
            owner = nil, 
            creator = nil, 
            creationTime = getTickCount(), 
            price = 0, 
            horses = {}
        }
    
        farmCollection[farmId] = farm
        return farm
    end
    
    ---@param farmId integer
    ---@return table|false
    function getFarmFromID (farmId)
        return farmCollection[farmId] or false
    end
    
    ---@param farm table
    ---@param player userdata
    ---@return table
    function setFarmCreator (farm, player)
        farm.creator = player
        return farm
    end
    
    ---@param horse table
    ---@param farm table
    function addHorseToFarm (horse, farm)
        table.insert(farm, horse)
    end
    
    ---@param horse table
    ---@param farm table
    ---@return boolean
    function isHorseInFarm(horse, farm)
        for i=1, #farm do
            if farm[i] == horse then return true end
        end
        return false
    end
    
    ---@param farmId integer
    ---@return boolean
    function doesFarmExist(farmId)
        return farmCollection[farmId] and true or false
    end

     

    • Like 2
  11. 45 minutes ago, JamesDragon said:

    Can i also send arguments to the function?

     

    Yes, as long as you do not break the code.

     

     

    <script>
    	function onRemotePlayerWasted (arg) {
    		/* ... */
    	}
    </script>

     

    addEventHandler("onClientPlayerWasted", root, 
    function ()
    	local arg = 123 -- Or string "\"123\"" | "'123'" | '"123"' | [["123"]]
    	--[[ 
    		Or table through JSON: local arg = '`' .. toJSON({}) .. '`'
    		In JS: const result = JSON.parse(arg)
    	]]
    	executeBrowserJavascript(browser, [[onRemotePlayerWasted(]] .. arg .. [[);]])
    end)

     

    *adjusted JSON example, Must be tested through trial and error.

  12. 39 minutes ago, JamesDragon said:

    f i want for exemple execute a js function when a lua event happen

     

    For example you have an html file with:

    <script>
    	function onRemotePlayerWasted () {
    		/* ... */
    	}
    </script>

    And you inject the following JavaScript to call the function.

    addEventHandler("onClientPlayerWasted", root, 
    function ()
    	executeBrowserJavascript(browser, [[onRemotePlayerWasted();]])
    end)

     

    • Like 1
  13. 2 hours ago, JamesDragon said:

    i work on a ui panel using html

     

    You could try something like this.

    
    -- See https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript for the rest of browser the code
    
    function reloadList (browser)
        local list = {
            "a",
            "b"
        }
    
        local htmlItems = {}
        for index, value in ipairs(list) do
            table.insert(htmlItems, [[<li>]] .. value .. [[</li>]])    
        end
    
        local js = [[{
            const list = document.createElement("ul")
            list.innerHTML = `]] .. table.concat(htmlItems, "\n") ..  [[`;
            document.body.append(list);
        }]]
    
        executeBrowserJavascript(browser, js)
    end
    
    addEventHandler("onClientBrowserDocumentReady", browser,
    function ()
        reloadList (source)
    end)

    See: https://wiki.multitheftauto.com/wiki/OnClientBrowserNavigate when having different pages

×
×
  • Create New...