#Sprint Stanima

1 messages · Page 1 of 1 (latest)

little onyx
#

Well.. i found a Forum in the Website with the Same Title.
I want to Create a Sprint Stamina when someone sprints like 5-10 Seconds he can not run anymore and when hes moving normal he gains his stamina back slowly. Here is a Script i found:

    {stamina::%player%} = 100
on player sprint toggle:
    if {stamina::%player%} > 0:
        loop {stamina::%player%} times:
            wait a second
            if player is sprinting:
                if {stamina::%player%} > 0:
                    reduce {stamina::%player%} by 1
                else:
                    cancel event
                    stop trigger
                    send "&cYour stamina is too low to run!" to player
    else:
        cancel event
        stop trigger
        send "&cYour stamina is too low to run!" to player
every 3 seconds:
    loop all players:
        if loop-player is not sprinting:
            if {stamina::%player%} < 100
                increase {stamina::%player%} by 1```
I Copy pasted it into my Server and i get these errors always
frigid bobcat
#

Well, you checked if the player is sprinting so they are sprinting either way. You can’t cancel an event after you already checked that event

#

The indentation is just one line having an extra indent

little onyx
#

and the other 2 errors?

#

but isn't the "cancel event" on Line 12 there that when the Player's Stamina is 0 and the player tries to sprint that it cancels the sprint?

jovial frigate
#
on sprint toggle:
  if player is not sprinting:
    wait a tick
    while player is sprinting:
      if {stamina::%player%} < 1:
        send "Too low."
        set food of player to 3
        stop
      wait a tick
little onyx
lusty hull
#

correct it will not refill