@name FailCake Expressware V1 Main
@inputs EGP:wirelink
@persist PlayerList:array GTABLE:gtable O:entity
@persist Chat:array Center:entity Start Find Music:array
@trigger all

interval(100)

if(first() | duped())
{
runOnChat(1)
    
GTABLE = gTable("expressware",2) 
GTABLE:clear()

O = owner() 

Music:pushString("/ui/gamestartup13.mp3")
Music:pushString("/ui/gamestartup12.mp3")
Music:pushString("/ui/gamestartup13.mp3")
Music:pushString("/ui/gamestartup8.mp3")
Music:pushString("/ui/gamestartup9.mp3")

}

if(chatClk(O)){
Chat = O:lastSaid():explode(" ")

if(Chat[1,string] == "-find" & Find == 0){
Find = 1 
hint("* Searching for Players *",7) 
GTABLE["Find",number] = 1 
}
    
if(Chat[1,string] == "-start" & Start == 0){
GTABLE["Find",number] = 0
GTABLE["Send",number] = 1
PlayerList = GTABLE["playerlist",array] # Recive the PlayerList    
    
timer("Wait",1000)
}        
}

if(clk("Wait")){
    
if(PlayerList:count() >= 1){
Start = 1 
hint("* New Round Starting *",7) 
GTABLE["Find",number] = 1 
}else{
hint("* Insuficient Players! *",7) 
}
    
}



if(Start == 1){
#Start = 1 is the preparing round!
    
#SendMusics and Play One
GTABLE["Musics",array] = Music
GTABLE["Music",number] = 1
   
}
