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!

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

WebSK

Discussion in 'Addon Releases' started by jensjeflensje, Oct 28, 2021.

  1. jensjeflensje

    jensjeflensje New Member

    Joined:
    Dec 3, 2017
    Messages:
    0
    Likes Received:
    3
    WebSK is a Skript addon that lets you create the back-end of websites using Skript. This means you can easily implement ingame elements inside a website (or HTTP API). It relies on mapping certain webserver paths to functions, which will execute any Skript code you want it to, as long as it returns a string to return on the web page.

    Setup is as easy as this:
    Code (Text):
    1. on script load:
    2.     start webserver on port 8000
    3.  
    4. on script unload:
    5.     stop webserver
    Then, you can add paths to your webserver like this (this should be inside the script load event):
    Code (Text):
    1. add webserver path "/" to run myHomePage()
    2.  
    An example of a request function is:
    Code (Text):
    1. function myHomePage(req: request) :: string:
    2.     return "Home page"
    An example of something you can create with this addon is a system that displays someone's amount of money on the website (requires vault):
    Code (Text):
    1. on script load:
    2.     start webserver on port 8000
    3.     add webserver path "/money" to run checkMoney()
    4.  
    5. on script unload:
    6.     stop webserver
    7.  
    8. function checkMoney(req: request) :: string:
    9.     set {_player} to parameter "player" of {_req} parsed as offline player
    10.     return "%money of {_player}%"
    You would reach this website by going to (ip):8000/money?player=(playername)

    For more examples, go to https://files.jederu.nl/websk.html.
     

Share This Page

Loading...