Todo-Argentum
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

[Aporte] Deatmach con comando

2 participantes

Ir abajo

[Aporte] Deatmach con comando Empty [Aporte] Deatmach con comando

Mensaje por Shermie80 Jue Ago 22, 2013 11:14 am


1. SERVIDOR

Buscamos

Código:
TurnOffServer           '/APAGAR

y abajo ponemos

Código:
dm             '/DM
            Salirdm    '/SALIRDM

Luego buscamos

Código:
Case ClientPacketID.TurnOffServer           '/APAGAR
                               Call HandleTurnOffServer(UserIndex)

y abajo ponemos

Código:
case clientpacketid.Dm
call handleDm(userindex)

case clientpacketid.salirdm
call handleSalirdm(userindex)

Al final del modulo protocolo.bas mandamos esto

Código:
Public Sub handleDm(byval userindex as integer)
with userlist(userindex)
call .incomingdata.readbyte

If UserList(UserIndex).flags.Muerto = 1 Then
writeconsolemsg userindex, "¡Estás muerto!", FonttypeNames.fonttype_info
Exit Sub
End If

If EsNewbie(UserIndex) Then
writeconsolemsg userindex, "¡No eres bienvenido al DM si eres newbie!", fonttypenames.fonttype_info
Exit Sub
End If

If MapInfo(.Pos.Map).Pk = True Then
writeconsolemsg userindex, "No puedes ingresar al DM estando en zona insegura.", FonttypeNames.FONTTYPE_WARNING)
Exit Sub
End If

If Not .flags.InDm = True Then
dim Lugar as integer
Lugar = randomNumber(1, 2) 'Random map en donde se hace el DM ( lo pueden cambiar a su gusto )
       If MapInfo(Lugar).NumUsers <= 1 Then 'Remplazamos el 10 por el numero de mapa que queramos
Call WarpUserChar(UserIndex, Lugar, 50, 50, True)
       Call SendData(SendTarget.ToAll, userindex, preparemessageconsolemsg(.name & " Ingresó al DM.", Fonttypenames.FONTTYPE_CONSEJO)
                       .flags.InDm = True

End If
End If
end with
end sub

public sub handleSalirdm(byval userindex as integer)
with userlist(userindex)
call .incomingdata.readbyte
If .flags.InDm = True Then

       UserList(UserIndex).flags.InDm = False
Call WarpUserChar(UserIndex, 1, 50, 50, True)
call senddata(sendtarget.toall, userindex, preparemessageconsolemsg (.name & "Abandonó el DM",fonttypenames.fonttype_info))
else
writeconsolemsg userindex, "¡No estas en el DM!", fonttypenames.fonttype_info
end if
End WIth
End Sub

Luego buscamos

Código:
Public Type UserFlags

y abajo ponemos

Código:
InDm As Boolean

despues buscamos

Código:
Sub Userdie

y antes del end sub colocamos

Código:
If UserList(UserIndex).flags.InDm Then
   
           UserList(UserIndex).flags.InDm = False
   
         Call WarpUserChar(UserIndex, 1, 50, 50, True)
   End If

Luego buscamos

Código:
sub cerrar_usuario
y abajo colocamos

Código:
If UserList(UserIndex).flags.InDm Then
   
           UserList(UserIndex).flags.InDm = False
   
         Call WarpUserChar(UserIndex, 1, 50, 50, True)
   End If

y con eso concluimos con el SERVIDOR
Ahora

Código:
Cliente
buscamos

Código:
 TurnOffServer           '/APAGAR

y abajo colocamos

Código:
Dm            '/DM
             Salirdm    '/SALIRDM

Al final del modulo protocolo.bas metemos esto

Código:
public sub writeDm()
with outgoingdata
call .writebyte(clientpacketid.Dm)
end with
end sub
public sub writeSalirdm()
with outgoingdata
call .writebyte(clientpacketid.Salirdm)
end with
end sub

y por ultimo buscamos esto

Código:
case "/ONLINE"

y abajo ponemos

Código:
case "/DM"
call writeDm

case "/Salirdm"
call writeSalirdm

Fuente:
Shermie80
Shermie80

[Aporte] Deatmach con comando ZdImiA6

CoverAOStaff
Aportes : 55
Mensajes : 139
Puntos : 822
Edad : 27

https://todo-argentum.foroargentina.net

Volver arriba Ir abajo

[Aporte] Deatmach con comando Empty Re: [Aporte] Deatmach con comando

Mensaje por KhurverT Lun Ago 26, 2013 9:19 pm

Buen aporte mayco!
KhurverT
KhurverT

[Aporte] Deatmach con comando 5O26YPx

Mensajes : 18
Puntos : 24
Edad : 27

Volver arriba Ir abajo

[Aporte] Deatmach con comando Empty Re: [Aporte] Deatmach con comando

Mensaje por Shermie80 Lun Ago 26, 2013 9:31 pm

Gracias, Pero no es mi Codigo xD , Bienvenido al foro espero verte Activo Smile
Shermie80
Shermie80

[Aporte] Deatmach con comando ZdImiA6

CoverAOStaff
Aportes : 55
Mensajes : 139
Puntos : 822
Edad : 27

https://todo-argentum.foroargentina.net

Volver arriba Ir abajo

[Aporte] Deatmach con comando Empty Re: [Aporte] Deatmach con comando

Mensaje por KhurverT Lun Ago 26, 2013 9:36 pm

Gracias.
KhurverT
KhurverT

[Aporte] Deatmach con comando 5O26YPx

Mensajes : 18
Puntos : 24
Edad : 27

Volver arriba Ir abajo

[Aporte] Deatmach con comando Empty Re: [Aporte] Deatmach con comando

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba


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