Oui je suis debutant jai commencer ce matin ;)
D'aillleur voila mon Skript si vous savez comment l'optimiser
options:
Prefix: &b[Authentification]
script options:
$ init com.mysql.jdbc.Driver
$ db url jdbc:mysql://localhost:3306/skript
$ db username root
$ db password root
on first join:
if player is in world "auth":
update "INSERT INTO players (Pseudo, Password, IP) VALUES ('%player%', 'aucun', '%player's IP address%')"
on join:
if player is in world "auth":
set {hub} to position X, Y, Z in world("Hub")
set {x} to random number between -5000 and 5000
set {z} to random number between -5000 and 5000
teleport player to location at {x}, 3, {z}
set join message to ""
update "INSERT INTO playersonline (Pseudo, Map) VALUES ('%player%', 'auth')"
set {password.%player%} to the first element out of objects in column "Password" from result of query "SELECT * FROM players WHERE Pseudo = '%player%'"
set {ip.%player%} to the first element out of objects in column "IP" from result of query "SELECT * FROM players WHERE Pseudo = '%player%'"
if {password.%player%} is "aucun":
send message "{@Prefix} &6Bienvenue, entre ton nouveau mot de passe dans le chat" to player
set {inscription.%player%} to true
else if {ip.%player%} is "%player's IP address%":
send message "{@Prefix} &dVotre adresse IP a été reconnu, connexion au hub dans 5 secondes..." to player
set {connection.%player%} to false
wait 5 seconds
teleport player to {hub}
else:
set {connection.%player%} to true
send message "{@Prefix} &6Heureux de te revoir, entre ton mot de passe dans le chat" to player
on quit:
if player is in world "auth":
set quit message to ""
update "DELETE FROM playersonline WHERE Pseudo = '%player%'"
if {inscription.%player%} is true:
delete {password.%player%}
set {inscription.%player%} to false
on chat:
cancel event
if player is in world "auth":
if {inscription.%player%} is true:
update "UPDATE players SET Password = '%message%' WHERE Pseudo = '%player%'"
send message "{@Prefix} &dVotre nouveau mot de passe est: %message%" to player
send message "{@Prefix} &aMot de passe enregistré, connexion au hub dans 5 secondes..." to player
delete {inscription.%player%}
wait 5 seconds
teleport player to {hub}
if {connection.%player%} is true:
if "%message%" is {password.%player%}:
send message "{@Prefix} &aMot de passe correct, connexion au hub dans 5 secondes..." to player
set {connection.%player%} to false
update "UPDATE players SET IP = '%player's IP address%' WHERE Pseudo = '%player%'"
wait 5 seconds
teleport player to {hub}
else:
send message "{@Prefix} &4Mot de passe incorrect" to players
on block damage:
if player is in world "auth":
cancel event
on can build check:
if player is in world "auth":
cancel event
on walking on glass:
if player is in world "auth":
cancel event
on weather change to rain or thunder:
if world is "auth":
cancel event