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.

Offline Votes

Discussion in 'Skript' started by Reframed, Jul 28, 2017.

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

    Reframed Member

    Joined:
    Mar 8, 2017
    Messages:
    11
    Likes Received:
    0
    Skript Version: Skript 2.2 (dev29)
    Skript Author: Bensku
    Minecraft Version: 1.11.2

    I am currently attempting to execute a command even if the player who voted is offline but skript is sending me this in console:
    [​IMG]
    This is my code:
    Code (Text):
    1. on offline vote:
    2.     broadcast "test"
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Is this an error? It wouldn't do any good to give them, for instance, an item if they weren't online because they wouldn't be there to receive it. Also wouldn't it be easier to just require the player to be online or they just miss out on rewards? Sorry if I'm wrong <3
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    I am not attempting to give rewards, they will be given via a proper listener. This is just for setting the cooldown since it will only activate once they join, so the cooldown could start once they already voted. It technically isn't an error since it is getting the votes but not executing broadcast (which it will do if player comes online)
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Ahh, I see.
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Any idea on how to fix this?
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    I looked into it and I'm pretty sure this just won't work. Sorry :/
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Uhm, do i understand correctly?

    you are using this events?:

    Code (Skript):
    1. On vote:
    2.  #Bla
    3.  
    even, if a player is not online, You get the console spam? SO its mean, You should this saved into variables, like this

    Code (Skript):
    1. on vote:
    2.     if event-player is online:
    3.       #Todo
    4.     else:
    5.         set {Vote::%event-player%} to true
    6.  
    7. on join:
    8.     if {Vote::%player%} is set:
    9.         delete {Vote::%player%}
    10.         send "Thanks for voting!"
    11.         #Give stuff
     
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    No this is not the issue. It sends this message only once if the player is offline to let me know that it saved the player and everything will be executed once they join. I am trying to run something if the player is offline (which does not work) to make my skript work correctly
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    maybe try use this way

    Code (Skript):
    1. on vote:
    2.     if player is not online:
    3.         #Todo when player is offline.
     
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Tried it
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    I've never messed with the on vote event, and don't personally know how it works, so my question is: does the event even fire if the voting player is offline, or does it catch it before and just not run?

    If it doesn't fire at all, you may be out of luck, and may have to use an external voting listener.

    If it does fire, maybe something like this may work:

    Code (Skript):
    1.  
    2. on vote:
    3.     set {_player} to "%player%" parsed as offline-player
    4.     if {_player} is not online:
    5.         broadcast "%{_player}% is not currently online!"
    6.  
     
  12. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    On raw vote received:
    send "%event-string%"

    Skrayfall
    Or use that skript hook Thing in resources. Also has a raw vote event
     
Thread Status:
Not open for further replies.

Share This Page

Loading...