Aller au contenu
  • 0

inscriptions


Question

Posté(e)

Bonjour / bonsoir a tous, je voudrais savoir comment faire pour par exemple, dès que un joueur se connecte au serveur et que son nom n'apparait pas parmis les nom dans le fichier plugins/inscriptions/joueurs.txt

alors ca ajoute 1 a la variable {new.joueurs}

 

mais par contre si son pseudo apparaît deja alors ca ne fait rien

 

merci !

 

( Ps: je savais pas trop ou mettre ce topic car a la fois c'est de l'aide et de la demande de skript :/ [Modo vous pouvez la move si vous voulez ^^])

9 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Utilise un fichier YAML plutôt que TXT (addons nécessaires)

 

Pour les personnes qui se sont déjà connecté à ton serveur il faut que tu aille dans le dossier "playerdata" qui se trouve dans le dossier de ta map principal, ainsi tu aura la liste des UUID ayant rejoins ton serveur.

J'espère que ton serveur n'autorise pas les crack autrement tu vas avoir du mal pour la suite:

grâce à ce lien : https://mcuuid.net/?q=dc56799d-cb21-4cd9-aff9-ff58a51e91e5

Tu peux retrouver le pseudo de quelqu'un à partir de son UUID (Je t'aurais bien dis d'utiliser l'API mojang direct mais elle semble buggé aujourd'hui)

 

 

En faite dans ton fichier YAML il est même préférable d'enregistrer les uuid et les pseudo correspondant. (ce que je n'ai pas inclus dans le code qui suit)

 

Voici le code que j'utilise, je ne connais pas ton niveau en Skript, si tu est débutant ça risque de te piquer les yeux :

 

options:
   YMLpath: plugins/PlayerStats

function singleYML(path: string, name: string) :: text:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value} to single value "%{_path}%" get of "{@YMLpath}/%{_name}%.yml"
   if {_value} is set:
       return {_value}
   else:
       return ""
function nodesYML(path: string, name: string) :: texts:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value::*} to yml nodes "%{_path}%" from file "{@YMLpath}/%{_name}%.yml"
   if {_value::*} is set:
       return {_value::*}
   else:
       return {_value::*}
function nodeskeyYML(path: string, name: string) :: texts:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value::*} to yml nodes with keys "%{_path}%" from file "{@YMLpath}/%{_name}%.yml"
   if {_value::*} is set:
       return {_value::*}
   else:
       return ""
function listYML(path: string, name: string) :: texts:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value::*} to value list "%{_path}%" get of "{@YMLpath}/%{_name}%.yml"
   if {_value::*} is set:
       return {_value::*}
   else:
       return ""

command /yml <text> <offline player> [<text>] [<string>]:
   trigger:
       sender is op or console
       "%arg-2%" is not "<none>"
       if file "{@YMLpath}/%arg-2%.yml" does not exist:
           send "<pink>ERREUR FICHIER n'existe pas : %arg-1% %arg-2% %arg-3% %arg-4%" to all ops
           log "ERREUR FICHIER inexistant : /yml %arg-1% %arg-2% %arg-3% %arg-4%" to "erreur.log"
           stop
       if arg-1 is "set":
           set "%arg-3%" to "%arg-4%" in yml "{@YMLpath}/%arg-2%.yml"
           stop
       set {_value} to single value "%arg-3%" get of "{@YMLpath}/%arg-2%.yml" parsed as number
       set {_arg4} to "%arg-4%" parsed as number
       if arg-1 is "add":
           add {_arg4} to {_value}
       if arg-1 is "remove":
           remove {_arg4} from {_value}
       set "%arg-3%" to "%{_value}%" in yml "{@YMLpath}/%arg-2%.yml"

command /ymllist <text> <offline player> [<text>] [<string>]:
   trigger:
       sender is op or console
       "%arg-2%" is not "<none>"
       if file "{@YMLpath}/%arg-2%.yml" does not exist:
           send "<pink>ERREUR FICHIER n'existe pas : %arg-1% %arg-2% %arg-3% %arg-4%" to all ops
           log "ERREUR FICHIER inexistant : /ymllist %arg-1% %arg-2% %arg-3% %arg-4%" to "erreur.log"
           stop
       if arg-1 is "add":
           add "%arg-4%" to yml list "%arg-3%" from file "{@YMLpath}/%arg-2%.yml"
       if arg-1 is "remove":
           remove "%arg-4%" from yml list "%arg-3%" from file "{@YMLpath}/%arg-2%.yml"

on join:
   if file "{@YMLpath}/%player%.yml" does not exist:
       create file "{@YMLpath}/%player%.yml"
       execute console command "/yml add %player% %name of player% %player's UUID%"
       execute console command "/yml add %player% ip %player's ip%"
   set {_value::*} to listYML("list.liste", "SERVEUR")
   if {_value::*} does not contain "%player%":
       execute console command "/ymllist add SERVEUR list.players %player%"
       execute console command "/yml add SERVEUR list.joueursTOTAL 1"

  • 0
Posté(e)
Utilise un fichier YAML plutôt que TXT (addons nécessaires)

 

Pour les personnes qui se sont déjà connecté à ton serveur il faut que tu aille dans le dossier "playerdata" qui se trouve dans le dossier de ta map principal, ainsi tu aura la liste des UUID ayant rejoins ton serveur.

J'espère que ton serveur n'autorise pas les crack autrement tu vas avoir du mal pour la suite:

grâce à ce lien : https://mcuuid.net/?q=dc56799d-cb21-4cd9-aff9-ff58a51e91e5

Tu peux retrouver le pseudo de quelqu'un à partir de son UUID (Je t'aurais bien dis d'utiliser l'API mojang direct mais elle semble buggé aujourd'hui)

 

 

En faite dans ton fichier YAML il est même préférable d'enregistrer les uuid et les pseudo correspondant. (ce que je n'ai pas inclus dans le code qui suit)

 

Voici le code que j'utilise, je ne connais pas ton niveau en Skript, si tu est débutant ça risque de te piquer les yeux :

 

options:
   YMLpath: plugins/PlayerStats

function singleYML(path: string, name: string) :: text:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value} to single value "%{_path}%" get of "{@YMLpath}/%{_name}%.yml"
   if {_value} is set:
       return {_value}
   else:
       return ""
function nodesYML(path: string, name: string) :: texts:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value::*} to yml nodes "%{_path}%" from file "{@YMLpath}/%{_name}%.yml"
   if {_value::*} is set:
       return {_value::*}
   else:
       return {_value::*}
function nodeskeyYML(path: string, name: string) :: texts:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value::*} to yml nodes with keys "%{_path}%" from file "{@YMLpath}/%{_name}%.yml"
   if {_value::*} is set:
       return {_value::*}
   else:
       return ""
function listYML(path: string, name: string) :: texts:
   if yml path "%{_path}%" in file "{@YMLpath}/%{_name}%.yml" exists:
       set {_value::*} to value list "%{_path}%" get of "{@YMLpath}/%{_name}%.yml"
   if {_value::*} is set:
       return {_value::*}
   else:
       return ""

command /yml <text> <offline player> [<text>] [<string>]:
   trigger:
       sender is op or console
       "%arg-2%" is not "<none>"
       if file "{@YMLpath}/%arg-2%.yml" does not exist:
           send "<pink>ERREUR FICHIER n'existe pas : %arg-1% %arg-2% %arg-3% %arg-4%" to all ops
           log "ERREUR FICHIER inexistant : /yml %arg-1% %arg-2% %arg-3% %arg-4%" to "erreur.log"
           stop
       if arg-1 is "set":
           set "%arg-3%" to "%arg-4%" in yml "{@YMLpath}/%arg-2%.yml"
           stop
       set {_value} to single value "%arg-3%" get of "{@YMLpath}/%arg-2%.yml" parsed as number
       set {_arg4} to "%arg-4%" parsed as number
       if arg-1 is "add":
           add {_arg4} to {_value}
       if arg-1 is "remove":
           remove {_arg4} from {_value}
       set "%arg-3%" to "%{_value}%" in yml "{@YMLpath}/%arg-2%.yml"

command /ymllist <text> <offline player> [<text>] [<string>]:
   trigger:
       sender is op or console
       "%arg-2%" is not "<none>"
       if file "{@YMLpath}/%arg-2%.yml" does not exist:
           send "<pink>ERREUR FICHIER n'existe pas : %arg-1% %arg-2% %arg-3% %arg-4%" to all ops
           log "ERREUR FICHIER inexistant : /ymllist %arg-1% %arg-2% %arg-3% %arg-4%" to "erreur.log"
           stop
       if arg-1 is "add":
           add "%arg-4%" to yml list "%arg-3%" from file "{@YMLpath}/%arg-2%.yml"
       if arg-1 is "remove":
           remove "%arg-4%" from yml list "%arg-3%" from file "{@YMLpath}/%arg-2%.yml"

on join:
   if file "{@YMLpath}/%player%.yml" does not exist:
       create file "{@YMLpath}/%player%.yml"
       execute console command "/yml add %player% %name of player% %player's UUID%"
       execute console command "/yml add %player% ip %player's ip%"
   set {_value::*} to listYML("list.liste", "SERVEUR")
   if {_value::*} does not contain "%player%":
       execute console command "/ymllist add SERVEUR list.players %player%"
       execute console command "/yml add SERVEUR list.joueursTOTAL 1"

Oui mais il n’a plus le player data étant donné qu’il a refait son serveur y compris les maps du coup c’est pour ça que je lui demandais s’il avait un fichier avec ses joueurs pour faire un countains ou en yml vérifier oui

×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.