SpikeL Comunidad
Hola, bienvenido a SpikeL Foro.

Si eres nuevo, deves registrarte.

Si ya tienes una cuenta, deves ingresar.

¡Muchas gracias!

PD: Si te has registrado pero no puedes logear tienes que activar tu cuenta desde tu e-mail.


Unirse al foro, es rápido y fácil

SpikeL Comunidad
Hola, bienvenido a SpikeL Foro.

Si eres nuevo, deves registrarte.

Si ya tienes una cuenta, deves ingresar.

¡Muchas gracias!

PD: Si te has registrado pero no puedes logear tienes que activar tu cuenta desde tu e-mail.
SpikeL Comunidad
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

Sistema de torneo automatico

Ir abajo

Sistema de torneo automatico Empty Sistema de torneo automatico

Mensaje por santi55 Lun Ene 03, 2011 3:10 pm

Funcion : Hace todo automatico.
Paso1: Cuando se llena el cupo manda a los usuarios a la sala de espera.
Paso2: Los envia a los rings : 2 a 1 y 2 a 2
Paso3: Muere usuario en Torneo automatico Entonces informa quien es el ganador de X ring y envia al ganador DE x RING A LA final.
Paso4: Muere en final entonces le otroga putnos y restea flags.

Aca vamos

Todo en servidor.

Buscamos:



Código:
Case "#Y"



y abajo del exit sub
end if Ponemos:

Código:
'

TORNEOS AUTOMATICOs
       
        Case "#Z"
 
Dim CantMaxTor As String
 
If UserList(UserIndex).flags.Muerto = 1 Then
Call SendData(ToIndex, UserIndex, 0, "||Estas Muerto" & FONTTYPE_FENIX)
Exit Sub
End If
 
If UserList(UserIndex).flags.EnRetoAutomatico = 1 Then
Call SendData(ToIndex, UserIndex, 0, "||Ya estas en torneo" & FONTTYPE_FENIX)
Exit Sub
End If
 
If AutoTOn = False Then
Call SendData(ToIndex, UserIndex, 0, "||Los torneos se realizan cada 30 Minutos !!" & FONTTYPE_FENIX)
Exit Sub
End If
 
If CupoLLeno = True Then
Call SendData(ToIndex, UserIndex, 0, "||Ya hay cupo lleno" & FONTTYPE_FENIX)
Exit Sub
End If
 
'CARGA NUM DE PARTICIPANTE
 
Open App.Path & "\TA" & "Ta.txt" For Input As #1
 
Do While Not EOF(1)
 
Line Input #1, CantMaxTor
 
Loop
 
Close #1
 
CantMaxTor = CantMaxTor + 1
 
 
'GUARDA NUM DE PARTICIPANTE
Open App.Path & "\TA" & "Ta.txt" For Output As #1
 
Print #1, CantMaxTor
 
Close #1
 
 
Call SendData(ToIndex, UserIndex, 0, "||Eres el Participante " & CantMaxTor & FONTTYPE_FENIX)
 
 
If CantMaxTor = "1" Then
 
TorneosAut.Pj = UserIndex
UserList(TorneosAut.Pj).flags.EnRetoAutomatico = 1
UserList(TorneosAut.Pj).flags.Ring = 1
UserList(TorneosAut.Pj).flags.TipoTA = "Semi"
Call WarpUserChar(TorneosAut.Pj, 191, 48, 78, True)
 
Exit Sub
End If
 
If CantMaxTor = "2" Then
 
TorneosAut.Pj2 = UserIndex
UserList(TorneosAut.Pj2).flags.EnRetoAutomatico = 1
UserList(TorneosAut.Pj2).flags.Ring = 1
UserList(TorneosAut.Pj2).flags.TipoTA = "Semi"
Call WarpUserChar(TorneosAut.Pj2, 191, 54, 78, True)
 
Exit Sub
End If
 
If CantMaxTor = "3" Then
 
TorneosAut.Pj3 = UserIndex
UserList(TorneosAut.Pj3).flags.TipoTA = "Semi"
UserList(TorneosAut.Pj3).flags.EnRetoAutomatico = 1
UserList(TorneosAut.Pj3).flags.Ring = 2
Call WarpUserChar(TorneosAut.Pj3, 191, 58, 78, True)
 
Exit Sub
End If
 
If CantMaxTor = "4" Then
 
TorneosAut.Pj4 = UserIndex
UserList(TorneosAut.Pj4).flags.Ring = 2
UserList(TorneosAut.Pj4).flags.EnRetoAutomatico = 1
UserList(TorneosAut.Pj4).flags.TipoTA = "Semi"
Call WarpUserChar(TorneosAut.Pj4, 191, 55, 81, True)
 
Call SendData(ToAll, 0, 0, "||Cupos Llenos - Torneos Automaticos" & FONTTYPE_FENIX)
Call WriteVar(App.Path & "\TA" & "Pasos.txt", "Datos", "Paso1", "4 Usuarios Mandados a la final : Listo")
 
frmMain.t_LLevart.Enabled = True
CupoLLeno = True
Exit Sub
End If
 
Exit Sub
 
'TORNEOS AUTOMATICOS



Ahora en el frmMain del server Creamos Dos Timers :

Código:
Uno llamado T_AutomaticT

Y dentro ponemos:



Código:
'SISTEMA DE TORNEO AUTOMATICO
 
MinutosTor = MinutosTor + 1
 
Call SendData(ToAll, 0, 0, "||" & MinutosTor & "/" & "15 " & "Para torneos Automaticos" & FONTTYPE_FENIX)
 
If MinutosTor = 15 Then
AutoTOn = True
Call SendData(ToAll, 0, 0, "||Se activaron los torneos automaticos. Tienen 60 Segundos, Para enviar /AUTOT" & FONTTYPE_FENIX)
End If
 
If MinutosTor = 16 And Not CupoLLeno = True Then
Call SendData(ToAll, 0, 0, "||Se Cancelo el torneo Automatico debido a que no se llenaron las inscripciones" & FONTTYPE_FENIX)
MinutosTor = 1
AutoTOn = False
ElseIf CupoLLeno = True Then
t_AutomaticT.Enabled = False
End If
 
'SISTEMA DE TORNEO AUTOMATICO



y el otro llamado : t_Llevart y dentro ponemos:



Código:
Call FlagsUserTorneo
 
'SISTEMA DE DUELOS AUTOMATICOS
 
Call WarpUserChar(TorneosAut.Pj, 190, 65, 12, True)
Call WarpUserChar(TorneosAut.Pj2, 190, 87, 25, True)
Call WarpUserChar(TorneosAut.Pj3, 190, 65, 72, True)
Call WarpUserChar(TorneosAut.Pj4, 190, 87, 85, True)
t_LLevart.Enabled = False
 
Call SendData(ToAll, 0, 0, "||En Ring 1 de torneo Duelean " & UserList(TorneosAut.Pj).Name & " vs " & UserList(TorneosAut.Pj2).Name & FONTTYPE_FENIX)
Call SendData(ToAll, 0, 0, "||En Ring 2 de torneo Duelean " & UserList(TorneosAut.Pj3).Name & " vs " & UserList(TorneosAut.Pj4).Name & FONTTYPE_FENIX)
 
Call WriteVar(App.Path & "\TA" & "Pasos.txt", "Datos", "Paso2", "4 uSUARIOS Mandados a rings : Listo")
 
 
'SISTEMA DE DUELOS AUTOMATICOS



Ahora vamos a declaraciones y debajo de option explicit ponemos:



Código:
'SISTEMA DE TORNEOS AUTOMATICOS
 
Public EsFinal As Boolean
Public EsSemiFinal As Boolean
 
Public MinutosTor As Byte
 
Public GanadorR1 As Integer
Public GanadorR2 As Integer
Public AutoTOn As Boolean
Public CupoLLeno As Boolean
 
Type T_TorneosAu
Pj As Integer
Pj2 As Integer
Pj3 As Integer
Pj4 As Integer
End Type
Public TorneosAut As T_TorneosAu
 
 
'SISTEMA DE TORNEOS AUTOMATICOS



Ahora buscamos:



Código:
Type UserFlags



y debajo ponemos:



Código:
'SISTEMA DE TORNEOS AUTOMATICOS
Ring As Integer
Contrincante As Integer
NombreContr As String
TipoTA As String
EnRetoAutomatico As Integer
 
'SISTEMA DE TORNEOAS AUTOMATICOS



Ahora en el Modulo de declaraciones abajo de todo todo Ponemos:



Código:
Sub FlagsUserTorneo()
 'FLAGS DEL USUARIO
 
UserList(TorneosAut.Pj).flags.Contrincante = TorneosAut.Pj2
UserList(TorneosAut.Pj2).flags.Contrincante = TorneosAut.Pj
UserList(TorneosAut.Pj3).flags.Contrincante = TorneosAut.Pj4
UserList(TorneosAut.Pj4).flags.Contrincante = TorneosAut.Pj3
 
UserList(TorneosAut.Pj).flags.NombreContr = UserList(TorneosAut.Pj2).Name
UserList(TorneosAut.Pj2).flags.NombreContr = UserList(TorneosAut.Pj).Name
UserList(TorneosAut.Pj3).flags.NombreContr = UserList(TorneosAut.Pj4).Name
UserList(TorneosAut.Pj4).flags.NombreContr = UserList(TorneosAut.Pj3).Name
 
'FLAGS DE USUARIO
 End Sub
 
 Sub RsetFlagsPorOut(i As Integer)
 
UserList(i).flags.EnRetoAutomatico = 0
 UserList(i).flags.Ring = 0
 UserList(i).flags.Contrincante = 0
 UserList(i).flags.TipoTA = ""
 UserList(i).flags.NombreContr = ""
 
 End Sub



Ahora en el sub CloseSocket :

abajo de :



Código:
Call aDos.RestarConexion(UserList(UserIndex).ip)



Ponemos:



Código:
'###############################SISTEMA DE TORNEOS AUTOMATICOS
 
If UserList(UserIndex).flags.EnRetoAutomatico = 1 Then
Call SendData(ToAll, 0, 0, "||Sesupende el sistema de torneos automaticos debido a que un usuario del torneo se desconecto" & FONTTYPE_FENIX)
Call WarpUserChar(TorneosAut.Pj, 1, 51, 50, True)
Call WarpUserChar(TorneosAut.Pj2, 1, 52, 50, True)
Call WarpUserChar(TorneosAut.Pj3, 1, 53, 50, True)
Call WarpUserChar(TorneosAut.Pj4, 1, 54, 50, True)
 
MinutosTor = 0
 
frmMain.t_AutomaticT.Enabled = True
 
Call RsetFlagsPorOut(TorneosAut.Pj)
Call RsetFlagsPorOut(TorneosAut.Pj2)
Call RsetFlagsPorOut(TorneosAut.Pj3)
Call RsetFlagsPorOut(TorneosAut.Pj4)
 
End If
 
'###############################SISTEMA DE TORNEOS AUTOMATICOS



Ahora en el sub UserDie Buscamos:



Código:
For i = 1 To MAXMASCOTAS - 17 * Buleano(Not UserList(UserIndex).flags.Quest)
    If UserList(UserIndex).MascotasIndex(i) Then
          If Npclist(UserList(UserIndex).MascotasIndex(i)).Contadores.TiempoExistencia Then
                Call MuereNpc(UserList(UserIndex).MascotasIndex(i), 0)
          Else
                Npclist(UserList(UserIndex).MascotasIndex(i)).MaestroUser = 0
                Npclist(UserList(UserIndex).MascotasIndex(i)).Movement = Npclist(UserList(UserIndex).MascotasIndex(i)).flags.OldMovement
                Npclist(UserList(UserIndex).MascotasIndex(i)).Hostile = Npclist(UserList(UserIndex).MascotasIndex(i)).flags.OldHostil
                UserList(UserIndex).MascotasIndex(i) = 0
                UserList(UserIndex).MascotasType(i) = 0
          End If
    End If
   
Next



Y debajo del next ponemos:



Código:
'-------------------------------------------------------------------------
 
If UserList(UserIndex).POS.Map = 190 Then
  Call SendData(ToIndex, UserIndex, 0, "||Has muerto, seras transportado a Ulla." & FONTTYPE_INFO)
  Call WarpUserChar(UserIndex, 1, 45, 45)
End If
 
'############################################SISTEMA DE TORNEOS AUTOMATICOS
 
If UserList(UserIndex).flags.EnRetoAutomatico = 1 Then
 
Call MandarTA(UserIndex, UserList(UserIndex).flags.Contrincante, UserList(UserIndex).flags.NombreContr, UserList(UserIndex).flags.Ring, UserList(UserIndex).flags.TipoTA)
 
Call WriteVar(App.Path & "\TA" & "Pasos.txt", "Datos", "Paso3", "Murio usuario en torneo automatico y lo manda final : Listo")
 
End If
 
'##################################################SISTEMA DE TORNEO AUTOMATICO
 
 
 
 
'-------------------------------------------------------------------------



Ahora buscamos:



Código:
Sub InicializaEstadisticas()
 
Call EstadisticasWeb.Inicializa(frmMain.hwnd)
Call EstadisticasWeb.Informar(CANTIDAD_MAPAS, NumMaps)
Call EstadisticasWeb.Informar(CANTIDAD_ONLINE, NumUsers)
Call EstadisticasWeb.Informar(UPTIME_SERVER, (TiempoTranscurrido(tInicioServer)) / 1000)
Call EstadisticasWeb.Informar(RECORD_USUARIOS, recordusuarios)
 
End Sub



y debajo del end sub ponemos:



Código:
'SISTEMA DE TORNEOS AUTOMATICOS
 Sub MandarTA(UserIndex As Integer, Cont As Integer, Nombre As String, Ring As Integer, Tipo As String)
 
 Select Case Tipo
 
 Case "Semi"
 
 If Ring = 1 Then
 
 'RESETEA FLAGS
 
 
 ' EL QUE MUERE
 UserList(UserIndex).flags.EnRetoAutomatico = 0
 UserList(UserIndex).flags.Ring = 0
 UserList(UserIndex).flags.Contrincante = 0
 UserList(UserIndex).flags.TipoTA = ""
 UserList(UserIndex).flags.NombreContr = ""
 
 Call SendData(ToAll, 0, 0, "||Ganador del Ring 1 : " & Nombre & FONTTYPE_FENIX)
 
 UserList(Cont).flags.TipoTA = "Final"
 
 Call WarpUserChar(Cont, 211, 32, 78, True)
 Call SendData(ToIndex, Cont, 0, "||Has Pasado a la final" & FONTTYPE_FENIX)
 Call SendData(ToIndex, Cont, 0, "||Si no hay nadie en la otra punta es que no ha terminado el otro Ring . ESpera en tu posicion de la punta!!" & FONTTYPE_FENIX)
 
 Exit Sub
 
 ElseIf Ring = 2 Then
 
 'RESETEA FLAGS
 
 UserList(UserIndex).flags.EnRetoAutomatico = 0
 UserList(UserIndex).flags.Ring = 0
 UserList(UserIndex).flags.Contrincante = 0
 UserList(UserIndex).flags.TipoTA = ""
 UserList(UserIndex).flags.NombreContr = ""
 
 Call SendData(ToAll, 0, 0, "||Ganador del Ring 2 : " & Nombre & FONTTYPE_FENIX)
 
 UserList(Cont).flags.TipoTA = "Final"
 
 Call WarpUserChar(Cont, 211, 49, 89, True)
  Call SendData(ToIndex, Cont, 0, "||Si no hay nadie en la otra punta es que no ha terminado el otro Ring . ESpera en tu posicion de la punta!!" & FONTTYPE_FENIX)
 
 
 Call WriteVar(App.Path & "\TA" & "Pasos.txt", "Datos", "Paso4", "Envia usuario a Final" & FONTTYPE_FENIX)
 
 Exit Sub
 End If
 
 Case "Final"
 
Call SendData(ToAll, 0, 0, "||Ganador del Torneo " & Nombre & FONTTYPE_FENIX)
 
UserList(Cont).flags.Canje = UserList(Cont).flags.Canje + 3
UserList(UserIndex).flags.Canje = UserList(UserIndex).flags.Canje + 1
UserList(Cont).Faccion.Torneos = UserList(Cont).Faccion.Torneos + 1
 
 UserList(Cont).flags.EnRetoAutomatico = 0
 UserList(Cont).flags.Ring = 0
 UserList(Cont).flags.Contrincante = 0
 UserList(Cont).flags.TipoTA = ""
 UserList(Cont).flags.NombreContr = ""
 
  UserList(UserIndex).flags.EnRetoAutomatico = 0
 UserList(UserIndex).flags.Ring = 0
 UserList(UserIndex).flags.Contrincante = 0
 UserList(UserIndex).flags.TipoTA = ""
 UserList(UserIndex).flags.NombreContr = ""
 
 Open App.Path & "\TA" & "Ta.txt" For Output As #1
 
 Print #1, "0"
 
 Close #1
 
 If frmMain.t_AutomaticT.Enabled = False Then
MinutosTor = 0
frmMain.t_AutomaticT.Enabled = True
End If
 
End Select
 
 
 End Sub
 
  'SISTEMA DE TORNEOS AUTOMATICOS



Fin !

Lo unico que les queda es ir al cliente y en el sub ReplaceData Poner



Case "/AUTOT"
ReplaceData = "#z"



saludos!
santi55
santi55
Nivel 12
Nivel 12

Medallas
Sistema de torneo automatico Prensa1

Advertencias Advertencias : 1
Mensajes Mensajes : 156
Puntos Puntos : 49387
Reputación Reputación : 1
Fecha de inscripción Fecha de inscripción : 19/12/2010
País País : Argentina


Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.