- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitlePremium
TypeDenizen Script
Date2015/07/17 21:09:10 UTC-07:00
ByGuest
Other
Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
5800
PremiumCheck:
  type: world
  events:
    on player joins:
    - if <player.in_group[premium].global> {
      - flag <player> isPremium
      - flag global premiumPlayers:++
      - narrate "Thanks for being a premium member!"
      - queue clear
    }
    - define onlineplayers <server.list_online_players>
    - foreach <def[onlineplayers]> {
      - if <%value%.has_flag[isPremium]> {
        - flag global premiumPlayers:++
      } else {
        - flag global regularPlayers:++
      }
      - run PremiumTask
      - if <server.flag[capReached].is[==].to[1]> {
        - execute as_server "kick <player.name> Regular player limit reached. Purchase premium for unlimited access to Gaia!"
      }
    }
    on player quits:
    - if <player.has_flag[isPremium]> {
      - flag <player> isPremium:!
      - flag global premiumPlayers:--
    } else {
      - flag <player> regularPlayers:!
      - flag global regularPlayers:--
    }
    on shutdown:
      - flag global premiumPlayers:0
      - flag global regularPlayers:0
    
PremiumTask:
  type: task
  script:
  - define premiums <flag[premiumPlayers].as_int>
  - define regulars <flag[regularPlayers].as_int>
  - define difference <def[premiums].sub[<def[regulars]>]>
  - if <def[difference].is[OR_MORE].to[10]> {
    #flag true
    - flag global capReached:0
  } else {
    #flag false
    - flag global capReached:1
  }
  
ShowPlayers:
  type: command
  name: showplayers
  usage: /showplayers
  description: Display premium and regular players.
  permission: denizen.showplayers
  script:
  - narrate "Premium Players<global.flag[premiumPlayers].as_int> || Regular Players<global.flag[regularPlayers].as_int>"
        



RawRaw



Pastes made: 62777