The Hated Astronaut

Number of posts: 181 Age: 17 Location: In a cave, plotting to bomb you. Registration date: 2008-06-22
 | Subject: Tournament Script Thu Jul 03, 2008 12:09 pm | |
| Event -NewMessage If $Message == "script Check: OK!" /set $Tourney, "" /set $Battles, "" /set #Entrants, 0 Endif Endevent
Event -ChatMessage If #IsIn($Message,"/") = 1 /StopEvent EndIf If $Message = "/StopTourney" AND #GetPlayerInfo(#Source, AUTH) = 2 If $Tourney <> "" OR $Battles <> "" /SendAll "*** The tourney have been stopped!! ***" EndIf /Set $Tourney, "" /Set $Battles, "" /SendPM #Source, "The tourney have been stopped!" EndIf
If #IsIn($Message, "/Signoff ") = 1 AND #GetPlayerInfo(#Source, AUTH) = 2 /Set $Val, $Right($Message, #Len($Message) - 9) If #IsIn($Tourney, "/" & $Val & "/") + #IsIn($Battles, "=" & $Val & "=") = 0 /SendPM #Source, "That person is not in the tourney." /Exit EndIf /SendAll "+Tourney: " & $Val & " has been signed off the tourney!!" /Set $Tourney, $Replace($Tourney, "/" & $Right("00" & $Str(#PNumber($Val)), 3) & "/", "") /Set $Tourney, $Replace($Tourney, "=" & $Val & "=", "") If #IsIn($Battles, "=" & $Val & "=") = 0 /Exit EndIf If #IsIn($Battles, "|=" & $Val & "=") > 0 /Set $Var, $Right($Battles, #Len($Battles) - #IsIn($Battles, "|=" & $Val & "=") - 3 - #Len($Val) /Set $Var, $Left($Var, #IsIn($Var, "|") - 1) Else /Set $Var, $Left($Battles, #IsIn($Battles, "==" & $Val & "=|") - 1) :TsignPp /Set $Var, $Right($Var, #Len($Var) - #IsIn($Var, "|=") - 1) If #IsIn($Var, "=") > 0 GoTo Tsignp EndIf EndIf /Set $Battles, $Replace($Battles, "=" & $Val & "=", "") /SendAll "+Tourney: " & $Var & " has no more opponent!" /Set $Battles, $Replace($Battles, "=" & $Var & "=", "") If #IsIn($Battles, "=") > 0 /Exit EndIf /Set $Battles, "" If $Tourney = "=" & $Var & "=" /SendAll "*** ATTENTION ***" & $chr(13) & " " /SendAll "+Tourney: " & $Var & " is the winner of the tourney!!!" & $chr(13) & " " /Set $Tourney, "" /Exit EndIf GoTo Tloop EndIf
If #IsIn($Message, "/tourney ") = 1 If #GetPlayerInfo(#Source, AUTH) < 2 /SendPM #Source, "You can't use it! Only admins can." /Exit EndIf If $Tourney <> "" /SendPM #Source, "A tourney is already going on. Say /StopTourney to stop it" /Exit EndIf If #IsIn($Message, "/tourney ") = 0 /SendPM #Source, "You must say the number entrants you want: ex -- /tourney 16" /Exit EndIf /Set #Entrants, #Val($Right($Message, #Len($Message) - 9)) If #Entrants < 3 OR #Entrants > 255 /SendPM #Source, "You must have 255 or less players, or 3 or more players!" /Exit EndIf /Set $Battles, "" /SendPM #Source, "To stop the tourney say /StopTourney" /SendPM #Source, "To sign a player off the tourney say /Signoff player: ex -- /Signoff coyotte508" /Sendall "*** A tourney with " & $Str(#Entrants) & " players started! Say /join to join." /SendAll "*** Rules:" & $chr(13) & "- No ubers" & $Chr(13) & "- No more than two legends" & "- No two or more same pokemons in your team." /Set $Tourney, "||" /Exit EndIf
If $Message = "/Join" If $Tourney = "" /SendPM #Source, "There is no tourney." /Exit EndIf If #IsIn($Tourney, "/" & $Right("00" & $Str(#Source), 3) & "/") > 0 OR #IsIn($Tourney, "=" & $Name(#Source) & "=") > 0 /SendPM #Source, "You already are in the tourney." /Exit EndIf If #IsIn($Tourney, "|") = 0 /SendPM #Source, "There is no more room left for you!" /Exit EndIf If #GetPlayerInfo(#Source, "BWTH") <> 0 /SendPM #Source, "You must not be battling!" /Exit EndIf /Set $Tourney, $Tourney & "/" & $Right("00" & $Str(#Source), 3) & "/" /Inc #Entrants, -1 /SendAll "*** " & $Name(#Source) & " joined the tourney!" If #Entrants > 0 /SendAll "+Tourney: " & $str(#Entrants) & " spot(s) left." /SendPM #Source, "###: To sign off the tourney, log off." /Exit Else /Set $Tourney, $Replace($Tourney, "/", "") /Set $Var, $Right($Tourney, #Len($Tourney) - #IsIn($Tourney, "|") - 1) :checkonloop If $Var <> "" /Set $Tourney, "=" & $Name(#Val($Left($Var, 3))) & "=" & $Tourney /Set $Var, $Right($Var, #Len($Var) - 3) GoTo CheckOnLoop EndIf /Set $Tourney, $Left($Tourney, #IsIn($Tourney, "|") - 1) /SendAll "+Tourney: Inscriptions closed!" :Tloop /Set $Var, $Tourney /SendAll "--------------------" /Set #Entrants, (#Len($Var) - #Len($Replace($Var, "=", "")))/2 If #Entrants = 1 /SendAll "*** " & $Replace($Tourney, "=", "") & " is automatically selected for next round!" /SendAll "*** Now Everyone is listed, lets battle!" /Exit EndIf /Set #X, #Rand(#Entrants, 1) :Tltwop /Set #Y, #Rand(#Entrants, 1) If #X = #Y GoTo Tltwop EndIf /Set #Entrants, 1 :Tlthreep /Set $Var,$Right($Var, #Len($Var) - 1) If #X = #Entrants OR #Y = #Entrants If #X * #Y = 0 /Set $Battles, $Battles & "=" & $Left($Var, #IsIn($Var, "=") - 1) & "=|" /SendAll "vs" Else /Set $Battles, $Battles & "|=" & $Left($Var, #IsIn($Var, "=") - 1) & "=" EndIf /SendAll "###:" & $Left($Var, #IsIn($Var, "=") - 1) /Set $Tourney, $Replace($Tourney, "=" & $Left($Var, #IsIn($Var, "=") - 1) & "=", "") If #X = #Entrants /Set #X, 0 Else /Set #Y, 0 EndIf EndIf /Inc #Entrants /Set $Var, $Right($Var, #Len($Var) - #IsIn($Var, "=")) If #X + #Y > 0 GoTo Tlthreep EndIf If $Tourney <> "" GoTo Tloop EndIf /SendAll "--------------------" /SendAll "*** Ok Now everyone is listed!" EndIf EndIf EndEvent
Event -PlayerSignOff If #IsIn($Tourney, "/" & $Right("00" & $Str(#Source), 3) & "/") > 0 /Set $Tourney, $Replace($Tourney, "/" & $Right("00" & $Str(#Source), 3) & "/", "") /SendAll "*** " & $Name(#Source) & " left the signup list by signing off." /Inc #Entrants /SendAll "+Tourney: " & $Str(#Entrants) & " spots left." EndIf EndEvent
Event -ChallengeIssued If #IsIn($Tourney, "=" & $Name(#Source) & "=") > 0 /SendPM #Source, "As you are in the tourney, you can't challenge anyone until pairings have been done for you!" /StopEvent /Exit EndIf If #IsIn($Battles, "=" & $Name(#Source) & "=") > 0 If #IsIn($Battles, "|=" & $Name(#Source) & "=") > 0 /Set $Var, $Right($Battles, #Len($Battles) - #IsIn($Battles, "|=" & $Name(#Source) & "=") - 3 - #Len($Name(#Source))) /Set $Var, $Left($Var, #IsIn($Var, "|") - 2) If $Name(#Target) <> $Var /SendPM #Source, "###: You must challenge " & $Var & "!" /StopEvent /Exit EndIf Else /Set $Var, $Left($Battles, #IsIn($Battles, "==" & $Name(#Source) & "=|") - 1) :Tloop /Set $Var, $Right($Var, #Len($Var) - #IsIn($Var, "|=") - 1) If #IsIn($Var, "=") > 0 GoTo Tloop EndIf If $Name(#Target) <> $Var /SendPM #Source, "###: You must challenge " & $Var & "!" /StopEvent /Exit EndIf EndIf If #GetTeamPoke(#Source, 1) = #GetTeamPoke(#Source, 2) OR #GetTeamPoke(#Source, 1) = #GetTeamPoke(#Source, 3) OR #GetTeamPoke(#Source, 1) = #GetTeamPoke(#Source, 4) OR #GetTeamPoke(#Source, 1) = #GetTeamPoke(#Source, 5) OR #GetTeamPoke(#Source, 1) = #GetTeamPoke(#Source, 6) OR #GetTeamPoke(#Source, 2) = #GetTeamPoke(#Source, 3) OR #GetTeamPoke(#Source, 2) = #GetTeamPoke(#Source, 4) OR #GetTeamPoke(#Source, 2) = #GetTeamPoke(#Source, 5) OR #GetTeamPoke(#Source, 2) = #GetTeamPoke(#Source, 6) OR #GetTeamPoke(#Source, 3) = #GetTeamPoke(#Source, 4) OR #GetTeamPoke(#Source, 3) = #GetTeamPoke(#Source, 5) OR #GetTeamPoke(#Source, 3) = #GetTeamPoke(#Source, 6) OR #GetTeamPoke(#Source, 4) = #GetTeamPoke(#Source, 5) OR #GetTeamPoke(#Source, 4) = #GetTeamPoke(#Source, 6) OR #GetTeamPoke(#Source, 5) = #GetTeamPoke(#Source, 6) /SendPM #Source, "You must not have two pokemons that are the same." /StopEvent /Exit EndIf If #GetTeamPoke(#Target, 1) = #GetTeamPoke(#Target, 2) OR #GetTeamPoke(#Target, 1) = #GetTeamPoke(#Target, 3) OR #GetTeamPoke(#Target, 1) = #GetTeamPoke(#Target, 4) OR #GetTeamPoke(#Target, 1) = #GetTeamPoke(#Target, 5) OR #GetTeamPoke(#Target, 1) = #GetTeamPoke(#Target, 6) OR #GetTeamPoke(#Target, 2) = #GetTeamPoke(#Target, 3) OR #GetTeamPoke(#Target, 2) = #GetTeamPoke(#Target, 4) OR #GetTeamPoke(#Target, 2) = #GetTeamPoke(#Target, 5) OR #GetTeamPoke(#Target, 2) = #GetTeamPoke(#Target, 6) OR #GetTeamPoke(#Target, 3) = #GetTeamPoke(#Target, 4) OR #GetTeamPoke(#Target, 3) = #GetTeamPoke(#Target, 5) OR #GetTeamPoke(#Target, 3) = #GetTeamPoke(#Target, 6) OR #GetTeamPoke(#Target, 4) = #GetTeamPoke(#Target, 5) OR #GetTeamPoke(#Target, 4) = #GetTeamPoke(#Target, 6) OR #GetTeamPoke(#Target, 5) = #GetTeamPoke(#Target, 6) /SendPM #Source, "Your opponent must not have two pokemons that are the same." /StopEvent /Exit EndIf If #HasPoKe(#Target, 150) = 1 OR #HasPoKe(#Target, 151) = 1 OR #HasPoKe(#Target, 249) = 1 OR #HasPoKe(#Target, 250) = 1 OR #HasPoKe(#Target, 380) = 1 OR #HasPoKe(#Target, 381) = 1 OR #HasPoKe(#Target, 382) = 1 OR #HasPoKe(#Target, 383) = 1 OR #HasPoKe(#Target, 384) = 1 OR #HasPoKe(#Target, 386) = 1 /SendPM #Source, "Your opponent must not have ubers." /StopEvent /Exit EndIf If #HasPoKe(#Source, 150) = 1 OR #HasPoKe(#Source, 151) = 1 OR #HasPoKe(#Source, 249) = 1 OR #HasPoKe(#Source, 250) = 1 OR #HasPoKe(#Source, 380) = 1 OR #HasPoKe(#Source, 381) = 1 OR #HasPoKe(#Source, 382) = 1 OR #HasPoKe(#Source, 383) = 1 OR #HasPoKe(#Source, 384) = 1 OR #HasPoKe(#Source, 386) = 1 /SendPM #Source, "You must not have ubers." /StopEvent /Exit EndIf If #HasPoke(#Source, 144) + #HasPoke(#Source, 145) + #HasPoke(#Source, 146) + #HasPoke(#Source, 145) + #HasPoke(#Source, 243) + #HasPoke(#Source, 244) + #HasPoke(#Source, 245) + #HasPoke(#Source, 145) + #HasPoke(#Source, 251) + #HasPoke(#Source, 377) + #HasPoke(#Source, 378) + #HasPoke(#Source, 379) + #HasPoke(#Source, 385) > 2 /SendPM #Source, "You must have 2 legends max." /StopEvent /Exit EndIf If #HasPoke(#Target, 144) + #HasPoke(#Target, 145) + #HasPoke(#Target, 146) + #HasPoke(#Target, 145) + #HasPoke(#Target, 243) + #HasPoke(#Target, 244) + #HasPoke(#Target, 245) + #HasPoke(#Target, 145) + #HasPoke(#Target, 251) + #HasPoke(#Target, 377) + #HasPoke(#Target, 378) + #HasPoke(#Target, 379) + #HasPoke(#Target, 385) > 2 /SendPM #Source, "Your opponent must have 2 legends max." /StopEvent /Exit EndIf Else If #IsIn($Battles, "=" & $Name(#Target) & "=") > 0 /SendPM #Source, "Your opponent is in the tourney and not you, so don't challenge him!" /StopEvent /Exit EndIf EndIf EndEvent
Event -BattleOver
If #IsIn($Battles, "=" & $Name(#Source) & "=") * #IsIn($Battles, "=" & $Name(#Target) & "=") > 0 If $Left($Message, 3) = "TIE" /SendAll "+Tourney: As the battle of " & $Name(#Source) & " and " & $Name(#Target) & " ended in a tie, they must rematch!" /Exit EndIf /Set $Battles, $Replace($Replace($Battles, "=" & $Name(#Source) & "=", ""), "=" & $Name(#Target) & "=", "") /Set $Tourney, $Tourney & "=" & $Name(#Source) & "=" /SendAll "+Tourney: " & $Name(#Source) & " has won! He continues the tourney but " & $Name(#Target) & " is out!" If #IsIn($Battles, "=") > 0 /Exit EndIf /Set $Battles, "" If $Tourney = "=" & $Name(#Source) & "=" /Set $Tourney, "" /SendAll "*** ATTENTION ***" & $chr(13) & " " /SendAll "+Tourney : " & $Name(#Source) & " is the winner of the tourney!!" & $chr(13) & " " /SendAll "*** /ATTE?T!ON ***" /Exit EndIf /SendAll "*** All the battles of the current round have been finished!! ***" & $Chr(13) & $Chr(13) & " -- Pairings ... --" :Tloop /Set $Var, $Tourney /SendAll "--------------------" /Set #Entrants, (#Len($Var) - #Len($Replace($Var, "=", "")))/2 If #Entrants = 1 /SendAll "*** " & $Replace($Tourney, "=", "") & " is automatically selected for next round!" /SendAll "*** Now Everyone is listed, lets battle!" /Exit EndIf /Set #X, #Rand(#Entrants, 1) :Tltwop /Set #Y, #Rand(#Entrants, 1) If #X = #Y GoTo Tltwop EndIf /Set #Entrants, 1 :Tlthreep /Set $Var,$Right($Var, #Len($Var) - 1) If #X = #Entrants OR #Y = #Entrants If #X * #Y = 0 /Set $Battles, $Battles & "=" & $Left($Var, #IsIn($Var, "=") - 1) & "=|" /SendAll "vs" Else /Set $Battles, $Battles & "|=" & $Left($Var, #IsIn($Var, "=") - 1) & "=" EndIf /SendAll "###:" & $Left($Var, #IsIn($Var, "=") - 1) /Set $Tourney, $Replace($Tourney, "=" & $Left($Var, #IsIn($Var, "=") - 1) & "=", "") If #X = #Entrants /Set #X, 0 Else /Set #Y, 0 EndIf EndIf /Inc #Entrants /Set $Var, $Right($Var, #Len($Var) - #IsIn($Var, "=")) If #X + #Y > 0 GoTo Tlthreep EndIf If $Tourney <> "" GoTo Tloop EndIf /SendAll "--------------------" /SendAll "*** Ok Now everyone is listed!" EndIf EndEvent
|
|