Solved [ 3/3 Fixed ] Variables not working with Skript

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

Offline

Member
May 25, 2017
41
2
0
So I'm trying to make an Info script, that will show information to the player, like when %arg-1% joined the server, etc. And I'm having problems with when the %arg-1% joined. When I try to do "%arg-1%" in a variable, it won't work, but I need it for the command. How can I solve this problem?

Here Is my Code:
It would be amazing if someone could help me, I only started learning Skript 2 weeks ago. Thank you!

code_language.skript:
on first join:
    set {mysql._joined.%arg-1%} to true
    set {mysql._jtime.%arg-1%} to now
    stop

command /info [<offline player>]:
    usage: Sorry> /info <player>
    trigger:
        arg-1 is not set:
            send "Sorry> /info <player>"
            stop
        set {_player} to "%player%"
        if {mysql._joined.%arg-1%} is true:
            arg-1 is set:
                if arg-1 has permission "test.1":
                    set slot 5 of player's current inventory to feather named "&c%arg-1%" with lore "Joined - {mysql._jtime.%player%}"
                else if arg-1 has permission "test.2":
                    set slot 5 of player's current inventory to feather named "&4%arg-1%" with lore "Joined - {mysql._jtime.%player%}"
        else:
            open chest with 3 rows named "%arg-1% Never Joined!" to player
            set slot 5 of player's current inventory to feather named "&1%arg-1%" with lore "Never joined!"

Also I'm planning on adding sounds to the script, so whenever you try to take out the item in the GUI, it will make a TNT blowing up sound, But unfortunately, I cannot do it, because when I try to:

code_language.skript:
on inventory click:
    if "%inventory name of player's current inventory%" is "Stats":
        cancel event
        if name of clicked item is "&c%arg-1%":
        #do sound stuff

It won't work,because it's %arg-1%
 
Last edited:
@ChisleLP Thank you for responding.

Yes, I know. But my problem is that if i Use %player%, it will use the Players time for "Joined Time", not the %arg-1%'s time. You know what I mean?
 
@ChisleLP Thank you for responding.

Yes, I know. But my problem is that if i Use %player%, it will use the Players time for "Joined Time", not the %arg-1%'s time. You know what I mean?
Well... you don't understand the skript basic?


If you do
code_language.skript:
command /add [<offline player>]:
    trigger:
        add 50 to {Money::%arg-1%}#%arg-1% will be if i do "/add ChisleLP" will saved as "ChisleLP" ({Money::ChisleLP})

#now example

on join:
    if {Money::%player%} is set:#Checking if player
got money
        #%player% will output "ChisleLP" as my name in Minecraft
        send "%{Money::%player%}"#Output how much money does he have
 
@ChisleLP Thanks, I get it now.
But I can't fix this:
It's not going to play a sound when I click on the item, Because the item is named %arg-1%, but I can't do %arg-1% in this script:
So I can't fix it?

code_language.skript:
on inventory click:
    if "%inventory name of player's current inventory%" is "Stats":
        cancel event
        if name of clicked item is "&c%arg-1%":
        #do sound stuff
 
@ChisleLP Thanks, I get it now.
But I can't fix this:
It's not going to play a sound when I click on the item, Because the item is named %arg-1%, but I can't do %arg-1% in this script:
So I can't fix it?

code_language.skript:
on inventory click:
    if "%inventory name of player's current inventory%" is "Stats":
        cancel event
        if name of clicked item is "&c%arg-1%":
        #do sound stuff
do
if clicked slot is 15: #Or what is the slot?
 
Update:
code_language.skript:
on inventory click:
    if "%inventory name of player's current inventory%" is "            &0&nPlayer Stats":
        cancel event
        if clicked slot is 13:
            play sound "ITEM_BREAK" to player with volume 3 and pitch 1
        else if clicked slot is 12:
            play sound "ITEM_BREAK" to player with volume 3 and pitch 1
        else if clicked slot is 14:
            play sound "ITEM_BREAK" to player with volume 3 and pitch 1

It's not working for slot 13 (player head is in 13)
 
code_language.skript:
on first join:
    set {mysql._joined.%event-player%} to true
    set {mysql._jtime.%event-player%} to now
    stop
 
It doesn't work for only slot 13? And I don't see you ever open an inventory named " &0&nPlayer Stats" which is what you check for.
 
@Donut Yes it only doesnt work for slot 13 i think its not working because of the player head?

code_language.skript:
open chest with 3 rows named "            &0&nPlayer Stats" to player
format slot 13 of player with skull of player named "&4%arg-1%"
 
Status
Not open for further replies.