Skript1.21Resmi#skript#afk#sunucu

AFK Sistemi

Hareketsiz oyuncuları otomatik AFK yapar, sekme listesinde gösterir, /afk komutu ve isteğe bağlı uzun AFK'da atma (Skript).

MinborAIminborai 4 0 0 0
Kaynak kod (ZIP)
Tüm hakları saklıdırSunucuda kullanDeğiştirTicari· Atıf gerekli
scripts/afksistemi.sk
1# AFK Sistemi — MinborAI şablonu (Skript)
2options:
3 prefix: &7[&eAFK&7]&r
4 # Kaç dakika hareketsiz kalınca AFK sayılır
5 afk-minutes: 5
6 # Kaç dakika AFK kalınca atılır (0 = atma)
7 kick-minutes: 30
8
9on join:
10 set {afk::last::%uuid of player%} to now
11 delete {afk::state::%uuid of player%}
12
13on quit:
14 delete {afk::state::%uuid of player%}
15 delete {afk::since::%uuid of player%}
16
17function leaveAfk(p: player):
18 delete {afk::state::%uuid of {_p}%}
19 delete {afk::since::%uuid of {_p}%}
20 set tab list name of {_p} to name of {_p}
21 broadcast "{@prefix} &f%{_p}% &7artık AFK değil."
22
23function enterAfk(p: player):
24 set {afk::state::%uuid of {_p}%} to true
25 set {afk::since::%uuid of {_p}%} to now
26 set tab list name of {_p} to "&7[AFK] %name of {_p}%"
27 broadcast "{@prefix} &f%{_p}% &7AFK oldu."
28
29on chat:
30 set {afk::last::%uuid of player%} to now
31 if {afk::state::%uuid of player%} is true:
32 leaveAfk(player)
33
34on move:
35 set {afk::last::%uuid of player%} to now
36 if {afk::state::%uuid of player%} is true:
37 leaveAfk(player)
38
39every 30 seconds:
40 loop all players:
41 set {_id} to uuid of loop-player
42 if {afk::state::%{_id}%} is not set:
43 set {_last} to {afk::last::%{_id}%}
44 if {_last} is set:
45 if difference between {_last} and now is more than {@afk-minutes} minutes:
46 enterAfk(loop-player)
47 else if {@kick-minutes} is more than 0:
48 loop-player does not have permission "afk.bypass.kick"
49 difference between {afk::since::%{_id}%} and now is more than {@kick-minutes} minutes
50 kick loop-player due to "Uzun süre AFK kaldın."
51
52command /afk:
53 description: AFK moduna gir ya da çık
54 permission: afk.use
55 trigger:
56 if {afk::state::%uuid of player%} is true:
57 leaveAfk(player)
58 else:
59 enterAfk(player)
60