Files
README.md
screen_share.sk
Code
2 375
screen_share.sk
# PoseidonMC - Screen Share
# Installare in plugins/Skript/scripts/ e ricaricare con /sk reload screen_share.sk
options:
prefix: &b&l[PoseidonMC] &r
no-perm: &cNon hai i permessi per usare questo comando.
msg-player-not-found: &cGiocatore non trovato o offline.
msg-self-target: &cNon puoi avviare un controllo su te stesso.
msg-setup-incomplete: &cSetup incompleto: imposta posizione sospetto, posizione staff e spawn con /sssetup.
msg-already-involved: &cTu o il giocatore indicato siete già coinvolti in uno Screen Share.
msg-not-in-session: &cQuesto giocatore non è coinvolto in uno Screen Share attivo.
msg-chat-offline: &cIl tuo interlocutore è offline: il messaggio non è stato inviato.
msg-chat-invalid: &cLa coppia Screen Share non è valida. Contatta un amministratore.
tempban-command: tempban
tempban-duration: 30d
tempban-reason: Uscita durante il controllo Screen Share
# Comandi eseguiti come ciascun giocatore. Imposta entrambi su none per disattivare l'integrazione.
ss-simplescore-hide-command: simplescore toggle
ss-simplescore-show-command: simplescore toggle
function ssFindOnline(id: text) :: player:
loop all players:
if "%uuid of loop-player%" is {_id}:
return loop-player
function ssFormatTime(total: number) :: text:
set {_minutes} to floor({_total} / 60)
set {_seconds} to {_total} mod 60
if {_minutes} < 10:
set {_minuteText} to "0%{_minutes}%"
else:
set {_minuteText} to "%{_minutes}%"
if {_seconds} < 10:
set {_secondText} to "0%{_seconds}%"
else:
set {_secondText} to "%{_seconds}%"
return "%{_minuteText}%:%{_secondText}%"
function ssDraw(viewer: player, role: text, staffname: text, suspectname: text, time: text):
set {_viewerId} to "%uuid of {_viewer}%"
set name of sidebar of {_viewer} to "&c&lSEI IN SS"
set score "&cStaff:" in sidebar of {_viewer} to 8
set score "%{_staffname}%" in sidebar of {_viewer} to 7
set score "&6Sospetto:" in sidebar of {_viewer} to 5
set score "%{_suspectname}%" in sidebar of {_viewer} to 4
set score "&7Timer:" in sidebar of {_viewer} to 2
if {ss::board-time::%{_viewerId}%} is set:
delete score of {ss::board-time::%{_viewerId}%} in sidebar of {_viewer}
set {_timeLine} to "&b%{_time}%"
set score {_timeLine} in sidebar of {_viewer} to 1
set {ss::board-time::%{_viewerId}%} to {_timeLine}
function ssCleanup(id: text, otherId: text):
set {_other} to {_otherId}
if {_other} is not "":
if {ss::partner::%{_other}%} is not {_id}:
set {_other} to ""
if {ss::role::%{_id}%} is "SOSPETTO":
set {_suspectId} to {_id}
else if {_other} is not "" and {ss::role::%{_other}%} is "SOSPETTO":
set {_suspectId} to {_other}
loop all players:
set {_currentId} to "%uuid of loop-player%"
if {_currentId} is {_id} or {_currentId} is {_other}:
clear sidebar of loop-player
if {ss::simple-hidden::%{_currentId}%} is true:
if "{@ss-simplescore-show-command}" is not "none":
make loop-player execute command "{@ss-simplescore-show-command}"
if {ss::loc::spawn} is set:
teleport loop-player to {ss::loc::spawn}
clear {ss::active::%{_id}%}
clear {ss::role::%{_id}%}
clear {ss::partner::%{_id}%}
clear {ss::name::%{_id}%}
clear {ss::simple-hidden::%{_id}%}
clear {ss::board-time::%{_id}%}
clear {ss::timer::%{_id}%}
remove {_id} from {ss::participants::*}
if {_other} is not "":
clear {ss::active::%{_other}%}
clear {ss::role::%{_other}%}
clear {ss::partner::%{_other}%}
clear {ss::name::%{_other}%}
clear {ss::simple-hidden::%{_other}%}
clear {ss::board-time::%{_other}%}
clear {ss::timer::%{_other}%}
remove {_other} from {ss::participants::*}
if {_suspectId} is set:
clear {ss::timer::%{_suspectId}%}
on script load:
# Un reload dello script chiude eventuali sessioni rimaste aperte.
set {_oldParticipants::*} to {ss::participants::*}
loop {_oldParticipants::*}:
set {_oldId} to loop-value
set {_oldPartner} to {ss::partner::%{_oldId}%}
if {_oldPartner} is not set:
set {_oldPartner} to ""
ssCleanup({_oldId}, {_oldPartner})
command /sssetup [<text>]:
permission: op
permission message: {@prefix}{@no-perm}
trigger:
if argument 1 is not set:
send " " to player
send "{@prefix}&e&lSETUP SCREEN SHARE" to player
send "&7Esegui ogni comando dalla posizione esatta:" to player
send "&b/sssetup position1 &7- posizione del sospetto" to player
send "&b/sssetup position2 &7- posizione dello staff" to player
send "&b/sssetup setspawn &7- hub di fine controllo" to player
stop
if argument 1 is "position1":
set {ss::loc::suspect} to location of player
send "{@prefix}&aPosizione del sospetto salvata." to player
stop
if argument 1 is "position2":
set {ss::loc::staff} to location of player
send "{@prefix}&aPosizione dello staff salvata." to player
stop
if argument 1 is "setspawn":
set {ss::loc::spawn} to location of player
send "{@prefix}&aSpawn di fine controllo salvato." to player
stop
send "{@prefix}&cSottocomando non valido. Usa /sssetup per vedere l'aiuto." to player
command /ss [<player>]:
permission: op
permission message: {@prefix}{@no-perm}
trigger:
if argument 1 is not set:
send "{@prefix}&7Uso: &b/ss <giocatore>" to player
stop
set {_suspect} to argument 1
set {_staffId} to "%uuid of player%"
set {_suspectId} to "%uuid of {_suspect}%"
if {_staffId} is {_suspectId}:
send "{@prefix}{@msg-self-target}" to player
stop
if {ss::loc::suspect} is not set or {ss::loc::staff} is not set or {ss::loc::spawn} is not set:
send "{@prefix}{@msg-setup-incomplete}" to player
stop
if {ss::active::%{_staffId}%} is true or {ss::active::%{_suspectId}%} is true:
send "{@prefix}{@msg-already-involved}" to player
stop
set {ss::active::%{_staffId}%} to true
set {ss::active::%{_suspectId}%} to true
set {ss::role::%{_staffId}%} to "STAFF"
set {ss::role::%{_suspectId}%} to "SOSPETTO"
set {ss::partner::%{_staffId}%} to {_suspectId}
set {ss::partner::%{_suspectId}%} to {_staffId}
set {ss::name::%{_staffId}%} to name of player
set {ss::name::%{_suspectId}%} to name of {_suspect}
set {ss::timer::%{_suspectId}%} to 0
add {_staffId} to {ss::participants::*}
add {_suspectId} to {ss::participants::*}
if "{@ss-simplescore-hide-command}" is not "none":
make player execute command "{@ss-simplescore-hide-command}"
set {ss::simple-hidden::%{_staffId}%} to true
if "{@ss-simplescore-hide-command}" is not "none":
make {_suspect} execute command "{@ss-simplescore-hide-command}"
set {ss::simple-hidden::%{_suspectId}%} to true
teleport player to {ss::loc::staff}
teleport {_suspect} to {ss::loc::suspect}
wait 2 ticks
clear sidebar of player
clear sidebar of {_suspect}
ssDraw(player, "STAFF", name of player, name of {_suspect}, "00:00")
ssDraw({_suspect}, "SOSPETTO", name of player, name of {_suspect}, "00:00")
send "{@prefix}&aControllo Screen Share avviato." to player
send "{@prefix}&7Staff: &c%name of player% &7| Sospetto: &6%name of {_suspect}%" to player
send "{@prefix}&6Sei stato portato in Screen Share. Segui le istruzioni dello staff." to {_suspect}