Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # PvPTimer (PvPTimer.sk)
- # By nfell2009
- # All rights reserved.
- #
- options:
- P: &c&lPvPTimer &7»&e
- PE: &e
- DefaultTime: 1h
- AdminPerm: tp.admin
- on script load:
- delete {tp::running}
- loop 10 times:
- if {tp::running} is not true:
- wait 1 second
- else:
- stop
- if {tp::running} is not true:
- broadcast "{@P} PvPTimer failed to start"
- broadcast "{@P} Error: Problem with timeparser.sk"
- broadcast "{@P} Details: {tp::running} is not true (value: %{tp::running}%)"
- set {tp::failed} to true
- on join:
- if {tp::failed} is true:
- if player has permission "{@AdminPerm}":
- message "{@P} PvPTimer failed to start"
- message "{@P} Error: Problem with timeparser.sk"
- message "{@P} Details: {tp::running} is not true (value: %{tp::running}%)"
- if {tp::players::list::uuids::%uuid of player%} is not set:
- set {tp::players::list::uuids::%uuid of player%} to player
- set {tp::players::list::names::%player%} to uuid of player
- set {_d} to "tp::players::details::%uuid of player%::"
- execute console command "/timeparser QuickDate {@DefaultTime} %{_d}%time %{_d}%days %{_d}%hours %{_d}%minutes %{_d}%seconds"
- set {%{_d}%time} to {%{_d}%time} parsed as time span
- set {tp::players::details::%uuid of player%::protected} to true
- if {tp::players::list::uuids::%uuid of player%} is not player:
- set {tp::players::list::uuids::%uuid of player%} to player
- command /pvptimer [<text>] [<text>] [<text>]:
- trigger:
- if {tp::failed} is true:
- message "{@P} TimeParser failed to start. PvPTimer REQUIRES TimeParser to run."
- else if {tp::running} is not true:
- message "{@P} PvPTimer is waiting for TimeParser to start running."
- if arg 1 is not set:
- message "{@P} PvPTimer help:"
- message "{@P} /pvptimer check [player]"
- message "{@PE} - Checks yours or if provided, another players time"
- message "{@P} /pvptimer remove [player]"
- message "{@PE} - Removes yours or if provided, another players time"
- message "{@P} Providing another players name will require {@AdminPerm}"
- message "{@P} Admin commands:"
- if player has permission "{@AdminPerm}":
- message "{@P} /pvptimer set <player> <time>"
- message "{@PE} - Sets a players time. Uses format like: 1d1h1m1s"
- message "{@P} /pvptimer reload"
- message "{@PE} - Reloads PvPTimer"
- if arg 1 is "check":
- if arg 2 is not set:
- message "{@P} You have: %{tp::players::details::%uuid of player%::time}% time left!"
- else if player has permission "{@AdminPerm}":
- set {_u} to uuid of {tp::players::list::names::%arg 2%}
- message "{@P} %{_p}% has: %{tp::players::details::%{_u}%::time}% time left!"
- else:
- message "{@P} Missing permission: {@AdminPerm}"
- else if arg 1 is "remove":
- if arg 2 is not set:
- delete {tp::players::details::%uuid of player%::time}
- message "{@P} You're now out of PvP protection!"
- else if player has permission "{@AdminPerm}":
- set {_u} to {tp::players::list::names::%arg 2%}
- delete {tp::players::details::%{_u}%::time}
- set {tp::players::details::%{_u}%::protected} to false
- set {_p} to arg 2 parsed as player
- message "{@P} %{_p}% is now out of PvP protection"
- else:
- message "{@P} Missing permission: {@AdminPerm}"
- else if arg 1 is "set":
- if player has permission "{@AdminPerm}":
- if {tp::players::list::names::%arg 2%} is set:
- if arg 3 is set:
- set {_u} to {tp::players::list::names::%arg 2%}
- set {_d} to "tp::players::details::%{_u}%::"
- set {_p} to arg 2
- execute console command "/timeparser QuickDate %arg 3% %{_d}%time %{_d}%days %{_d}%hours %{_d}%minutes %{_d}%seconds"
- set {%{_d}%time} to {%{_d}%time} parsed as time span
- message "{@P} Set: %{_p}%'s time to: %{tp::players::details::%{_u}%::time}%"
- else:
- message "{@P} Missing arguments: time"
- else:
- message "{@P} That player doesn't appear to exist"
- else:
- message "{@P} Missing permission: {@AdminPerm}"
- else if arg 1 is "reload":
- if player has permission "{@AdminPerm}":
- if arg 2 is "all":
- message "{@P} Reloading: TimeParser"
- make player execute command "/sk reload timeparser"
- message "{@P} Reloaded: TimeParser"
- message "{@P} Reloading: PvPTimer"
- make player execute command "/sk reload pvptimer"
- message "{@P} Reloading: PvPTimer"
- else if arg 2 is not set:
- message "{@P} Reloading: PvPTimer"
- make player execute command "/sk reload pvptimer"
- message "{@P} Reloading: PvPTimer"
- else:
- message "{@P} Reload Help:"
- message "{@P} /pvptimer reload all"
- message "{@PE} - Reloads PvPTimer & TimeParser"
- message "{@P} /pvptimer reload"
- message "{@PE} - Reloads PvPTimer"
- else:
- message "{@P} Missing permission: {@AdminPerm}"
- command /pvptimer-console [<text>] [<text>]:
- executable by: console
- trigger:
- if arg 1 is "remove":
- if arg 2 is set:
- set {_u} to {tp::players::list::names::%arg 2%}
- delete {tp::players::details::%{_u}%::time}
- set {tp::players::details::%{_u}%::protected} to false
- set {tp::players::details::%{_u}%::hasbeenmessaged} to true
- set {_p} to arg 2 parsed as player
- message "{@P} You no longer have PvP Protecion!" to {_p}
- on damage of player:
- if attacker is player:
- if {tp::players::details::%uuid of attacker%::protected} is true:
- cancel event
- message "{@P} You're currently under PvP protection! Do /pvptimer remove - to exit protection" to attacker
- else if {tp::players::details::%uuid of victim%::protected} is true:
- cancel event
- message "{@P} %victim% is currently under PvP protection!" to attacker
- every 1 second:
- loop {tp::players::list::names::*}:
- set {_p} to {tp::players::list::uuids::%loop-value%}
- if {_p} is online:
- set {_u} to loop-value
- if {tp::players::details::%{_u}%::time} is less than or equal to 0 seconds:
- if {tp::players::details::%{_u}%::hasbeenmessaged} is not set:
- execute console command "/pvptimer-console remove %{_p}%"
- else:
- subtract 1 second from {tp::players::details::%{_u}%::time}
Add Comment
Please, Sign In to add comment