tictactoe 2.sk

Created by Georges

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

# ------------------------------------
# ---   MORPION/tictactoe ver 2    ---
# ---		   par grod0026		   ---
# ---		   le 27/10/2019	   ---
# ------------------------------------
#
options:
	repertoire2: plugins/Skript/scripts/ttt2
	tttcolor.name: &6 # <Orange># couleur des noms
	tttcolor.var: &e #<yellow> # couleur des variables 
	tttcolor.name: &6 # <Orange># couleur des noms
	tttcolor.text: &a #<Green># couleur des textes
on load:
	suppress the variable save warnings	
	locally suppress conflict warnings
	set {nomver} to "tictactoe 2"
	set {world} to "{display:{Name:""{@tttcolor.name}English""},SkullOwner:{Id:""9f9404c6-c8bd-4380-86f8-40e45e06df05"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWFlMTYxMmI5YTRjNTYyNTRjMjc1YTYyZjQ2ZDMwMzVlOTFjZDRlODVlYzM3MTgyMzFkNDUxNDg1M2I1ZTFlNSJ9fX0=""}]}}}"
	set {param} to "{display:{Name:""{@tttcolor.name}Settings""},SkullOwner:{Id:""3979b007-eecd-4e69-b3fd-69d1b84fd402"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTRkNDliYWU5NWM3OTBjM2IxZmY1YjJmMDEwNTJhNzE0ZDYxODU0ODFkNWIxYzg1OTMwYjNmOTlkMjMyMTY3NCJ9fX0=""}]}}}"
	set {close} to "{display:{Name:""Cross (active)""},SkullOwner:{Id:""eab805c4-ba36-4baa-841f-35031d956453"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTljZGI5YWYzOGNmNDFkYWE1M2JjOGNkYTc2NjVjNTA5NjMyZDE0ZTY3OGYwZjE5ZjI2M2Y0NmU1NDFkOGEzMCJ9fX0=""}]}}}"
	set {soundoff} to "{display:{Name:""Sound (off)""},SkullOwner:{Id:""313c242d-8c18-4b34-9cb7-fc0409fd4b1e"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGVhNmU2YzRmMjkyZmNjODJiZWZlOTEyYjM5MjE3ODQ3MzA4MDZiZGM0YjA0OTE2MzhlNDYzODExMDg4MjdlYiJ9fX0=""}]}}}"
	set {soundon} to "{display:{Name:""Sound (on)""},SkullOwner:{Id:""6ad63e5f-a1ae-44c0-ae27-865de3d16d27"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2RkYjFlM2VjMzg2ZjhkMTg0YzI5ZmMwNGI4ZjZiNzZiMTg3OTVjMzI1YzQyOWM0OGIzNDgzNDMzMDA2N2FjZSJ9fX0=""}]}}}"
	set {smiley} to "{display:{Name:""Smiley face""},SkullOwner:{Id:""47f8de6e-7fe7-416e-9072-acad8b357da3"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMGQzNjZhNDc2NDY2ZjAyNDFhZjMxYzcxZGI2OTc4NTVhMzlhMTZkYzE0YmRkZmYyMDk4ZWQ1MDUwZmYifX19""}]}}}"
	set {arrowG} to "{display:{Name:""Arrow Left""},SkullOwner:{Id:""6d9cb85a-2b76-4e1f-bccc-941978fd4de0"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTE4NWM5N2RiYjgzNTNkZTY1MjY5OGQyNGI2NDMyN2I3OTNhM2YzMmE5OGJlNjdiNzE5ZmJlZGFiMzVlIn19fQ==""}]}}}"
	set {arrowD} to "{display:{Name:""Arrow Right""},SkullOwner:{Id:""3cd9b7a3-c8bc-4a05-8cb9-0b6d4673bca9"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzFjMGVkZWRkNzExNWZjMWIyM2Q1MWNlOTY2MzU4YjI3MTk1ZGFmMjZlYmI2ZTQ1YTY2YzM0YzY5YzM0MDkxIn19fQ==""}]}}}"
	set {headEn} to "{display:{Name:""{@tttcolor.name}English""},SkullOwner:{Id:""77c6f787-5d07-4969-a118-a1336f90af30"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTIxYzJmYmE1ZDRkMDg0NmNmZmM5Nzc0NjQ0NzgyZjk3OWJjMDQ2NWI3NzlkZGViMjM1MzhmYzk5MjNiNTcifX19""}]}}}"
	set {headFr} to "{display:{Name:""{@tttcolor.name}Français""},SkullOwner:{Id:""699b59a0-e90b-4c78-a3e4-08ac80723a5f"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWIzNDk1ZTlkYmQ1YTQyNmUxNDQ2ZTY2MjdiZjhkZDU1ZDk2MTJjZTNiNTVhODU5NmUxMTJiMjhkYjllYTNhIn19fQ==""}]}}}"
	set {digit::1::0} to "{display:{Name:""&1Blue 0""},SkullOwner:{Id:""77a597d5-bceb-4a22-8c05-f934c72ffd62"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTVhNzQzOTM4MjIxNTFkM2U4MWY4Nzk0ZmY4NGJjMWI5OGM1N2VlOWE4YTgxZTI5ODMxZjczZWRhMmIzNmEifX19""}]}}}"
	set {digit::1::1} to "{display:{Name:""&1Blue 1""},SkullOwner:{Id:""403e9a84-9ee9-48ba-855e-5b4b0b21a82e"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYmQyMWIwYmFmYjg5NzIxY2FjNDk0ZmYyZWY1MmE1NGExODMzOTg1OGU0ZGNhOTlhNDEzYzQyZDlmODhlMGY2In19fQ==""}]}}}"
	set {digit::1::2} to "{display:{Name:""&1Blue 2""},SkullOwner:{Id:""e681eaec-393e-4a58-be95-cf0b0a9d0898"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmIzNTEzYWE0MTE3YTNhMzI5ZTFmOWE0M2QyYThjNTFjZDcyMmFhZGQ0ZThhZjJmZWRhNjdiMzNiNjRjMjk4In19fQ==""}]}}}"
	set {digit::1::3} to "{display:{Name:""&1Blue 3""},SkullOwner:{Id:""2199ed82-3502-4233-a581-bf92cffeacf8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjllMzhjODE0MzZmM2RhMTIwNjcyZWZiMTYyZDJmNGVhODc0YWIwY2U1NDVhZTMyMzc3N2Y1ZTU3M2MyNTRhIn19fQ==""}]}}}"
	set {digit::1::4} to "{display:{Name:""&1Blue 4""},SkullOwner:{Id:""92d2f8b8-31a6-423e-be04-f449595db82f"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjAzZDQ1NTIxYzI3ZmRkMmYyYjExMzlhMWExN2Q2NDk1ZThmNDdkOWYxMjM0OTNkNGRkOGFhMDZhZmY0MGNlIn19fQ==""}]}}}"
	set {digit::1::5} to "{display:{Name:""&1Blue 5""},SkullOwner:{Id:""59af9e32-3344-40f2-bdc3-aa2fb415bc9b"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWYyYTE0ZGJmOTU4ODEyNmM0M2NkMjExMWViNDFmMWRlNmQ4YzI4MWI2NTE5MTk0MzY0Yjk5NjVmYzQ1NmUifX19""}]}}}"
	set {digit::1::6} to "{display:{Name:""&1Blue 6""},SkullOwner:{Id:""b7bd3615-3129-4ba0-9366-1be7af574eca"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWFlN2NiMzdmZmE2ODY2MzE3NjcyOTI0MzAxYjFiMjk2MzNlNmYyM2YyNTI1NTEzZGJmNzI5YmQyZDA2NiJ9fX0=""}]}}}"
	set {digit::1::7} to "{display:{Name:""&1Blue 7""},SkullOwner:{Id:""dc62330d-2618-464c-8f98-5b0a1736a58c"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTIxZDU2MmM1YTUxYjY0MjI5ZmM2MjZmMjVjNDIxZjZhYzM4Y2Y3ODM5ZTFjNmM0NzE2OGZhYzM3NDJjY2RmOCJ9fX0=""}]}}}"
	set {digit::1::8} to "{display:{Name:""&1Blue 8""},SkullOwner:{Id:""5a86ed0f-3eb7-4e69-bb9d-82c923f3ec45"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZiNTZjYjBiNDhkOWM5ZWRkMTk4NGFmZTE3MTNiOThlZWE5NmQyOWJlNWIyYjU4ZGE0NDQ0YTEwMThlOTVkIn19fQ==""}]}}}"
	set {digit::1::9} to "{display:{Name:""&1Blue 9""},SkullOwner:{Id:""32367617-a026-47bd-991c-f129eee34857"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTM3ZmRlZjgyOTVkZjNmYjZkZWEyMWM2YzhlNDUxZjFmN2ZkNjU3YTYxY2M2NDIzYTNjZTQyYzJmYjk2MWI2YyJ9fX0=""}]}}}"
	set {digit::2::0} to "{display:{Name:""&cRed 0""},SkullOwner:{Id:""0e5fdba9-398a-4075-911a-ca68c4629155"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODViZDFlNjEzZmYzMmI1MjNjY2Y5ZTU3NGNjMzExYjc5OGMyYjNhNjgyOGYwZjcxYTI1NGM5OTVlNmRiOGU1In19fQ==""}]}}}"
	set {digit::2::1} to "{display:{Name:""&cRed 1""},SkullOwner:{Id:""47668232-d1e8-4881-b85d-26d68844deb1"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGQyNDU0ZTRjNjdiMzIzZDViZTk1M2I1YjNkNTQxNzRhYTI3MTQ2MDM3NGVlMjg0MTBjNWFlYWUyYzExZjUifX19""}]}}}"
	set {digit::2::2} to "{display:{Name:""&cRed 2""},SkullOwner:{Id:""3e72504c-b16f-4b91-b288-efc772f7a3db"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjEzYjc3OGM2ZTUxMjgwMjQyMTRmODU5YjRmYWRjNzczOGM3YmUzNjdlZTRiOWI4ZGJhZDc5NTRjZmYzYSJ9fX0=""}]}}}"
	set {digit::2::3} to "{display:{Name:""&cRed 3""},SkullOwner:{Id:""05ddcf01-3792-448b-827c-024df8fe574d"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMDMxZjY2YmUwOTUwNTg4NTk4ZmVlZWE3ZTZjNjc3OTM1NWU1N2NjNmRlOGI5MWE0NDM5MWIyZTlmZDcyIn19fQ==""}]}}}"
	set {digit::2::4} to "{display:{Name:""&cRed 4""},SkullOwner:{Id:""95887376-d33b-4ea1-8c9b-6c2f5eeb2f6a"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTViYzQyYzY5ODQ2YzNkYTk1MzFhYzdkYmEyYjU1MzYzZjhmOTQ3MjU3NmUxN2Q0MjNiN2E5YjgxYzkxNTEifX19""}]}}}"
	set {digit::2::5} to "{display:{Name:""&cRed 5""},SkullOwner:{Id:""5ff84298-8c91-4870-9cf7-3c78990eecdd"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGYzZjU2NWE4ODkyOGVlNWE5ZDY4NDNkOTgyZDc4ZWFlNmI0MWQ5MDc3ZjJhMWU1MjZhZjg2N2Q3OGZiIn19fQ==""}]}}}"
	set {digit::2::6} to "{display:{Name:""&cRed 6""},SkullOwner:{Id:""57221b3d-4293-4328-8611-2e0c043bf3cc"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzVkYTFjYjZjNGMyMzcxMDIyNGI0ZjRlOGQ2ZmZjZjhiNGI1NWY3ZmU4OTFjMTIwNGFmNzQ4NWNmMjUyYTFkOCJ9fX0=""}]}}}"
	set {digit::2::7} to "{display:{Name:""&cRed 7""},SkullOwner:{Id:""7403bd1b-2fbf-4bdf-808f-a25c4ae420ab"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYWY0ZTdhNWNmNWI1YTRkMmZmNGZiMDQzM2IxYTY4NzUxYWExMmU5YTAyMWQzOTE4ZTkyZTIxOWE5NTNiIn19fQ==""}]}}}"
	set {digit::2::8} to "{display:{Name:""&cRed 8""},SkullOwner:{Id:""d3b12e8a-147a-4de0-b491-db22b8770cda"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTY4MzQ0MGM2NDQ3YzE5NWFhZjc2NGUyN2ExMjU5MjE5ZTkxYzZkOGFiNmJkODlhMTFjYThkMmNjNzk5ZmE4In19fQ==""}]}}}"
	set {digit::2::9} to "{display:{Name:""&cRed 9""},SkullOwner:{Id:""56806afd-5bf8-4492-b946-36102da608f5"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjg5NzdhZGVkZmE2YzgxYTY3ZjgyNWVhMzdjNGQ1YWE5MGRmZTNjMmE3MmRkOTg3OTFmNDUyMWUxZGEzNiJ9fX0=""}]}}}"
	loop glob files "**/*.yml" from dir "{@repertoire2}":
		add 1 to {_nb}
	if {_nb} = 3:
		send "&aThe directory {@repertoire2} exists" to console 	
	else:
		send "&cThe directory {@repertoire2} doesn't exists" to console 
		send "&eCREATING {@repertoire2}..." to console
		set {path} to "{@repertoire2}/ttt2config.yml"
		create file {path}
		wait 15 tick
		download from url "https://pastebin.com/raw/gM55JzZu" to file "{@repertoire2}/ttt2config.yml" # skent		
		wait 3 tick
		clear {ttt::ver}
		
	if {ttt::ver} is not set:
		set {ttt::ver} to "0.0"
	unload "ttt2config"
	load yaml "{@repertoire2}/ttt2config.yml" as "ttt2config"
	set {verlue} to yaml value "ttt2config.ver_lang" from "ttt2config"
	send " currently &c%{ttt::ver}%&f" to console 
	send " update &c%{verlue}%&f" to console 
	if {ttt::ver} is not {verlue}:
		set {motif1} to yaml value "ttt2config.motif1" from "ttt2config"
		set {lang_fr} to yaml value "ttt2config.lang_FR" from "ttt2config"
		set {lang_en} to yaml value "ttt2config.lang_EN" from "ttt2config"
		download from url "%{lang_fr}%" to file "{@repertoire2}/ttt2langFR.yml" # skent		
		download from url "%{lang_en}%" to file "{@repertoire2}/ttt2langEN.yml" # skent
		broadcast "======== TTT ================"
		broadcast " currently &c%{ttt::ver}%&f"
		broadcast " update &c%{verlue}%&f"
		broadcast " &c- %{motif1}%&f" 
		broadcast " langue FR &c%{lang_fr}%&f"
		broadcast " Language EN &c%{lang_en}%&f"
		broadcast "============================="
		broadcast "Download and installation in progress"
		set {ttt::ver} to {verlue}
	if file "{@repertoire2}/ttt2langFR.yml" exists:
		send "&efichier FR existe " to console
	else:
		download from url "%{lang_fr}%" to file "{@repertoire2}/ttt2langFR.yml" # skent
		send "&eUpdate pastbin FR" to console
	if file "{@repertoire2}/ttt2langEN.yml" exists:
		send "&efichier EN existe " to console
	else:	
		download from url "%{lang_en}%" to file "{@repertoire2}/ttt2langEN.yml" # skent
		send "&eUpdate pastbin EN" to console
	unload "ttt::lang2_FR"
	load yaml "{@repertoire2}/ttt2langFR.yml" as "ttt::lang2_FR"
	unload "ttt::lang2_EN"
	load yaml "{@repertoire2}/ttt2langEN.yml" as "ttt::lang2_EN"
	clear {listcell::*}
	set {listcell::*} to 12, 13, 14, 21, 22, 23, 30, 31, and 32
	set {ttt::prefix} to "&2[ttt]"
	set {ttt::mat1} to "blue wool block"
	set {ttt::mat2} to "red wool block"
	set {ttt::Permission} to "sk.admin"
	set {ttt::prefixcoffre} to "TTT"
	set {ttt::affresult} to true 
	if {ttt::matpla} is not set:
		set {ttt::matpla} to "green"
	if {ttt::matcas} is not set:
		set {ttt::matcas} to "white"	
	set {ttt::coul::*} to "orange", "white", "yellow", "pink", "gray", "cyan", "purple", "dark green" and "black"
	set {poss::12::1::1} to 1
	set {poss::12::1::2} to 2
	set {poss::12::2::1} to 9
	set {poss::12::2::2} to 18
	set {poss::12::3::1} to 10
	set {poss::12::3::2} to 20
	set {max.12} to 3
	set {poss::13::1::1} to -1
	set {poss::13::1::2} to 1
	set {poss::13::2::1} to 9
	set {poss::13::2::2} to 18
	set {max.13} to 2
	set {poss::14::1::1} to -1
	set {poss::14::1::2} to -2
	set {poss::14::2::1} to 9
	set {poss::14::2::2} to 18
	set {poss::14::3::1} to 8
	set {poss::14::3::2} to 16
	set {max.14} to 3
	set {poss::21::1::1} to 1
	set {poss::21::1::2} to 2
	set {poss::21::2::1} to -9
	set {poss::21::2::2} to 9
	set {max.21} to 2
	set {poss::22::1::1} to -9
	set {poss::22::1::2} to 9
	set {poss::22::2::1} to -1
	set {poss::22::2::2} to 1
	set {poss::22::3::1} to -10
	set {poss::22::3::2} to +10
	set {poss::22::4::1} to -8
	set {poss::22::4::2} to +8
	set {max.22} to 4
	set {poss::23::1::1} to -1
	set {poss::23::1::2} to -2
	set {poss::23::2::1} to -9
	set {poss::23::2::2} to 9
	set {max.23} to 2
	set {poss::30::1::1} to -9
	set {poss::30::1::2} to -18
	set {poss::30::2::1} to 1
	set {poss::30::2::2} to 2
	set {poss::30::3::1} to -8
	set {poss::30::3::2} to -16
	set {max.30} to 3
	set {poss::31::1::1} to -1
	set {poss::31::1::2} to +1
	set {poss::31::2::1} to -9
	set {poss::31::2::2} to -18
	set {max.31} to 2
	set {poss::32::1::1} to -20
	set {poss::32::1::2} to -10
	set {poss::32::2::1} to -9
	set {poss::32::2::2} to -18
	set {poss::32::3::1} to -1
	set {poss::32::3::2} to -2
	set {max.32} to 3
	loop 44 times:
		set {cell::%loop-value%} to 0
	loop all players:
		clear {ttt::%loop-value%}
		clear {ttt::duel::%loop-value%::*}
		clear {ttt::spectate::%loop-value%::*}
		clear {ttt::sauveslot::%loop-value%::*}
		clear {ttt::sauvelore::%loop-value%::*}
		if {ttt::lang::%loop-player%} is not set:
			if language of loop-player contains "fr_":
				set {ttt::lang::%loop-player%} to "FR"
			else:
				set {ttt::lang::%loop-player%} to "EN"
	tttrecreeliste()# reconstruit la liste
	
function tttrecreeliste():
	send "&4Construction de la liste" to console
	clear {ttt::joueurs::*}
	loop all players:
		add "%loop-value%" to {ttt::joueurs::*}
		set {ttt::skull::%loop-value%} to skull of loop-value
		if inventory name of loop-value's current inventory contain "%{ttt::prefixcoffre}%":
			add loop-value to {_ouvert::*}
		wait 1 tick	
	set {ttt::joueurs::*} to alphabetically sorted {ttt::joueurs::*}		
	send "&4Fin de la Construction" to console
	loop {_ouvert::*}:
		set {ttt::closegui::%loop-value%} to true
		close loop-value's inventory
		ttt_affichegui(loop-value, 1)
		
function ttt_toggle(p: player, s:number, part:text):
	if "%{_p}%" is "%{ttt::j::%{_part}%::1}%":
		if {ttt::joueur::%{_part}%} is 1:
			set {_mat} to "a blue %{ttt::mat::%{ttt::j::%{_part}%::1}%}%" parsed as item
			set {ttt::sauveslot::%{_part}%::%{_s}%} to {_mat}
			set slot {_s} of ({ttt::j::%{_part}%::1} parsed as player)'s current inventory to {_mat}
			set slot {_s} of ({ttt::j::%{_part}%::2} parsed as player)'s current inventory to {_mat}
			set {cell::%{_part}%::%{_s}%} to "1"
			ttt_joueson({_p}, 1)
			loop {ttt::spectate::%{_part}%::*}:
				ttt_joueson(loop-value, 1)
			set {_av} to {_s}
			add 1 to {ttt::pion::pose::%{_part}%}
			add {_s} to {_align::*}
			loop {max.%{_av}%} times: 
				set {_t} to 0
				loop {poss::%{_av}%::%loop-value%::*}:
					set {_valalire} to (({_av} + loop-value-2))
					if "%{cell::%{_part}%::%{_valalire}%}%" = "1":
						add 1 to {_t}
						add {_valalire} to {_align::*}
						if {_t} = 2:
							set {_slotinv} to 0
							set {_matr} to "a blue %{ttt::mat::%{ttt::j::%{_part}%::1}%}%" parsed as item
							loop 54 times:
								set {_mat} to {ttt::sauveslot::%{_part}%::%{_slotinv}%} 
								if "%{_mat}%" contain "%{ttt::matpla}% stained glass pane": 
									set slot {_slotinv} of ({ttt::j::%{_part}%::1} parsed as player)'s current inventory to {_matr} named ""
									set slot {_slotinv} of ({ttt::j::%{_part}%::2} parsed as player)'s current inventory to {_matr} named ""
								add 1 to {_slotinv}
							ttt_affguiSpec("%{_part}%", "1")	
							wait 2 seconds
							ttt_joueson({ttt::j::%{_part}%::1}, 2)
							ttt_joueson({ttt::j::%{_part}%::2}, 2)
							ttt_fingames(1, {_part})
			set {ttt::joueur::%{_part}%} to 2
			set {_matj} to "a {ttt::mat2}" parsed as item
			if {ttt::mat::%{ttt::j::%{_part}%::2}%} is set:
				set {_matj} to "a red %{ttt::mat::%{ttt::j::%{_part}%::2}%}%" parsed as item
	else if "%{_p}%" is "%{ttt::j::%{_part}%::2}%":
		if {ttt::joueur::%{_part}%} is 2:
			set {_mat} to "a red %{ttt::mat::%{ttt::j::%{_part}%::2}%}%" parsed as item
			set {ttt::sauveslot::%{_part}%::%{_s}%} to {_mat}	
			set slot {_s} of ({ttt::j::%{_part}%::1} parsed as player)'s current inventory to {_mat}
			set slot {_s} of ({ttt::j::%{_part}%::2} parsed as player)'s current inventory to {_mat}
			set {cell::%{_part}%::%{_s}%} to "3"
			ttt_joueson({_p}, 1)
			loop {ttt::spectate::%{_part}%::*}:
				ttt_joueson(loop-value, 1)
			set {_av} to {_s}
			add 1 to {ttt::pion::pose::%{_part}%}
			add {_s} to {_align::*}
			loop {max.%{_av}%} times: 
				set {_t} to 0
				loop {poss::%{_av}%::%loop-value%::*}:
					set {_valalire} to (({_av} + loop-value-2))
					if "%{cell::%{_part}%::%{_valalire}%}%" = "3":
						add 3 to {_t}
						add {_valalire} to {_align::*}
						if {_t} = 6:
							set {_slotinv} to 0
							set {_matr} to "a red %{ttt::mat::%{ttt::j::%{_part}%::2}%}%" parsed as item
							loop 54 times:
								set {_mat} to {ttt::sauveslot::%{_part}%::%{_slotinv}%} 
								if "%{_mat}%" contain "%{ttt::matpla}% stained glass pane": 
									set slot {_slotinv} of ({ttt::j::%{_part}%::1} parsed as player)'s current inventory to {_matr} named ""
									set slot {_slotinv} of ({ttt::j::%{_part}%::2} parsed as player)'s current inventory to {_matr} named ""
								add 1 to {_slotinv}
							ttt_affguiSpec("%{_part}%", "1")	
							wait 2 seconds 
							ttt_joueson({ttt::j::%{_part}%::1}, 2)
							ttt_joueson({ttt::j::%{_part}%::2}, 2)
							ttt_fingames(2, {_part})
			set {ttt::joueur::%{_part}%} to 1
			set {_matj} to "a {ttt::mat1}" parsed as item
			if {ttt::mat::%{ttt::j::%{_part}%::1}%} is set:
				set {_matj} to "a blue %{ttt::mat::%{ttt::j::%{_part}%::1}%}%" parsed as item
	set {ttt::sauveslot::%{_part}%::49} to {_matj}
	set {ttt::sauvelore::%{_part}%::49} to "{@tttcolor.name}a  %{ttt::j::%{_part}%::%{ttt::joueur::%{_part}%}%}% de jouer"
	set {_t} to {ttt::j::%{_part}%::%{ttt::joueur::%{_part}%}%}
	loop 2 times:
		set {_t} to {ttt::j::%{_part}%::%{ttt::joueur::%{_part}%}%}
		set {_q} to {ttt::j::%{_part}%::%loop-value%}
		set {_q} to {_q} parsed as a player
		set {_named} to ttt_traduc("127", {_q}, {_t})
		set {_matj} to "%{_matj}%" parsed as item 
		set slot 49 of ({ttt::j::%{_part}%::%loop-value%} parsed as player)'s current inventory to {_matj} named "{@tttcolor.name}%{_named}%"
	ttt_affguiSpec("%{_part}%", "99")
	if {ttt::pion::pose::%{_part}%} = 9:
		set {ttt::pion::pose::%{_part}%} to 0
		ttt_fingames(0, {_part})
		ttt_joueson({ttt::j::%{_part}%::1}, 2)
		ttt_joueson({ttt::j::%{_part}%::2}, 2)

function ttt_setup(p:player):
	set {_t2} to ttt_traduc("206", {_p})
	open chest inventory with 2 rows named "{@tttcolor.name}%{ttt::prefixcoffre}% %{_t2}%" to {_p}
#---------------
# pour le son
#---------------
	if {ttt::son::%{_p}%} is not set:
		set {ttt::son::%{_p}%} to true
	set {_t2} to ttt_traduc("284b", {_p})# actuellement 	
	set {_t3} to ttt_traduc("277b", {_p})
	set {_t4} to ttt_traduc("277b-l2", {_p})
	set {_lore::*} to "{@tttcolor.text}%{_t2}% %{ttt::son::%{_p}%}%", "{@tttcolor.text}%{_t3}%", and "{@tttcolor.text}%{_t4}%"# "actuellement %{ttt::son::%{_p}%}% clic gauche désactiver clic droit activer"
	set {_name} to ttt_traduc("277", {_p})
	set {_mat} to {_p}'s skull with nbt {soundon} named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
	if {ttt::son::%{_p}%} is false:
		set {_mat} to {_p}'s skull with nbt {soundoff} named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
	set slot 0 of {_p}'s current inventory to {_mat} 
#-----------------			
# choix du pion 
#-----------------
	if {ttt::mat::%{_p}%} is not set:
		set {ttt::mat::%{_p}%} to "wool block"
	set {_t2} to ttt_traduc("284b", {_p})# actuellement
	set {_t3} to "a white %{ttt::mat::%{_p}%}%"
	set {_t4} to ttt_traduc("256b-l2", {_p})# pion
	set {_lore::*} to "{@tttcolor.text}%{_t2}% a white %{ttt::mat::%{_p}%}%", and "{@tttcolor.text}%{_t4}%"
	set {_name} to ttt_traduc("284", {_p})# pion
	set {_mat} to "a white %{ttt::mat::%{_p}%}%" parsed as item named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
	set slot 2 of {_p}'s current inventory to {_mat}
	if {_p} has permission "%{ttt::Permission}%":
#-------------------			
# plateaux de jeu
#-------------------			
		set {_l1} to ttt_traduc("256b", {_p}, ({ttt::matpla}))
		set {_l2} to ttt_traduc("256b-l2", {_p}, ({ttt::matpla}))
		set {_name} to ttt_traduc("256", {_p})
		set {_lore::*} to "{@tttcolor.text}%{_l1}%", and "{@tttcolor.text}%{_l2}%"   #"actuellement %{ttt::matpla}% glass pane||clic voir le choix"
		set {_mat} to "%{ttt::matpla}% glass pane" parsed as item named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
		set slot 4 of {_p}'s current inventory to {_mat}
#-------------------			
# cases de jeu
#-------------------			
		set {_l1} to ttt_traduc("266b", {_p}, ({ttt::matpla}))
		set {_l2} to ttt_traduc("266b-l2", {_p}, ({ttt::matpla}))
		set {_name} to ttt_traduc("266", {_p})
		set {_lore::*} to "{@tttcolor.text}%{_l1}%", and "{@tttcolor.text}%{_l2}%"   #"actuellement %{ttt::matpla}% glass pane||clic voir le choix"
		set {_mat} to "%{ttt::matcas}% glass pane" parsed as item named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
		set slot 6 of {_p}'s current inventory to {_mat}
#----------------------				
# choix de la langue
#----------------------
	set {_t} to ttt_traduc("selectL", {_p})
	set {_mat} to {_p}'s skull with nbt {world}
	set slot 8 of {_p}'s current inventory to {_mat} named "{@tttcolor.name}%{_t}%" with lore " "

function ttt_choixlangue(p:player):
	set {_t} to ttt_traduc("selectL", {_p})
	set {_mat} to {_p}'s skull with nbt {world}
	open chest inventory with 2 rows named "{@tttcolor.name}%{ttt::prefixcoffre}% %{_t}%" to {_p}
	set slot 8 of {_p}'s current inventory to {_mat} named "{@tttcolor.name}%{_t}%" with lore " "
	set slot 15 of {_p}'s current inventory to {_p}'s skull with nbt {headEn}
	set slot 17 of {_p}'s current inventory to {_p}'s skull with nbt {headFr}	

function ttt_changecasejeu(p:player):
	if {_p} has permission "%{ttt::Permission}%":
		set {_t} to ttt_traduc("266", {_p})
		open chest inventory with 2 rows named "{@tttcolor.name}%{ttt::prefixcoffre}% %{_t}%" to {_p}
		set {_l1} to ttt_traduc("266", {_p}, ({ttt::matcass})) # " actuellement [1] glass pane
		set {_l2} to ttt_traduc("266b-l2", {_p}) # voir le choix
		set {_name} to ttt_traduc("266", {_p})
		set {_lore::*} to "{@tttcolor.text}%{_l1}%", and "{@tttcolor.text}%{_l2}%"   #"actuellement %{ttt::matcas}% glass pane||clic voir le choix"
		set {_mat} to "%{ttt::matcas}% glass pane" parsed as item named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
		set slot 6 of {_p}'s current inventory to {_mat}
		set {_slotc} to 09
		loop {ttt::coul::*}:
			set {_mat} to "%loop-value% glass pane" parsed as item
			set {_ttt::coul} to loop-value
			set {_mat} to {_mat} parsed as item named "" with lore "{@tttcolor.text}%loop-value%"
			set {_t2} to ttt_traduc("256", {_p})
			set {_mat} to {_mat} parsed as item named "{@tttcolor.name}%{_t2}%"
			set slot {_slotc} of {_p}'s current inventory to {_mat}
			add 1 to {_slotc}	
	
function ttt_changepion(p:player):
	set {_t} to ttt_traduc("284", {_p})
	set {_t2} to ttt_traduc("285", {_p})
	open chest inventory with 2 rows named "{@tttcolor.name}%{ttt::prefixcoffre}% %{_t}%" to {_p}
	if {ttt::mat::%{_p}%} is not set:
		set {ttt::mat::%{_p}%} to "wool block"
	set {_t2} to ttt_traduc("284b", {_p})# actuellement
	set {_t3} to "a white %{ttt::mat::%{_p}%}%"
	set {_t4} to ttt_traduc("256b-l2", {_p})# pion
	set {_lore::*} to "{@tttcolor.text}%{_t2}% a white %{ttt::mat::%{_p}%}%", and "{@tttcolor.text}%{_t4}%"
	set {_name} to ttt_traduc("284", {_p})# pion
	set {_mat} to "a white %{ttt::mat::%{_p}%}%" parsed as item named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
	set slot 2 of {_p}'s current inventory to {_mat}
	set {_mat} to a white wool block named "{@tttcolor.name}white wool" with lore "{@tttcolor.text}%{_t2}%"
	set slot 11 of {_p}'s current inventory to {_mat}
	set {_mat} to a white glass block named "{@tttcolor.name}white glass block" with lore "{@tttcolor.text}%{_t2}%"
	set slot 12 of {_p}'s current inventory to {_mat}
	set {_mat} to a white glass pane named "{@tttcolor.name}white glass pane" with lore "{@tttcolor.text}%{_t2}%"
	set slot 13 of {_p}'s current inventory to {_mat}
	#set {_mat} to a white banner named "{@tttcolor.name}white banner" with lore "{@tttcolor.text}%{_t2}%"
	set {_mat} to a stone named "{@tttcolor.name}white banner" with lore "{@tttcolor.text}%{_t2}%"
	set slot 14 of {_p}'s current inventory to {_mat}

function ttt_changeplateau(p:player):
	if {_p} has permission "%{ttt::Permission}%":
		set {_t} to ttt_traduc("256", {_p})
		open chest inventory with 2 rows named "{@tttcolor.name}%{ttt::prefixcoffre}% %{_t}%" to {_p}
		set {_l1} to ttt_traduc("256b", {_p}, ({ttt::matpla})) # " actuellement [1] glass pane
		set {_l2} to ttt_traduc("256b-l2", {_p}) # voir le choix
		set {_name} to ttt_traduc("256", {_p})
		set {_lore::*} to "{@tttcolor.text}%{_l1}%", and "{@tttcolor.text}%{_l2}%"   #"actuellement %{ttt::matpla}% glass pane||clic voir le choix"
		set {_mat} to "%{ttt::matpla}% glass pane" parsed as item named "{@tttcolor.name}%{_name}%" with lore {_lore::*}
		set slot 4 of {_p}'s current inventory to {_mat}
		set {_slotc} to 09
		loop {ttt::coul::*}:
			set {_mat} to "%loop-value% glass pane" parsed as item
			set {_ttt::coul} to loop-value
			set {_mat} to {_mat} parsed as item named "" with lore "%loop-value%"
			set {_t2} to ttt_traduc("256", {_p})
			set {_mat} to {_mat} parsed as item named "{@tttcolor.name}%{_t2}%"
			set slot {_slotc} of {_p}'s current inventory to {_mat}
			add 1 to {_slotc}	

function ttt_voirduels(p:player):
	if size of {ttt::duel::%{_p}%::*} is 0:
		set {_t2} to ttt_traduc("325", {_p})
		send "%{ttt::prefix}% %{_t2}%" to {_p} #Vous n'avez aucunes demandes de duel
	else: 	
		set {_t2} to ttt_traduc("327", {_p})
		open chest inventory with 3 rows named "{@tttcolor.name}%{ttt::prefixcoffre}% %{_t2}%" to {_p}# voir demandes de Duels" to {_p}
		set {_slot} to 0
		set {_t} to ttt_traduc("326", {_p})    # clic gauche pour supprimer l'invitation
		set {_t2} to ttt_traduc("326-l2", {_p})# clic droit pour l'accepter"
		set {_lore::*} to "{@tttcolor.text}%{_t}%" and "{@tttcolor.text}%{_t2}%"
		loop {ttt::duel::%{_p}%::*}:
			set {_value} to loop-value
			set {_mat} to skull of "%{_value}%" parsed as player named "{@tttcolor.name}Joueur %loop-value%" with lore {_lore::*}
			set slot {_slot} of {_p}'s current inventory to {_mat}
			add 1 to {_slot}

function ttt_calcul(nbre:integer): # transformation des scores en digit
	clear {ttt::score::cent}
	clear {ttt::score::diz}
	clear {ttt::score::unit}
	set {ttt::score::cent} to (rounded down ({_nbre}/100))
	set {_nbre} to ({_nbre}-({ttt::score::cent}*100))
	set {ttt::score::diz} to (rounded down ({_nbre}/10))
	set {_nbre} to ({_nbre}-({ttt::score::diz}*10))
	set {ttt::score::unit} to {_nbre}
	
function ttt_joueson(p: player, choix: integer):
	if {ttt::son::%{_p}%} is true: 
		if {_choix} = 1:
			play sound "ui.button.click" with volume 0.3 at {_p}
		else if {_choix} = 2: 
			play sound "block.brewing_stand.brew" with volume 0.3 at {_p}

function ttt_affguiSpec(part: text, indic: text):
	set {_indic} to "%{_indic}%" parsed as integer
	if size of {ttt::spectate::%{_part}%::*} is not 0:
		loop {ttt::spectate::%{_part}%::*}:
			set {ttt::closegui::%loop-value%} to true
			close loop-value's inventory
#			set {ttt::closegui::%loop-value%} to false
			open chest inventory with 6 rows named "{@tttcolor.name}%{ttt::prefixcoffre}% &fSPEC &1%{ttt::j::%{_part}%::1}% &c%{ttt::j::%{_part}%::2}% %{ttt::lang::%loop-value%}%" to loop-value
			set {_slotinv} to 0
			loop 54 times:
				set {_mat} to {ttt::sauveslot::%{_part}%::%{_slotinv}%} #parsed as item
				set {_lore} to ""
				if {ttt::sauvelore::%{_part}%::%{_slotinv}%} is set:
					set {_lore} to "{@tttcolor.text}%{ttt::sauvelore::%{_part}%::%{_slotinv}%}%"
				set {_mat} to {_mat} with lore {_lore} named ""
				set slot {_slotinv} of loop-value-1's current inventory to {_mat} 
				if {_indic} is 1:
					if {_mat} is "%{ttt::matpla}% glass pane" parsed as item:
						set {_mat} to "a shiny %{ttt::matpla}% glass pane" parsed as item named "" with lore {_lore}
						set slot {_slotinv} of loop-value-1's current inventory to {_mat} 
				add 1 to {_slotinv}
			set slot 49 of loop-value-1's current inventory to {ttt::sauveslot::%{_part}%::49} named "%{ttt::sauvelore::%{_part}%::49}%" with lore ""	
			set {_quiregarde} to loop-value	 	
			ttt_calcul({ttt::gain::%{ttt::j::%{_part}%::1}%})	
			set slot 45 of {_quiregarde}'s current inventory to {_quiregarde}'s skull with nbt {digit::1::%{ttt::score::cent}%}
			set slot 46 of {_quiregarde}'s current inventory to {_quiregarde}'s skull with nbt "%{digit::1::%{ttt::score::diz}%}%"
			set slot 47 of {_quiregarde}'s current inventory to {_quiregarde}'s skull with nbt "%{digit::1::%{ttt::score::unit}%}%"
			ttt_calcul({ttt::gain::%{ttt::j::%{_part}%::2}%})
			set slot 51 of {_quiregarde}'s current inventory to {_quiregarde}'s skull with nbt "%{digit::2::%{ttt::score::cent}%}%"
			set slot 52 of {_quiregarde}'s current inventory to {_quiregarde}'s skull with nbt "%{digit::2::%{ttt::score::diz}%}%"
			set slot 53 of {_quiregarde}'s current inventory to {_quiregarde}'s skull with nbt "%{digit::2::%{ttt::score::unit}%}%"
			
function ttt_traduc(id: text, p: player, arg: texts="NoValue") :: text:
	clear {content}
	if {ttt::lang::%{_p}%} is not set:
		set {ttt::lang::%{_p}%} to "EN"
	set {_fic} to "ttt::lang2_%{ttt::lang::%{_p}%}%"
	set {_valeuralire} to "ttt2lang%{ttt::lang::%{_p}%}%.%{_id}%"
	set {content} to yaml value "%{_valeuralire}%" from {_fic}
	if {content} is not set:
		send "&aPROBLEME LANG &f>%{_fic}%< &afichier >&f%{ttt::lang::%{_p}%}%<&a id &f>%{_id}%<&a" to {_p}
		send "&e{_valeuralire} >%{_valeuralire}%<" to {_p}
		send "&aPROBLEME LANG &f>%{_fic}%< &afichier >&f%{ttt::lang::%{_p}%}%<&a id &f>%{_id}%<&a" to console
		send "&e{_valeuralire} >%{_valeuralire}%<" to console
		stop
	loop (size of {_arg::*}) times:
		replace all "[%loop-value%]" in {content} with {_arg::%loop-value%}
	return {content}

on join: 
	if {ttt::lang::%player%} is not set:
		if language of player contains "fr_":
			set {ttt::lang::%player%} to "FR"
		else:
			set {ttt::lang::%player%} to "EN"
		ttt_traduc("choiceL", player)
		send "%{content}%" to player
	clear {ttt::%player%}
	clear {ttt::duel::%player%::*}
	clear {ttt::spectate::%player%::*}
	clear {ttt::sauveslot::%player%::*}
	clear {ttt::sauvelore::%player%::*}

function ttt_fingames(joueur:integer, pafin:text):
	set {_slo} to 0
	set {_tot} to ""
	loop 4 times:
		loop 9 times:
			if "%{listcell::*}%" contain "%{_slo}%":
				if {_slo} > 11:
					set {_tot} to "%{_tot}% %{cell::%{_pafin}%::%{_slo}%}%"
			add 1 to {_slo}
		send "&e%{_tot}%" to console
		set {_tot} to ""
	if {_joueur} = 0:# Fin de partie égalité
		set {_t} to ttt_traduc("119", {ttt::j::%{_pafin}%::%{_joueur}%})
		broadcast "%{ttt::prefix}% %{_t}%"
	else:
		set {_q} to {ttt::j::%{_pafin}%::%{_joueur}%}# parsed as a player
		set {_t} to "%{ttt::j::%{_pafin}%::%{_joueur}%}%"
		set {_t2} to ttt_traduc("121", {_q}, {_t})
		broadcast "%{ttt::prefix}% %{_t2}%"
		add 1 to {ttt::gain::%{ttt::j::%{_pafin}%::%{_joueur}%}%}
		add 1 to {_joueur}
		if {_joueur} > 2:
			set {_joueur} to 1
		set {ttt::joueur::%{_pafin}%} to {_joueur} # le joueur ayant perdu commence la partie suivante
		set {_q} to {ttt::j::%{_pafin}%::%{_joueur}%} #parsed as a player
		set {_t} to "%{ttt::j::%{_pafin}%::%{_joueur}%}%"
		set {_t2} to ttt_traduc("127", {_q}, {_t})
		broadcast "%{ttt::prefix}% %{_t2}%" #a %{ttt::j::%{_pafin}%::%{_joueur}%}% de jouer
	loop {ttt::j::%{_pafin}%::*}:
		set {ttt::closegui::%loop-value%} to true
		close (loop-value parsed as player)'s inventory
	wait 1 seconds
	loop {ttt::j::%{_pafin}%::*}:
		clear {ttt::closegui::%loop-value%}
		set {_qui} to loop-value parsed as player
		set {_t2} to ttt_traduc("tttgui", {_qui})
		make {_qui} execute command "/%{ttt::prefixcoffre}% %{_t2}% %{_qui}%" # gui
		wait 3 tick

on inventory close:
	if inventory name of player's current inventory contain "%{ttt::prefixcoffre}%":
		if {ttt::closegui::%event-player%} is false:
			set {_trouve} to 0
			clear {_partie}
			set {_partie} to {ttt::%player%}
			if {_partie} is set:
				loop {ttt::j::%{_partie}%::*}:
					send "&e%loop-value%" to console
					if loop-value is player:
						set {_t2} to ttt_traduc("153", player)
						send "%{ttt::prefix}% %loop-value% %{_t2}%" #a quitté la partie"
						clear {ttt::%player%}
						remove player from {ttt::j::%{_partie}%::*}
					else:
						if "%{ttt::spectate::%{ttt::%player%}%::*}%" contain "%player%":
							remove player from {ttt::spectate::%{_partie}%::*}
							set {ttt::%player%} to ""
							set {_t2} to ttt_traduc("151", player)# vous avez quitté le mode spectateur
							send "%{ttt::prefix}% %{_t2}%" to player
							exit loop
						else:
							add 1 to {ttt::gain::%loop-value%}
							set {ttt::closegui::%event-player%} to true
							set {_q} to loop-value
							set {_q} to {_q} parsed as a player
							set {_t2} to ttt_traduc("156", {_q}) # un point de plus pour
							broadcast "%{ttt::prefix}% %{_t2}% %loop-value% " 
							close loop-value's inventory
							clear {ttt::%loop-value%}
							remove loop-value from {ttt::j::%{_partie}%::*}
			clear {ttt::closegui::%player%}
		
command /ttt [<text>] [<player>] [<number=1>]:
	aliases: tictactoe
	trigger:
		if {ttt::mat::%player%} is not set:
			set {ttt::mat::%player%} to "wool block"
		if {ttt::son::%player%} is not set:
			set {ttt::son::%player%} to true
		if {ttt::lang::%player%} is not set:
			set {ttt::lang::%player%} to "EN"
			ttt_traduc("choiceL", player)
			send "%{content}%" to player
		set {_vt} to false
		if arg 1 is not set:
			set {_vt} to true
		if arg 1 is "vt":
			set {_vt} to true
		if {_vt} is true:
			if arg 2 is not set:
				set {_qte} to 50
			set {_page} to arg 3
			if {_page} is not set:
				set {_page} to 1
			ttt_affichegui(player, {_page})
		if arg 1 is "reload":
			if player has permission "%{ttt::Permission}%":
				set {ttt::ver} to "0.0"
				make player execute "/sk reload %{nomver}%"
		if arg 1 is ttt_traduc("tttsetup", player):
			ttt_setup(player)
#------------------
# Mode Spectateur
#------------------ 
		if arg 1 is ttt_traduc("tttspectate", player):
			if arg 2 is not set:
				set {_t2} to ttt_traduc("302", player)
				send "%{ttt::prefix}% %{_t2}%" to player
				stop
			else:
				set {_trouve} to false 
				loop all players:
					if {ttt::%loop-value%} is set:
						if loop-value is arg 2:
							set {_trouve} to true
							set {_nomp} to {ttt::%loop-value%}
							exit loop
				if {_trouve} is false:
					set {_t2} to ttt_traduc("313", player)
					send "%{ttt::prefix}% %{_t2}%" to player   # La partie n'existe pas"
					stop
				if "%{ttt::spectate::%{_nomp}%::*}%" does not contain "%player%":
					add player to {ttt::spectate::%{_nomp}%::*}
					set {ttt::%player%} to {_nomp}
				else:
					set {_t2} to ttt_traduc("319", player, {_nomp})
					send "%{ttt::prefix}% %{_t2}%" to player #Vous êtes déjà en mode spectateur de la partie %{_nomp}%"
					stop
				ttt_affguiSpec("%{ttt::%player%}%", "99")
#----------------
# Voir les duels
#------------------- 
		if arg 1 is ttt_traduc("tttsee", player):
			if size of {ttt::duel::%player%::*} is 0:
				set {_t2} to ttt_traduc("325", player)
				send "%{ttt::prefix}% %{_t2}%"#Vous n'avez aucunes demandes de duel" to {_p}
			else: 
				ttt_voirduels(player)
#----------------
# Invite en duel
#---------------- 
		set {_qui} to arg 2
		if arg 1 is ttt_traduc("tttinvite", player):
			if {_qui} is the player:
				set {_t2} to ttt_traduc("344", player, "%player%")
				send "%{ttt::prefix}% %{_t2}%" to player # % Désolé %player% vous ne pouvez vous inviter vous même " to player
				stop
			if "%{ttt::duel::%{_qui}%::*}%" does not contain "%player%":
				add player to {ttt::duel::%{_qui}%::*}
				set {_t2} to ttt_traduc("351", player, "%player%") # le joueur 1 a invité
				broadcast "%{ttt::prefix}% %{_t2}% %{_qui}%" #%player% a invité %{_qui}%"
				ttt_joueson(player, 2)
				ttt_joueson({_qui}, 2)
				if inventory name of {_qui}'s current inventory contain "%{ttt::prefixcoffre}%":
					set {ttt::closegui::%{_qui}%} to true
					close {_qui}'s inventory
					ttt_voirduels({_qui})
			else:
				set {_t2} to ttt_traduc("358", player) # deja invité
				send "%{ttt::prefix}% %{_t2}%" to player
			stop		
#----------------
# Efface le duel
#------------------- 
		if arg 1 is ttt_traduc("tttclear", player):
			set {_qui} to arg 2
			if "%{ttt::duel::%{_qui}%::*}%" does not contain "%player%":
				set {_t2} to ttt_traduc("363", player, {_qui})
				send "%{ttt::prefix}% %{_t2}%" to player#%{_qui}% n'est pas invité donc suppression impossible"
			else:
				remove player from {ttt::duel::%{_qui}%::*} 
				set {_t2} to ttt_traduc("366", player, "%player%")
				broadcast "%{ttt::prefix}% %{_t2}% %{_qui}%" #%player% a effacé l'invitation vers %{_qui}% " 
				if inventory name of {_qui}'s current inventory contain "@{ttt::prefixcoffre}":
					set {ttt::closegui::%{_qui}%} to true
					close {_qui}'s inventory
					ttt_affichegui({_qui}, 1)
#----------------
# Refuse le duel
#----------------
		if arg 1 is ttt_traduc("tttdeny", player) or "no" or "NO":
			set {_quim} to player
			set {_arg2} to arg 2
			if arg 2 is player:
				set {_t2} to ttt_traduc("344", player, "%player%") # Désolé [1] vous ne pouvez vous inviter vous même
				send "%{ttt::prefix}% %{_t2}%" to player
				stop
			if arg 2 is not set:
				set {_t2} to ttt_traduc("374", player)
				send "%{ttt::prefix}% %{_t2}% " to player #Il manque le nom du duel a refuser" to player
				stop
			if "%{ttt::duel::%player%::*}%" does not contain "%{_qui}%":
				set {_t2} to ttt_traduc("380", player, "%{_qui}%")
				send "%{ttt::prefix}% %{_t2}%" to player #%{_qui}% ne vous a pas invité donc suppression impossible"
				stop
			set {_t2} to ttt_traduc("382", player, "%{_quim}%")
			broadcast "%{ttt::prefix}% %{_t2}% %arg 2%" # %player% a refusé l'invitation de %arg 2%"
			remove "%arg 2%" from {ttt::duel::%player%::*}
			ttt_affichegui(player, 1)
#-------------------
# Accepte le duel
#------------------- 
		if arg 1 is ttt_traduc("tttaccept", player) or "yes" or "YES":
			set {_quim} to player
			set {_arg2} to arg 2
			if arg 2 is not set:
				set {_t2} to ttt_traduc("377", player)
				send "%{ttt::prefix}% %{_t2}%" to player # Il manque le nom du duel a accepter" to player
				stop
			if "%{ttt::duel::%player%::*}%" does not contain "%{_qui}%":
				set {_t2} to ttt_traduc("391", player, "%{_qui}%")
				send "%{ttt::prefix}% %{_t2}%" to player #le joueur %{_qui}% ne vous a pas invité " to player
				stop
			set {_t2} to ttt_traduc("393", player, "%{_quim}%")
			broadcast "%{ttt::prefix}% %{_t2}% %arg 2%" # %player% a accepté l'invitation de %arg 2%"
			clear {ttt::duel::%player%::*}
			set {_partie} to arg 2
			clear {ttt::j::%{_partie}%::*}
			set {ttt::j::%{_partie}%::1} to "%arg 2%"
			set {ttt::j::%{_partie}%::2} to "%player%"
			set {ttt::gain::%{ttt::j::%{_partie}%::1}%} to 0
			set {ttt::gain::%{ttt::j::%{_partie}%::2}%} to 0
			set {ttt::joueur::%{_partie}%} to 1
			set {ttt::%arg 2%} to {_partie}
			set {ttt::%player%} to {_partie}
			loop {ttt::j::%{_partie}%::*}:
				set {ttt::closegui::%loop-value%} to true
				set {_qui} to loop-value parsed as a player
				close {_qui}'s inventory
				set {ttt::%loop-value%} to "%{_partie}%"
				set {_t2} to ttt_traduc("tttgui", {_qui})
				make {_qui} execute command "/%{ttt::prefixcoffre}% %{_t2}% %{_qui}% " #gui
#-------------------
# Demarrage du duel
#-------------------				
		if arg 1 is ttt_traduc("tttgui", player):
			set {_qui} to arg 2
			set {_partie} to {ttt::%{_qui}%}  # car parties contiennent le joueur qui a invité 
			set {ttt::pion::pose::%{_partie}%} to 0
			clear {ttt::sauveslot::%{_partie}%::*}
			set {_named} to "%{ttt::prefixcoffre}% &1%{ttt::j::%{_partie}%::1}% &c%{ttt::j::%{_partie}%::2}%"
			open chest inventory with 6 rows named "{@tttcolor.name}%{_named}%" to {_qui}
			set {_mat} to "%{ttt::matpla}% glass pane" parsed as item named ttt_traduc("420", player, {_partie})
			loop integers from 0 to 54:
				set slot loop-value of {_qui}'s current inventory to {_mat}
			loop 54 times:
				set {ttt::sauveslot::%{_partie}%::%(loop-value -1)%} to {_mat}
				set {cell::%{_partie}%::%(loop-value -1)%} to 0
			#------------------------------------------------	
			#  affichage du joueur qui doit jouer (slot 49)
			#------------------------------------------------
			set {_p1} to {ttt::j::%{_partie}%::1} parsed as player
			set {_matj} to "a blue %{ttt::mat::%{_p1}%}%" parsed as item
			set {_t} to {ttt::j::%{_partie}%::1}
			set {_named} to ttt_traduc("127", {_qui}, {_t}) # a  %{ttt::j::%{_partie}%::1}% de jouer"
			if {ttt::joueur::%{_partie}%} is 2:
				set {_matj} to "a red %{ttt::mat::%{ttt::j::%{_partie}%::2}%}%" parsed as item
				set {_t} to {ttt::j::%{_partie}%::2}
				set {_t} to "%{_t}%" #parsed as a text
				set {_named} to ttt_traduc("127", {_qui}, ({_t})) # a  %{ttt::j::%{_partie}%::2}% de jouer"
			set {ttt::sauveslot::%{ttt::%player%}%::49} to {_matj}
			set {ttt::sauvelore::%{ttt::%player%}%::49} to "{@tttcolor.name}%{_named}%"
			set slot 49 of {_qui}'s current inventory to {_matj} named "{@tttcolor.name}%{_named}%"
			set {_t2} to ttt_traduc("130", player)
			set {_lore::*} to "{@tttcolor.text}%{_t2}%", and "{@tttcolor.text}%{ttt::j::%{_partie}%::1}%"# pour le joueur
			if {ttt::gain::%{ttt::j::%{_partie}%::1}%} is greater than 0:
				set {_t2} to ttt_traduc("135", player)
				add "{@tttcolor.text}%{ttt::gain::%{ttt::j::%{_partie}%::1}%}%", and "{@tttcolor.text}%{_t2}%" to {_lore::*}  #points"
			else:
				set {_t2} to ttt_traduc("135", player)
				add "{@tttcolor.text}0 %{_t2}%" to {_lore::*} # points"
			#---------------------------
			#  Affichage score joueur 1
			#---------------------------			
			ttt_calcul({ttt::gain::%{ttt::j::%{_partie}%::1}%})
			set slot 45 of player's current inventory to player's skull with nbt {digit::1::%{ttt::score::cent}%}
			set slot 46 of player's current inventory to player's skull with nbt {digit::1::%{ttt::score::diz}%}
			set slot 47 of player's current inventory to player's skull with nbt {digit::1::%{ttt::score::unit}%}
			set {_t2} to ttt_traduc("130", player)
			set {_lore::*} to "{@tttcolor.text}%{_t2}%", and "{@tttcolor.text}%{ttt::j::%{_partie}%::2}%"# pour le joueur
			if {ttt::gain::%{ttt::j::%{_partie}%::2}%} is greater than 0:
				set {_t2} to ttt_traduc("135", player)
				add "{@tttcolor.text}%{ttt::gain::%{ttt::j::%{_partie}%::2}%}%", and "{@tttcolor.text}%{_t2}%" to {_lore::*} #points"
			else:
				set {_t2} to ttt_traduc("135", player)
				add "{@tttcolor.text}0 %{_t2}%" to {_lore::*}# points
			#----------------
			#  Affichage score joueur 2
			#-------------------			
			ttt_calcul({ttt::gain::%{ttt::j::%{_partie}%::2}%})
			set slot 51 of player's current inventory to player's skull with nbt {digit::2::%{ttt::score::cent}%}
			set slot 52 of player's current inventory to player's skull with nbt {digit::2::%{ttt::score::diz}%}
			set slot 53 of player's current inventory to player's skull with nbt {digit::2::%{ttt::score::unit}%}
			set {_mat} to "%{ttt::matcas}% glass pane" parsed as item
			loop {listcell::*}:
				set {ttt::sauveslot::%{_partie}%::%loop-value%} to {_mat}
				set {_qui2} to {_qui}
				set {_mat} to {_mat} parsed as a item named " "
				set slot loop-value of {_qui}'s current inventory to {_mat} 
			ttt_affguiSpec("%{_partie}%", "99")
			
on inventory click:
	set {_p} to EVENT-player
	set {_slot} to index of event-slot
	if {_slot} is not set:
		stop
	set {_langue} to ttt_traduc("selectL", {_p})
	set {_param} to ttt_traduc("253", {_p}) # ou 206
	set {_pion} to ttt_traduc("284", {_p}) # pion
	set {_plateau} to ttt_traduc("256", {_p})# plateau
	set {_Liste} to ttt_traduc("menu2", {_p})# Liste des Joueurs
	set {_son} to ttt_traduc("277", {_p})# Liste des sons
	set {_case} to ttt_traduc("266", {_p})
	set {_voir} to ttt_traduc("327", {_p})#Voir vos demandes de duels
	if inventory name of current inventory of player contains "%{ttt::prefixcoffre}%":
		cancel event
		ttt_joueson({_p}, 1)
		if inventory name of current inventory of player contains "%{_voir}%":
			set {_index} to {_slot} + 1 
			set {_value} to {ttt::duel::%{_p}%::%{_index}%}
			if click type is left mouse button:#gauche
				set {_t2} to ttt_traduc("tttdeny", {_p})
				make {_p} execute command "/%{ttt::prefixcoffre}% %{_t2}% %{_value}%" #deny
			else if click type is right mouse button:# droit
				set {_t2} to ttt_traduc("tttaccept", {_p})
				make {_p} execute command "/%{ttt::prefixcoffre}% %{_t2}% %{_value}%" #accept
		else if inventory name of current inventory of player contains "%{_Liste}%":
			set {_posi1} to (index of "Page " in uncolored inventory name of current inventory of player)
			if {_posi1} is set:
				set {_posi2} to (index of "/" in uncolored inventory name of current inventory of player)
				if {_posi2} is set:
					set {_page} to subtext of uncolored inventory name of current inventory of player from characters ({_posi1} + 5) to ({_posi2} - 1) parsed as integer
					set {_maxpage} to subtext of uncolored inventory name of current inventory of player from characters ({_posi2} + 1) to length of uncolored name of clicked inventory parsed as integer
					
			if {_slot} is not 36 or 38 or 40 or 44:
				if {_page} is set:
					set {_joueur} to {_slot} + 1
					set {_nomjoueur} to ({listj::%{_joueur}%} parsed as offline player)
					if {ttt::%{_nomjoueur}%} is not set:
						if "%{ttt::duel::%{_nomjoueur}%::*}%" does not contain "%{_p}%":
							set {_t2} to ttt_traduc("tttinvite", {_p})
							make {_p} execute "/%{ttt::prefixcoffre}% %{_t2}% %{_nomjoueur}%" #invite
							if inventory name of current inventory of {_nomjoueur} contain "%{ttt::prefixcoffre}% %{_Liste}%":
								ttt_affichegui({_p}, {_page})	
							if inventory name of current inventory of {_nomjoueur} contain "%{ttt::prefixcoffre}% %{_voir}%":
								ttt_voirduels({_nomjoueur})
							ttt_affichegui({_p}, {_page})
						else:
							set {_t2} to ttt_traduc("tttclear", {_p})
							make {_p} execute "/%{ttt::prefixcoffre}% %{_t2}% %{_nomjoueur}%" # efface
							if inventory name of current inventory of {_nomjoueur} contain "%{ttt::prefixcoffre}% %{_Liste}%":
								make {_nomjoueur} execute "/%{ttt::prefixcoffre}%"
							if inventory name of current inventory of {_nomjoueur} contain "%{ttt::prefixcoffre}% %{_voir}%":
								ttt_voirduels({_nomjoueur})
							make {_p} execute "/%{ttt::prefixcoffre}%" # vt %{_qte}% %{_page}%"	
					else:
						set {_t2} to ttt_traduc("tttspectate", {_p})
						make {_p} execute "/%{ttt::prefixcoffre}% %{_t2}% %{_nomjoueur}%" # spectate
			else:
				if {_page} is set:
					if {_slot} = 36 or 44:
						if {_slot} = 36:
							if {_page} = 1:
								close {_p}'s inventory
							else:
								remove 1 from {_page}
								if {_page} < 1:
									set {_page} to 1 
								ttt_affichegui(player, {_page})	
									
						else if {_slot} = 44:
							if {_page} < {_maxpage}:
								add 1 to {_page}
								if {_page} > {_maxpage}:
									set {_page} to {_maxpage}
								ttt_affichegui(player, {_page})			
					else if {_slot} = 38:# duels
						ttt_voirduels({_p})
					else if {_slot} = 40:# parametrage
						ttt_setup({_p})
		else if inventory name of current inventory of {_p} contains "%{_case}%":
			set {_ttt::coul} to {_slot}-8
			set {ttt::matcas} to {ttt::coul::%{_ttt::coul}%}
			ttt_setup({_p})
		else if inventory name of current inventory of {_p} contains "%{_plateau}%":
			set {_ttt::coul} to {_slot}-8
			set {ttt::matpla} to {ttt::coul::%{_ttt::coul}%}
			ttt_setup({_p})
		else if inventory name of current inventory of {_p} contains "%{_p}%":
			set {_l::*} to uncolored name of clicked inventory split by " "
			set {_partie} to {_l::2}
			if event-item is ("%{ttt::matcas}% glass pane" parsed as item):
				ttt_toggle({_p}, {_slot}, {ttt::%{_p}%})  # joueur=partie slot partie
		else if inventory name of current inventory of {_p} contains "%{_son}%":
			if {ttt::son::%{_p}%} is not set:
				set {ttt::son::%{_p}%} to true
			if {_slot} = 0:	
				if click type is left mouse button:#gauche
					set {ttt::son::%{_p}%} to false
				else if click type is right mouse button:#droite
					set {ttt::son::%{_p}%} to true
				ttt_setup({_p})	
		else if inventory name of current inventory of {_p} contains "%{_pion}%":
			if {_slot} = 11 or 12 or 13 or 14:
				set {_choix::*} to "wool block", "glass block", "glass pane" and "banner item"
				set {_index} to {_slot} - 10
				set {ttt::mat::%{_p}%} to {_choix::%{_index}%}
				ttt_setup({_p})
		else if inventory name of current inventory of {_p} contains "%{_langue}%":
			if {_slot} = 15:
				set {ttt::lang::%{_p}%} to "EN"
				send ttt_traduc("choiceL", {_p}) to {_p}
			else if {_slot} = 17:
				set {ttt::lang::%{_p}%} to "FR"
				send ttt_traduc("choiceL", {_p}) to {_p}
			ttt_setup({_p})	
		else if inventory name of current inventory of {_p} contains "%{_param}%":
			if {_slot} = 0:
				if click type is left mouse button:#gauche
					set {ttt::son::%{_p}%} to false
				else if click type is right mouse button:#droite
					set {ttt::son::%{_p}%} to true
				ttt_setup({_p})	
			else if {_slot} = 2:
				ttt_changepion({_p})
			else if {_slot} = 4:	
				ttt_changeplateau({_p})
			else if {_slot} = 6:	
				ttt_changecasejeu({_p})
			else if {_slot} = 8:
				ttt_choixlangue({_p})

function ttt_affichegui(p: player, page: integer):
	if size of {ttt::joueurs::*} is not set:
		tttrecreeliste()	
	set {slot} to 0
	set {_maxpage} to round up (size of {ttt::joueurs::*} / 36)
	set {_t2} to ttt_traduc("menu2", {_p})# Liste des Joueurs
	set {_named} to "%{ttt::prefixcoffre}% %{_t2}% : Page %{_page}%/%{_maxpage}%"
	open chest inventory with 5 rows named "{@tttcolor.name}%{_named}%" to {_p}
	if {_page} is not 1:
		set {_mat} to {_p}'s skull with nbt {arrowG} named ttt_traduc("gui2", {_p})# précedent
	else:
		set {_mat} to {_p}'s skull with nbt {close} named ttt_traduc("gui1", {_p})# fermer
	set slot 36 of {_p}'s current inventory to {_mat} 
	set {_mat} to {_p}'s skull with nbt {param} named ttt_traduc("253", {_p}) 
	set slot 40 of {_p}'s current inventory to {_mat} 
#--------------------------------------
# Affiche les duels dans gui principal
#-------------------------------------- 
	if size of {ttt::duel::%{_p}%::*} is greater than 0:	
		set {_mat2} to "%size of {ttt::duel::%{_p}%::*}% diamond sword" parsed as item named ttt_traduc("210", {_p})
		set slot 38 of {_p}'s current inventory to {_mat2} 
	set {_mat3} to {_p}'s skull with nbt {arrowD} named ttt_traduc("gui3", {_p})# suivant
	if {_page} = {_maxpage}:
		set {_mat3} to "air" parsed as item #named " "
	set slot 44 of {_p}'s current inventory to {_mat3} 
#-------------------------
# Affichage des joueurs 
#-------------------------
	clear {listj::*}
	if size of {ttt::joueurs::*} > 36:
		loop integers from ({_page} * 36) + 1 to ({_page} * 36) + 36:
			add {ttt::joueurs::%loop-integer%} to {listj::*}
	else:
		set {listj::*} to {ttt::joueurs::*}
	set {_lore::*} to " "
	clear {_lore::*}
	set {listj::*} to alphabetically sorted {listj::*}
	loop {listj::*}:
		clear {_lore::*}
		set {_value} to loop-value parsed as offlineplayer
		if {_value} is online:
			if {ttt::duel::%{_value}%::*} is set:
				loop {ttt::duel::%{_value}%::*}:
					set {_t2} to ttt_traduc("inv1", {_p})
					add "{@tttcolor.text}%{_t2}% %loop-value-2%" to {_lore::*}  # invité par
			if "%{ttt::duel::%{_value}%::*}%" does not contain "%{_p}%":
				if {ttt::%{_value}%} is not set:
					if {_value} is not {_p}:
						set {_t2} to ttt_traduc("inv2", {_p})
						add "{@tttcolor.text}%{_t2}%" to {_lore::*}    # clic pour inviter
			else:
				if {ttt::%loop-value%} is not set:
					set {_t3} to ttt_traduc("inv3-l2", {_p})
					add "{@tttcolor.text}%{_t3}%" to {_lore::*} # clic pour supprimer l'invitation
					
			if {ttt::%{_value}%} is set:
				set {_t2} to ttt_traduc("inv4", {_p})
				add "{@tttcolor.text}%{_t2}% ", "{@tttcolor.text}%{ttt::%{_value}%}%", and "{@tttcolor.text}%{_t2}%" to {_lore::*} # duel en cours et clic droit pour voir la partie
			set {_mat} to {ttt::skull::%{_value}%}
		else:
			set {_mat} to skull of {_value}
			add "&4Offline" to {_lore::*}
		set {_t2} to ttt_traduc("239", {_p})
		if {_value} is {_p}:
			set {_mat} to {_p}'s skull with nbt {smiley} 
			set {_t2} to ""
		set slot {slot} of {_p}'s current inventory to {_mat} named "{@tttcolor.name}%{_t2}% %loop-value%" with lore {_lore::*} 		
		add 1 to {slot}

on join:
	tttrecreeliste()

on quit:  	
	loop all players:
		if "%{ttt::duel::%loop-value%::*}%" contain "%event-player%":
			remove event-player from {ttt::duel::%loop-value%::*}
	wait 1 tick
	tttrecreeliste()