1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Use the socket of MundoSk

Discussion in 'Skript' started by Spartan9802, Jan 30, 2017.

Thread Status:
Not open for further replies.
  1. Spartan9802

    Spartan9802 Member

    Joined:
    Jan 26, 2017
    Messages:
    158
    Likes Received:
    8
    Good evening,
    I do not understand how sockets works, I would like to use them for a system of voting of a page php to my server, is it possible? Is there an event to indicate when an information is sent / received ?
    Thank you !
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    As far as I know, MundoSK only listens for sockets sent from servers.
    If anyone has more knowledge on this subject, please correct me if I am wrong.

    The last thing I made with MundoSK sockets was inter-server chat communication, which only sent and received information via two servers and nothing else.

    Looking at this syntax, it seems you have to open sockets through functions:
    Code (Skript):
    1. open function socket at port %port% with password "%password%" through function "%function%"
    Server 1
    Code (Skript):
    1. function gChat(t: strings, info: objects):
    2.   loop all players:
    3.     if {gchat::%uuid of loop-player%} is set:
    4.       send "%{_t::1}%" to loop-player
    5.   send "%{_t::1}%" to console
    6.  
    7. on chat:
    8.     cancel the event
    9.     set {_msg} to "A %player% > %message%"
    10.     replace all "<none>" in {_msg} with "Console"
    11.     loop all players:
    12.         if {gchat::%uuid of loop-player%} is set:
    13.             send "%{_msg}%" to loop-player
    14.     write "password" and {_msg} to socket with host "localhost" port 25567
    15.  
    16. on script load:
    17.   open function socket at port 25566 with password "wwaters11" through function "gChat"
    Server 2
    Code (Skript):
    1. function gChat(t: strings, info: objects):
    2.   loop all players:
    3.     if {gchat::%uuid of loop-player%} is set:
    4.       send "%{_t::1}%" to loop-player
    5.   send "%{_t::1}%" to console
    6.  
    7. on chat:
    8.     cancel the event
    9.     set {_msg} to "A %player% > %message%"
    10.     replace all "<none>" in {_msg} with "Console"
    11.     loop all players:
    12.         if {gchat::%uuid of loop-player%} is set:
    13.             send "%{_msg}%" to loop-player
    14.     write "password" and {_msg} to socket with host "localhost" port 25566
    15.  
    16. on script load:
    17.   open function socket at port 25567 with password "wwaters11" through function "gChat"
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Thanks !
    I understand better this is what I understood by looking at the documentation ...
    It is therefore not possible to execute a command from a php request?
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    • Like Like x 1
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Dommage ^^
    Thanks for your help and for the link as well :emoji_wink:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...