Solved A trail 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.
Oct 28, 2019
24
0
1
Old Skript
Code:
command /Trailon:
  permission: skript.trail
  trigger:
  if player doesn't have permission "skript.trailon":
    make console execute command "/pex user %player% add skript.trailon"
    wait 1 tick
  else:
    send "[&2cubedpvped&f] &6trail is on" to player
  if player has permission "skript.trailon":
    loop 9999:
      if player has permission "skript.trailon":
        make player execute command "/execute at %player% run particle minecraft:campfire_cozy_smoke ~ ~ ~ 0 0 0 0.0001 5 force"
    if player has permission "skript.trailon":
      send "[&2cubedpvped&f] &6trail ended" to player
new Skript
Code:
every 10 seconds:
  set {prefix.chat} to "&f[&2CubedPVPED&f]"
#                        chat prefix!
#                        code Made by EmperorOfWater
command /Trailon:
  permission: skript.trail
  trigger:
    if {%player%.Trail} is false:
      set {%player%.Trail} to true
      wait 1 tick
    else:
      send "%{prefix.chat}% &6trail is on" to player
      stop
    if {%player%.Trail} is true:
      send "%{prefix.chat}% &6trail will End in 30 minutes unless you do /trailoff" to player
      loop 25000 times:
        if {%player%.Trail} is true:
          make console execute command "/execute at %player% run particle minecraft:barrier ~ ~ ~ 0 0 0 0.0001 5 force"
        wait 2 tick
    if player has permission "skript.trailon":
      set {%player%.Trail} to false
      send "%{prefix.chat}% &6trail ended" to player
      stop
 
command /Trailoff:
  permission: skript.trail
  trigger:
    if {%player%.Trail} is true:
      set {%player%.Trail} to false
      send "%{prefix.chat}% &6trail ended" to player
    else:
      send "%{prefix.chat}% &6trail not on" to player
      set {%player%.Trail} to false
Notes:
prefix = &f[&2CubedPVPED&f] & is fully Customizealbe!
trail = barrier block
time for full trail to complete = 30 minutes
 
Last edited:
Please format your code in the forum post ("Insert -> Code") (The insert button is located by Picture and Media and has a plus sign in it) and paste your code in there. It will help us understand the problem.
 
well they clearly aren't correct if the script says they are incorrect, also all ifs must end with ":", remove the "if" part, keep it like this: "player has permission "x""
 
  • Like
Reactions: emperorofwater
Hey im soon going to be in the pc again if you want i will post the code fully functionally + i will fix some bugs i have nothing to di at the Moment so that‘s no problem :emoji_grinning:

your error was That you mostly forgot the : after you checkt players permission
 
Hey im soon going to be in the pc again if you want i will post the code fully functionally + i will fix some bugs i have nothing to di at the Moment so that‘s no problem :emoji_grinning:

your error was That you mostly forgot the : after you checkt players permission
Yes please this will be helpful! As if you like you can join the server I'm going to run it on. IP = cubedpvped.minehut.gg and if you want I can feature you on the server BTW you can join at anytime but sometimes you will have to join on the hub because I'm running my server off a server hosted server. PS I'm on mobile and its 11:30 right now
Good night hope to hear back soon!
 
Okay I will join the server im going to start with the trails Skript then.

Do you have a teamspeak server?
If not you can find me on: ts.skyplots.de
Its a German teamspeak but it doesn't matter I think
 
Last edited:
Well, I joined and got banned for "lol" I don't know why. My Ingame name is Ronnoc2w ?!?

//EDIT

Got banned on my other account what the hack?!?!??!?

Well now the Whitelist is on and my alt accounts don't work anymore...

Could you send me the discord link?
 
Last edited:
Code:
every 10 seconds:
  set {prefix.chat} to "&f[&2CubedPVPED&f]"
#                        chat prefix!
#                        code Made by EmperorOfWater
command /Trailon:
  permission: skript.trail
  trigger:
    if {%player%.Trail} is false:
      set {%player%.Trail} to true
      wait 1 tick
    else:
      send "%{prefix.chat}% &6trail is on" to player
      stop
    if {%player%.Trail} is true:
      send "%{prefix.chat}% &6trail will End in 30 minutes unless you do /trailoff" to player
      loop 25000 times:
        if {%player%.Trail} is true:
          make console execute command "/execute at %player% run particle minecraft:barrier ~ ~ ~ 0 0 0 0.0001 5 force"
        wait 2 tick
    if player has permission "skript.trailon":
      set {%player%.Trail} to false
      send "%{prefix.chat}% &6trail ended" to player
      stop
 
command /Trailoff:
  permission: skript.trail
  trigger:
    if {%player%.Trail} is true:
      set {%player%.Trail} to false
      send "%{prefix.chat}% &6trail ended" to player
    else:
      send "%{prefix.chat}% &6trail not on" to player
      set {%player%.Trail} to false
 
Why use "loop 25000 times" it will eventually end. Just use a while statement.
code_language.skript:
while {%player%.Trail} is true:
    if player is not online:
        stop loop
    make console execute command "etc"
    wait 2 ticks

EDIT: Didn't realize you wanted it to run for 30 minutes.
 
Last edited:
I recommend to not set variables to false, that does not delete them and cause permanent memory leaks, delete them instead. also I recommend variable format of {variable::%uuid of player%} or {%uuid of player%::variable}
 
Why use "loop 25000 times" it will eventually end. Just use a while statement.
code_language.skript:
while {%player%.Trail} is true:
    if player is not online:
        stop loop
    make console execute command "etc"
    wait 2 ticks

EDIT: Didn't realize you wanted it to run for 30 minutes.
you could of deleted yur post
I also made it run out for lag reasons
[doublepost=1574589783,1574589605][/doublepost]
I recommend to not set variables to false, that does not delete them and cause permanent memory leaks, delete them instead. also I recommend variable format of {variable::%uuid of player%} or {%uuid of player%::variable}
Whats a memory leak.
I dont know how to delete them.
I just looked at another skript and learned off that
I have underlined the words you used for what im speaking about
 
you could of deleted yur post
I also made it run out for lag reasons
[doublepost=1574589783,1574589605][/doublepost]
Whats a memory leak.
I dont know how to delete them.
I just looked at another skript and learned off that
I have underlined the words you used for what im speaking about
replace
set {%player%.Trail} to false
with
delete {trail::%uuid of player%}

memory leak is data that is kept in memory which isn't being used anymore, you are keeping every player's who has used the trail data in database, saying that their trail is false, while instead, you could just not save anything when they don't have a trail. only keep data in database which is absolute must to save, such as wins count of a player.
 
replace
set {%player%.Trail} to false
with
delete {trail::%uuid of player%}

memory leak is data that is kept in memory which isn't being used anymore, you are keeping every player's who has used the trail data in database, saying that their trail is false, while instead, you could just not save anything when they don't have a trail. only keep data in database which is absolute must to save, such as wins count of a player.
ok
done will edit post shortly
 
Status
Not open for further replies.