Solved on command cooldown

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

DanRub

Active Member
Jun 3, 2023
151
12
18
23
Hi, i need help. I have RTP plugin on my server and there is option to set cooldown time and message, but I need that when the player has an active cooldown, so that it send him a message + teleport him to spawn, any ideas how to do it?

My broken code:
Code:
on command "/rtp world genworld":
    if player is on cooldown:
        make player execute command "/spawn"
 
You didn't specify your RTP plugin, however if it has an API, you could use skript-reflect to access it & get the current delay.

If that's not the case, that would not be possible, however you could maybe compare the position of the player before and after the command to see if they have teleported however keep in mind that this is a janky solution not for the long term.

You could also just code your own RTP script/plugin in Skript/Java, there already exists many of them and it's not that complicated. For the delay you can use the default cooldown example in the pre-installed Skript examples.
 
You didn't specify your RTP plugin, however if it has an API, you could use skript-reflect to access it & get the current delay.

If that's not the case, that would not be possible, however you could maybe compare the position of the player before and after the command to see if they have teleported however keep in mind that this is a janky solution not for the long term.

You could also just code your own RTP script/plugin in Skript/Java, there already exists many of them and it's not that complicated. For the delay you can use the default cooldown example in the pre-installed Skript examples.
Well, i dont want to code my own rtp plugin, this is what im using as rtp plugin https://www.spigotmc.org/resources/betterrtp-random-wild-teleport.36081/
 
Well, i dont want to code my own rtp plugin, this is what im using as rtp plugin https://www.spigotmc.org/resources/betterrtp-random-wild-teleport.36081/
In the BetterRTP wiki I found this:

Placeholders​

List of all available placeholders, change all <world_name> to the world name you desire (CAse SeNSatiVE)

  • betterrtp_count: Get total amount of rtp's done
  • betterrtp_cooldown: Get cooldown in current world
  • betterrtp_cooldown_<world_name>: Get cooldown of a specified world
  • betterrtp_cooldowntime: Get cooldown time subject to in current world
  • betterrtp_cooldowntime_<world_name>: Get cooldown time subject to in this world
Which means you can just parse the required placeholder with skript-placeholders, and check if the player is on cooldown that way.
 
Well i got it, but how do i exactly create skript with placeholder?
i have something like this, but it doesnt work

Code:
on command "/rtp world genworld":
    set {_RTPCooldown} to placeholder "%betterrtp_cooldown%":
        if %{_RTPCooldown}% is set:
            make player execute command "/spawn"
 
Code:
on command "/rtp world genworld":
    set {_RTPCooldown} to placeholder "betterrtp_cooldown" from player
    if "%{_RTPCooldown}%" is not "None":
        execute player command "spawn"
    # add an "else:" here and the contination of your code under...
Hi!

This should be what you're looking for. Don't forget to mark this reply as the answer if it's working! ^-^
 
Code:
on command "/rtp world genworld":
    set {_RTPCooldown} to placeholder "betterrtp_cooldown" from player
    if "%{_RTPCooldown}%" is not "None":
        execute player command "spawn"
    # add an "else:" here and the contination of your code under...
Hi!

This should be what you're looking for. Don't forget to mark this reply as the answer if it's working! ^-^
Hi, i already solved my problem, but still thanks for help tho :3

This is my code :emoji_grinning:
Code:
on command "/rtp world genworld":
    set {_Rtpcooldown} to placeholder "betterrtp_cooldown"
    if {_Rtpcooldown} is set:
        teleport player to spawn