Solved Need help with Scoreboards

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Adrihun

Member
Feb 1, 2017
368
6
0
I can't make Scoreboards work. This is my code:

code_language.skript:
on join:
    createBoard(player, "KITBOARD", 15)
    set title of stylish scoreboard "KITBOARD-%player%" to "  &a&lKITPVP  "
    set stylish scoreboard of player to "KITBOARD-%player%"
    updateBoard(player)
function updateBoard(p: player):
    setSlot(player, "KITBOARD", 15, "&c&lServer")
    setSlot(player, "KITBOARD", 14, "&fKitPVP")
    setSlot(player, "KITBOARD", 12, "&c&lMoney")
    setSlot(player, "KITBOARD", 11, "&c&lbalance")
    setSlot(player, "KITBOARD", 9, "&c&lRank")
    setSlot(player, "KITBOARD", 8, "&fTest")
    setSlot(player, "KITBOARD", 6, "&c&lWebsite")
    setSlot(player, "KITBOARD", 5, "&flol.com")
    setSlot(player, "KITBOARD", 4, "&7-----------------------------")
And this is the error i get when I do /skript reload scoreboard
https://hastebin.com/jelidozibi.vbs - How do I fix this?
 
I AM NO GENIUS HERE BUT "
The function 'createBoard' does not exist."

I DON'T THINK THE FUNCTION EXISTS M8
 
The function need to be writed first of the code.
 
code_language.skript:
function updateBoard(p: player):
    setSlot(player, "KITBOARD", 15, "&c&lServer")
    setSlot(player, "KITBOARD", 14, "&fKitPVP")
    setSlot(player, "KITBOARD", 12, "&c&lMoney")
    setSlot(player, "KITBOARD", 11, "&c&lbalance")
    setSlot(player, "KITBOARD", 9, "&c&lRank")
    setSlot(player, "KITBOARD", 8, "&fTest")
    setSlot(player, "KITBOARD", 6, "&c&lWebsite")
    setSlot(player, "KITBOARD", 5, "&flol.com")
    setSlot(player, "KITBOARD", 4, "&7-----------------------------")
        
on join:
    createBoard(player, "KITBOARD", 15)
    set title of stylish scoreboard "KITBOARD-%player%" to "  &a&lKITPVP  "
    set stylish scoreboard of player to "KITBOARD-%player%"
    updateBoard(player)
 
Are you all brain dead? the function SetSlot() does not exist.
 
"createBoard(player, "KITBOARD", 15)" createBoard too , he didn't send the whole code.
 
code_language.skript:
function createBoard(p: player, t: text, size: integer = 15):
    add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    if stylish scoreboard "%{_t}%-%{_p}%" does not exist:
        create new stylish scoreboard named "%{_t}%-%{_p}%"
        loop {_size} times:
            create a new id based score "%{_p}%Slot%loop-number%" with text "%{_d::%loop-number%}%" slot loop-number for stylish scoreboard "%{_t}%-%{_p}%"

function deleteBoard(p: player, t: text):
    loop 15 times:
        delete the id based score "%{_p}%Slot%loop-number%" in stylish scoreboard "%{_t}%-%{_p}%"
    delete stylish scoreboard "%{_t}%-%{_p}%"

function setSlot(p: player, board: text, slot: integer, t: text):
    add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    if {_slot} is between 1 and 15:
        set text of id "%{_p}%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_t}%"

command /board:
    trigger:
        createBoard(player, "Example", 3)
        set title of stylish scoreboard "Example-%player%" to "&a&lSkellett"
        set stylish scoreboard of player to "Example-%player%"
        setSlot(player, "Example", 3, "&6Yeee boi")
        setSlot(player, "Example", 2, "&a&lSkellett stylish scoreboards ftw")
        wait 2 seconds
        deleteBoard(player, "Example")

function updateBoard(p: player):
    setSlot({_p}, "KITBOARD", 15, "&c&lServer")
    setSlot({_p}, "KITBOARD", 14, "&fKitPVP")
    setSlot({_p}, "KITBOARD", 12, "&c&lMoney")
    #setSlot({_p}, "KITBOARD", 11, "&c&l%{_p}'s balance%")
    setSlot({_p}, "KITBOARD", 9, "&c&lRank")
    setSlot({_p}, "KITBOARD", 8, "&f%{rank.%{_p}%}%")
    setSlot({_p}, "KITBOARD", 6, "&c&lWebsite")
    setSlot({_p}, "KITBOARD", 5, "&fnpc-network.net")
    setSlot({_p}, "KITBOARD", 4, "&7-----------------------------")

on join:
    createBoard(player, "KITBOARD", 15)
    set title of stylish scoreboard "KITBOARD-%player%" to "  &a&lKITPVP  "
    set stylish scoreboard of player to "KITBOARD-%player%"
    updateBoard(player)

every 2 seconds:
    loop all players:
        updateBoard(loop-player)

on disconnect:
    deleteBoard(player, "KITBOARD")
 
Last edited by a moderator:
code_language.skript:
function createBoard(p: player, t: text, size: integer = 15):
    add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    if stylish scoreboard "%{_t}%-%{_p}%" does not exist:
        create new stylish scoreboard named "%{_t}%-%{_p}%"
        loop {_size} times:
            create a new id based score "%{_p}%Slot%loop-number%" with text "%{_d::%loop-number%}%" slot loop-number for stylish scoreboard "%{_t}%-%{_p}%"

function deleteBoard(p: player, t: text):
    loop 15 times:
        delete the id based score "%{_p}%Slot%loop-number%" in stylish scoreboard "%{_t}%-%{_p}%"
    delete stylish scoreboard "%{_t}%-%{_p}%"
function setSlot(p: player, board: text, slot: integer, t: text):

    add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    if {_slot} is between 1 and 15:
        set text of id "%{_p}%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_t}%"

command /board:
    trigger:
        createBoard(player, "Example", 3)
        set title of stylish scoreboard "Example-%player%" to "&a&lSkellett"
        set stylish scoreboard of player to "Example-%player%"
        setSlot(player, "Example", 3, "&6Yeee boi")
        setSlot(player, "Example", 2, "&a&lSkellett stylish scoreboards ftw")
        wait 2 seconds
        deleteBoard(player, "Example")

function updateBoard(p: player):
    setSlot({_p}, "KITBOARD", 15, "&c&lServer")
    setSlot({_p}, "KITBOARD", 14, "&fKitPVP")
    setSlot({_p}, "KITBOARD", 12, "&c&lMoney")
    #setSlot({_p}, "KITBOARD", 11, "&c&l%{_p}'s balance%")
    setSlot({_p}, "KITBOARD", 9, "&c&lRank")
    setSlot({_p}, "KITBOARD", 8, "&f%{rank.%{_p}%}%")
    setSlot({_p}, "KITBOARD", 6, "&c&lWebsite")
    setSlot({_p}, "KITBOARD", 5, "&fnpc-network.net")
    setSlot({_p}, "KITBOARD", 4, "&7-----------------------------")

on join:
    createBoard(player, "KITBOARD", 15)
    set title of stylish scoreboard "KITBOARD-%player%" to "  &a&lKITPVP  "
    set stylish scoreboard of player to "KITBOARD-%player%"
    updateBoard(player)

every 2 seconds:
    loop all players:
        updateBoard(loop-player)

on disconnect:
    deleteBoard(player, "KITBOARD")
thanks but thats a big code for a simple scoreboard.
I love the skrayfall one but its broken!
Is there any other addons that do scoreboard and its easy?
[doublepost=1494270021,1494265644][/doublepost]Update: I'm trying to add the name feature to the scoreboard with %player%, so it will show you your name. This is the error i'm getting.
[19:58:55 ERROR]: Variables cannot be used here. (scoreboard.sk, line 29: setSlo
t({_p}, "Board", 14, "&f%player%")')
How can i fix this?
 
@YoshYz What about my custom Economy variable?

This is how I used it in the first one,
code_language.skript:
on join:
    player has permission "scoreboarddzz.use"
    $ thread
    set {_amount} to checkRubies(player)
    set {_message} to "[AMOUNT]"
    replace "[AMOUNT]" in {_message} with "%{_amount}%"
    wipe player's sidebar
    set score "&f%{_message}%" in sidebar of player to 1

Can't do this in "function"
 
Didn't understand what you need for the code above :emoji_stuck_out_tongue:
okay.. let me try explaining it to you lol
So i got money script (mysql) and i want the money to show up on scoreboard.
The only way i can do this is by adding this mysql part to the script, and i can't do that on the function script (lime glass's script)
 
Just get the mysql data , set them into a variable and put it into the setSlot.
 
Just get the mysql data , set them into a variable and put it into the setSlot.
I don't know how to do that. Thats the last thing i need to fix with the scoreboard, and then i can set the title to "Solved".
 
Don't know your table etc from mysql , but that's an example
code_language.skript:
set {_data::*} to objects in column "amount" from result of query "SELECT amount FROM money WHERE uuid = '%uuid of player%'" and close
set {_amount} to "%{_data::*}%" parsed as number
setSlot(player, "BOARD", 1, "%{_amount}%")
 
do you think this whole script will lag my server?
[doublepost=1494275501,1494275424][/doublepost]
Don't know your table etc from mysql , but that's an example
code_language.skript:
set {_data::*} to objects in column "amount" from result of query "SELECT amount FROM money WHERE uuid = '%uuid of player%'" and close
set {_amount} to "%{_data::*}%" parsed as number
setSlot(player, "BOARD", 1, "%{_amount}%")
[21:31:17 ERROR]: There's no player in a function event (scoreboard.sk, line 27:
set {_data::*} to objects in column "amount" from result of query "SELECT amoun
t FROM rubies WHERE uuid = '%uuid of player%'" and close')
 
Status
Not open for further replies.