dTownyFlight - players can fly in their town

Share scripts you wrote for Denizen-Bukkit here!
Post Reply
Cuppa_Cocoa
New
New
Posts: 1
Joined: December 14th, 2018, 9:06 pm

dTownyFlight - players can fly in their town

Post by Cuppa_Cocoa » December 14th, 2018, 9:30 pm

I got the impression this forum was more for extra, and ignored, so I wasn't posting here.

The script just enables flight for players inside a town, of which they are a resident. It disables flight when leaving town.

Code: Select all

# permission: dtownyflight.fly

dTownyFlightChat:
  type: format
  debug: false
  format: '<&f>[<&6>dTownyFlight<&f>]<&r>: <&7><text> '

dTownyFlight:
  type: world
  debug: false
  title: <gold>dTownyFlight
  size: 18
  description: Gives players /fly while in a town of which they are a resident
  events:
    on towny player enters town:
    - define person <player.name>
    - if <context.town.residents.contains[<player>]> {
      - if <player.has_permission[dtownyflight.fly]||player.is_op> {
        - adjust <player> can_fly:true
        - narrate targets:<player> format:dTownyFlightChat "Flight activated, while inside your town."
        - queue clear
        } else
          - adjust <player> can_fly:false
          - narrate targets:<player> format:dTownyFlightChat "Flight deactivated."
          - queue clear
      } else return

    on towny player exits town:
    - define person <player.name>
    - if <context.town.residents.contains[<player>]> {
      - if <player.has_permission[dtownyflight.fly]> {
        - adjust <player> can_fly:false
        - narrate targets:<player> format:dTownyFlightChat "Flight deactivated. Re-enter your town to fly, again."
        - queue clear
        } else
          - adjust <player> can_fly:false
          - narrate targets:<player> format:dTownyFlightChat "Flight deactivated."
          - queue clear
      } else return

User avatar
Mergu
Regular
Regular
Posts: 3
Joined: December 14th, 2018, 8:43 pm

Re: dTownyFlight - players can fly in their town

Post by Mergu » December 14th, 2018, 9:42 pm

Hey man, thanks for posting. Consider joining us on Discord if you haven't already: https://discord.gg/Q6pZGSR

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest