IIYAMA

Members
  • Content count

    4,264
  • Joined

  • Last visited

  • Days Won

    27

IIYAMA last won the day on April 10

IIYAMA had the most liked content!

Community Reputation

428 Superstar

About IIYAMA

  • Rank
    Soldier
  • Birthday 01/01/2016

Details

  • Gang
    [HB]
  • Location
    Netherlands

Recent Profile Visitors

5,275 profile views
  1. Nope, it doesn't work like that. You can't change arguments of events after they are fired. But you can do something like this. function choosed(processed, colors) if not processed then if choosed then triggerEvent("onDGSPickerChoose", root, true, colors) end end end addEventHandler("onDGSPickerChoose", root, choosed, false) -- addEventHandler("onResourceStart", resourceRoot, function () setElementData(root, "onDGSPickerChoose_blocking", true, false) end) addEventHandler("onResourceStop", resourceRoot, function () removeElementData(root, "onDGSPickerChoose_blocking") end) addEventHandler("onDGSPickerChoose", root, function(processed, rgba) if not getElementData(root, "onDGSPickerChoose_blocking") or processed then end end, false) triggerEvent("onDGSPickerChoose", root, false, {255, 100, 100, 255})
  2. IIYAMA

    Help, Does a Event trigger zone exist?

    https://wiki.multitheftauto.com/wiki/Client_Commands#showcol /showcol To have access to this command: https://wiki.multitheftauto.com/wiki/SetDevelopmentMode
  3. IIYAMA

    This is possible?

    Sure, if you know how to do port forwarding: https://sourceforge.net/projects/npp-plugins/files/NppDocShare/ However, git is basically better if you have multiple stakeholders and a shared production-line/project.
  4. IIYAMA

    Attatching event to root vs resourceRoot

    https://wiki.multitheftauto.com/wiki/AddEvent It is an option to prevent events, to trigger the handlers from either the client or server. If you put the option on a clientside script to false, it will ignore events triggered from serverside scripts. If you put the option on a serverside script to false, it will ignore events triggered from clientside scripts. It doesn't prevent triggering from other files(unless it is from the other [server/client]side) and it also doesn't prevent triggering from other resources. 👍
  5. Start first with making your API: https://wiki.multitheftauto.com/wiki/Resource_Web_Access or/and https://wiki.multitheftauto.com/wiki/Javascript_SDK
  6. IIYAMA

    Problem with where to put end in code

    ------------------ ------ function function functionName () end -- < end ------------------ ------ if statement if true then end -- < end ------------------ ------ if statement with elseif and else if true then elseif true then else end -- < end ------------------ ------ do-end block do end -- < end ------------------ ------ loops for i=1, 10 do end -- < end -- for i, v in ipairs({1, 2, 3}) do end -- < end -- while true do end -- < end ------ Cheat sheet. More info: Starting here: https://www.lua.org/pil/4.3.html https://www.lua.org/pil/4.3.2.html https://www.lua.org/pil/4.3.1.html https://www.lua.org/pil/4.3.4.html https://www.lua.org/pil/4.3.5.html https://www.lua.org/pil/5.html
  7. IIYAMA

    How to stop a command? Help

    The most basic lua syntax for that would be: (without tables) local posX1, posY1, posZ1, rotX1, rotY1, rotZ1 = 2445, 788789, 768879, 0, 90, 0 local posX2, posY2, posZ2, rotX2, rotY2, rotZ2 = 2445, 788789, 768879, 0, 0, 0 moveObject ( barrafc, 1000, posX1, posY1, posZ1, rotX1, rotY1, rotZ1 ) -- A to B moveObject ( barrafc, 1000, posX2, posY2, posZ2, rotX2, rotY2, rotZ2 ) -- B to A
  8. IIYAMA

    How to stop a command? Help

    Define the static start and end orientation and transform to there. Just like a train on a railroad, it can only move between the stations but not further or sidewards.
  9. IIYAMA

    onPlayerCommand gets params?

    Hmm good question. I think they didn't add this feature in case of passwords and other security/privacy sensitive commands.
  10. IIYAMA

    onPlayerCommand gets params?

    addCommandHandler("test", function (player, command, ...) iprint("The responsible player/console:", player) iprint("The command:", command) iprint("The arguments:", ...) local arguments = {...} iprint("The first and second argument:", arguments[1], ",", arguments[2]) end) Serverside @arciCZ This is the sky.
  11. IIYAMA

    dxshader over lapping

    Adjust the handler timing: https://wiki.multitheftauto.com/wiki/AddEventHandler OR (if not working) Pick a different processing moment: https://wiki.multitheftauto.com/wiki/Game_Processing_Order https://wiki.multitheftauto.com/wiki/OnClientPreRender https://wiki.multitheftauto.com/wiki/OnClientHUDRender https://wiki.multitheftauto.com/wiki/OnClientRender
  12. IIYAMA

    Call a table function from another resource

    The /\ availableMissions /\ variable is from your previous code make sure you check and clean that for yourself too. call ( getResourceFromName (resourceName), resourceConnections[resourceName].communicator, "getCommunicationFunctions", 'function reConnect() call( getResourceFromName ("missionManager"), "reConnect") end') If the problem from above doesn't solve the this problem: Make sure to debug everything: iprint(getResourceFromName ("missionManager")) Can it find the resource? <script src="connect.lua" type="server"/> Is the export line applied to the target resource? This will not work because of the problem from above. @Dzsozi (h03)
  13. IIYAMA

    Call a table function from another resource

    Small fix, line 7: (forgot to pass the text through the reConnected function (in the string). call ( getResourceFromName (resourceName), availableMissions[resourceName].communicator, "getCommunicationFunctions", 'function reConnect(...) call( getResourceFromName ("missionManager"), "reConnect", ...) end') "" = string (woman) '' = string (man) Nah, they are the same. There are two types in case you want to use string characters inside of the string. So: "''" -- the string contains these characters: '' '""' -- the string contains these characters: "" In the code I posted, I didn't past a function through it. BUT I past un-executed code (as text) from RESOURCE A to RESOURCE B. This is what loadstring does: a = 1 local functionForLoadedCode = loadstring("a = a + 1") -- load the string before execute it. And return a function which will run the code. functionForLoadedCode() -- The code has been executed! print(a) -- 2 functionForLoadedCode() -- The code has been executed! print(a) -- 3 for i=1, 1000 do functionForLoadedCode() -- The code has been executed! X 1000! Woohoo! end print(a) -- 1003 https://www.lua.org/pil/8.html Don't know, might be caused by the timing.(as resources can't be called before they are loaded) Better use the "onResourceStart" event before the calling. And don't forget to make the function call able within the meta.xml. @Dzsozi (h03)
  14. IIYAMA

    Call a table function from another resource

    Your current problem is that you can't manipulate the same table in two different resources, right? ------------------------------- | ------------------------------- | Environment 1 | Environment 2 | ------------------------------- | ------------------------------- This is indeed a very annoying problem. But lets get back to the possibilities we have. <export /> This exports functions from this resource, so other resources can use them with call function: The function name type Whether function is exported server-side or client-side (valid values are: "client", "server" and "shared") http: Can the function be called via HTTP (true/false) https://wiki.multitheftauto.com/wiki/Meta.xml UNTESTED Example below is untested, but it will probably do something similar to what you want. Write a good wiring example. availableMissions = {} function startMission(resourceName, ...) if resourceName and availableMissions[resourceName] then if availableMissions[resourceName].communicator then call ( getResourceFromName (resourceName), availableMissions[resourceName].communicator, ...) end end end function addMission (missionData) local resourceName = getResourceName(sourceResource) -- https://forum.mtasa.com/topic/33407-list-of-predefined-variables/ -- https://wiki.multitheftauto.com/wiki/Call availableMissions[resourceName] = missionData --availableMissions[missionData.resourceName] = missionData end local mission = {} function communicator (functionName, ...) mission[functionName](...) end mission.startFunction = function(text) outputChatBox(text) end call ( getResourceFromName ("missionManager"), "addMission", {communicator = "communicator", resourceName = "example"} ) call ( getResourceFromName ("missionManager"), "startMission", "startFunction", "Hi!" ) UNTESTED You can also build an example which can be dynamic upgrade-able. local resourceConnections = {} function connect (resourceData) local resourceName = getResourceName(sourceResource) resourceConnections[resourceName] = resourceData if resourceData.communicationFunctions then call ( getResourceFromName (resourceName), availableMissions[resourceName].communicator, "getCommunicationFunctions", 'function reConnect() call( getResourceFromName ("missionManager"), "reConnect") end') end return true end function reConnect (text) outputChatBox(text) -- ... end local resourceFunctions = {} function communicator (functionName, ...) resourceFunctions[functionName](...) end function resourceFunctions.getCommunicationFunctions (communicationFunctions) loadstring(communicationFunctions)() end local connected = call( getResourceFromName ("missionManager"), "connect", {communicator = "communicator", communicationFunctions = true}) iprint(connected) reConnect("hmm does this work???") Damn it is brain fu... while writing this example without any testing.
  15. IIYAMA

    about connection to internet

    In case of a local-server. JavaScript + browser might do the trick as well: https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript https://stackoverflow.com/questions/189430/detect-the-internet-connection-is-offline if (navigator.onLine == true) { console.log("This might work"); } (no guarantees for this browser) https://wiki.multitheftauto.com/wiki/Resource_Web_Access !important