Jump to content

IIYAMA

Moderators
  • Posts

    5,973
  • Joined

  • Last visited

  • Days Won

    191

IIYAMA last won the day on February 23

IIYAMA had the most liked content!

About IIYAMA

  • Birthday 01/01/2016

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

29,490 profile views

IIYAMA's Achievements

Gangsta

Gangsta (45/54)

1.5k

Reputation

Single Status Update

See all updates by IIYAMA

  1. MTA-Communication-Enchantment

    It is finally far enough in development to share this with you. I made an announcement a few days ago about solving some struggles, that people have with communicating between the server and the client. Today is the day that it isn't just rumour, but for you to use.

     

    Before I am going to write a topic for it, I prefer to solve any unknown issues first. That is where you guys might come in!

     

    Just an example:(1)

    Passing arguments like you used to@

    --CLIENT
    callServer("passingArguments", "arg1", "arg2", "arg3")
    -- SERVER
    function passingArguments (arg1, arg2, arg3)
    	outputChatBox(arg1 .. " " .. arg2 .. " " .. arg3, client)
    end

     

     

    Just an example:(2)

    Calling back!

    -- CLIENT
    callServer(
      	"calculation", 
    	50,
    	100,
    	function (value)
    		outputChatBox("Value: " .. value)			  
    	end
    )

     

    -- SERVER
    function calculation (value1, value2)
    
    	return value1 + value2
    end

     

     

    Just an example:(3)

    Calling before a client has loaded his scripts!

    --SERVER
    addEventHandler("onPlayerJoin", root, 
    function ()
    	
    	callClientAwait(source, "testCallClientAwait")
    	
    end)

     

    -- CLIENT
    function testCallClientAwait ()
    	outputChatBox("Yes this works!")
    end

     


     

    Quote

    List with examples you can explore:

    Examples

     

    List with the syntax of functions you can use:

    Syntax

     

    Set-up for your own resources:

    Set-up

     

     

     

    Thank you @Xwad and @JeViCo for early testing!

     

    Repository: (+ download)

    https://gitlab.com/IIYAMA12/mta-communication-enchantment

    [NOTE] The documentation on the repository is not 100% complete.

     

    Direct download link:
    [NOTE]
    On the repository there is syntax highlight

    https://gitlab.com/IIYAMA12/mta-communication-enchantment/-/archive/master/mta-communication-enchantment-master.zip

    1. Show previous comments  2 more
    2. JeViCo

      JeViCo

      a little example (didn't test it)

      -- CLIENT
      callServer(
        	"checkIfAdmin", localPlayer,
      	function (result)
      		outputChatBox("Does player have admin rights? - " .. tostring(result))			  
      	end
      )
      --SERVER
      function checkIfAdmin(player)
      	return isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Admin" ) )
      end

       

    3. IIYAMA

      IIYAMA

      @JeViCo

      Yea it works!

      Nice done

    4. koragg

      koragg

      You intrigued me with the possibility to call certain events after players are actually loaded (thus removing the annoying red errors that come way too often for nothing). I'll definitely use that in a few resources on my server, thanks for creating it! But it'll be a while before I do so, am kinda busy these days. You're awesome ;)

×
×
  • Create New...