MMORPG Brasil
Ola, visitante! Agradecemos sua visita, para ter acesso a todo nosso conteúdo recomendamos que faça um cadastro no fórum, com ele você pode participar de tópicos e ter acesso a todas áreas da comunidade!

Participe do fórum, é rápido e fácil

MMORPG Brasil
Ola, visitante! Agradecemos sua visita, para ter acesso a todo nosso conteúdo recomendamos que faça um cadastro no fórum, com ele você pode participar de tópicos e ter acesso a todas áreas da comunidade!
MMORPG Brasil
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Sistema de Premium por Data

+30
guifs
Alanai Minna
TheKirin
Eduardo Marwell
SkNzinho
Storm™
xurana321
Fantasy
Over~
srloks
skykro-T
LegendaryAngel
Chrono mmorpg
Moph
'Sonik'
GuiinhoLP
Wellington Cortez
Rodrigo JC
gustavoHD500
lucas1802012
Cris~
Valentine
Incrivel508
BabyFusion
Frozen
GustavoNunes
marlongb
Sαkurαy
Eduardo
Guardian
34 participantes

Página 1 de 4 1, 2, 3, 4  Seguinte

Ir para baixo

Sistema de Premium por Data Empty Sistema de Premium por Data

Mensagem por Guardian Dom 15 Jul 2012, 03:17

Olá Galera!

Hoje estou aqui para ensinar vocês a como criar um sistema de Premium para seu jogo onde o Premium é retirado automaticamente por datas. O sistema de Premium é um sistema que muitos conhecem, só que pelo nome Sistema Vip. Neste tutorial o Sistema Premium dá somente duas vezes mais experiência do que o player normal. Outras características devem ser adicionadas por vocês.

Vamos ao tutorial.

Cliente Side

No Cliente crie uma nova Form com o nome frmEditor_Premium. Deixe-a da seguinte forma :

Sistema de Premium por Data TutorialPremium

Dê as seguintes propriedades para os textbox na ordem de cima para baixo :

Name : txtPlayer
Name : txtSPremium
Name : txtDPremium

Agora, dê as seguintes propriedades para os commands buttons na ordem da esquerda pra direita :

Name : cmdPremium
Name : cmdRPremium
Name : cmdExit

Agora insira esse código na frmEditor_Premium :

Código:
' Sistema de Premium By : Guardian
Option Explicit

Private Sub cmdExit_Click()
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

Me.Visible = False

' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdExit_Click", "frmEditor_Premium", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub cmdPremium_Click()
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

    'Check Access
    If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then
        Exit Sub
    End If
    
    'Check for blanks fields
    If txtPlayer.text = vbNullString Or txtSPremium.text = vbNullString Or txtDPremium.text = vbNullString Then
        MsgBox ("There are blank fields, please fill out.")
        Exit Sub
    End If
    
    'If all right, go for the Premium
    Call SendChangePremium(txtPlayer.text, txtSPremium.text, txtDPremium.text)
    
' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdPremium_Click", "frmEditor_Premium", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub cmdRPremium_Click()
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

    'Check Access
    If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then
        Exit Sub
    End If
    
    'Check for blanks fields
    If txtPlayer.text = vbNullString Then
        MsgBox ("The name of the player is required for this operation.")
        Exit Sub
    End If
    
    'If all is right, remove the Premium
    Call SendRemovePremium(txtPlayer.text)
    
' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdRPremium_Click", "frmEditor_Premium", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Agora, na frmMain. Na PicAdmin, crie um botão com o nome cmdAPremium, nele adicione :

Código:
' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ' Check Access
    If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then
        Exit Sub
    End If

    Call SendRequestEditPremium
    
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdAPremium_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub

Agora, no final do ModClientTCP adicione :

Código:
Sub SendRequestEditPremium()
Dim Buffer As clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    
    Set Buffer = New clsBuffer
    Buffer.WriteLong CRequestEditPremium
    SendData Buffer.ToArray()
    Set Buffer = Nothing

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "SendRequestEditPremium", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Sub SendChangePremium(ByVal Name As String, ByVal Start As String, ByVal Days As Long)
Dim Buffer As clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    
    Set Buffer = New clsBuffer
    Buffer.WriteLong CChangePremium
    Buffer.WriteString Name
    Buffer.WriteString Start
    Buffer.WriteLong Days
    SendData Buffer.ToArray()
    Set Buffer = Nothing

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "SendChangePremium", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Sub SendRemovePremium(ByVal Name As String)
Dim Buffer As clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    
    Set Buffer = New clsBuffer
    Buffer.WriteLong CRemovePremium
    Buffer.WriteString Name
    SendData Buffer.ToArray()
    Set Buffer = Nothing

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "SendRemovePremium", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

No ModDirectDraw7, procure isso :

Código:
For i = 1 To Action_HighIndex
        Call BltActionMsg(i)
    Next i

Abaixo adicione :

Código:
If Premium <> vbNullString Then
    Call DrawPremium
    End If

Então, no ModEnumerations. Acima disso :

Código:
' Make sure SMSG_COUNT is below everything else
    SMSG_COUNT

Adicione :

Código:
SPlayerDPremium
    SPremiumEditor

Ainda no ModEnumerations, acima disso :

Código:
' Make sure CMSG_COUNT is below everything else
    CMSG_COUNT

Adicione :

Código:
CRequestEditPremium
    CChangePremium
    CRemovePremium

Agora, no final do ModGlobals, adicione :

Código:
' Premium
Public Premium As String
Public RPremium As String

No ModHandleData, procure isso :

Código:
HandleDataSub(SPartyVitals) = GetAddress(AddressOf HandlePartyVitals)

Abaixo adicione :

Código:
HandleDataSub(SPlayerDPremium) = GetAddress(AddressOf HandlePlayerDPremium)
    HandleDataSub(SPremiumEditor) = GetAddress(AddressOf HandlePremiumEditor)

Então, no final do ModHandleData adicione :

Código:
Private Sub HandlePlayerDPremium(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim A As String
Dim B As Long, c As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    
    ' Catch Data
    A = Buffer.ReadString
    B = Buffer.ReadLong
    c = Buffer.ReadLong
    
    ' Changing global variables
    If A = "Sim" Then
    Premium = "Premium : " & A
    RPremium = "You have : " & c - B & " days of Premium."
    Else
    Premium = vbNullString
    RPremium = vbNullString
    End If
    
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandlePlayerDPremium", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub HandlePremiumEditor()
Dim i As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    
    ' Check Access
    If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then
    Exit Sub
    End If
    
    ' If you have everything right, up the Editor.
    With frmeditor_Premium
    .Visible = True
    End With
    
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandlePremiumEditor", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Agora, no final do ModText adicione :

Código:
Public Sub DrawPremium()
Dim x As Long
Dim x2 As Long
Dim y As Long

x = Camera.Left + ((MAX_MAPX + 1) * PIC_X / 2) - getWidth(TexthDC, Trim$(Premium))
x2 = Camera.Left + ((MAX_MAPX + 1) * PIC_X / 2) - getWidth(TexthDC, Trim$(RPremium))
y = Camera.top + 1

Call DrawText(TexthDC, x - 190, y, Premium, QBColor(BrightBlue))
Call DrawText(TexthDC, x2 - 145, y + 20, RPremium, QBColor(BrightRed))
End Sub

Para finalizar o cliente, no ModTypes, procure isso :

Código:
' Client use only

Acima adicione :

Código:
' Premium
    Premium As String
    StartPremium As String
    DaysPremium As Long



Server Side

No ModCombat, Na Sub PlayerAttackNpc, ache isso :

Código:
' Calculate exp to give attacker
        exp = Npc(npcNum).exp

Abaixo adicione :

Código:
' Premium
        If GetPlayerPremium(attacker) = "Sim" Then
        exp = exp * 2
        End If

Agora, Na ModEnumerations. Ache isso :

Código:
' Make sure SMSG_COUNT is below everything else
    SMSG_COUNT

Acima, adicione :

Código:
SPlayerDPremium
    SPremiumEditor

Ainda na ModEnumerations, ache isso :

Código:
' Make sure CMSG_COUNT is below everything else
    CMSG_COUNT

Acima, adicione :

Código:
CRequestEditPremium
    CChangePremium
    CRemovePremium

Na ModHandleData, ache isso :

Código:
HandleDataSub(CPartyLeave) = GetAddress(AddressOf HandlePartyLeave)

Abaixo adicione :

Código:
HandleDataSub(CRequestEditPremium) = GetAddress(AddressOf HandleRequestEditPremium)
    HandleDataSub(CChangePremium) = GetAddress(AddressOf HandleChangePremium)
    HandleDataSub(CRemovePremium) = GetAddress(AddressOf HandleRemovePremium)

Ainda na ModHandleData, la no final adicione :

Código:
Sub HandleRequestEditPremium(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

' Check Access
If GetPlayerAccess(index) < ADMIN_DEVELOPER Then
    Call PlayerMsg(index, "You do not have access to complete this action!", White)
    Exit Sub
End If

Call SendPremiumEditor(index)
End Sub

Sub HandleChangePremium(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim A As String
Dim B As String
Dim C As Long
Dim D As String
    
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    
    A = Buffer.ReadString
    B = Buffer.ReadString
    C = Buffer.ReadLong
    
    D = FindPlayer(A)
    
    If IsPlaying(D) Then
            
    ' Check access if everything is right, change Premium
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Call PlayerMsg(Index, "You do not have access to complete this action!", White)
        Exit Sub
    Else
        Call SetPlayerPremium(D, "Sim")
        Call SetPlayerStartPremium(D, B)
        Call SetPlayerDaysPremium(D, C)
        GlobalMsg "The player " & GetPlayerName(D) & " became Premium. Congratulations!", BrightCyan
    End If
    
    SendPlayerData D
    SendDataPremium D
    
    End If
    
    Set Buffer = Nothing
End Sub

Sub HandleRemovePremium(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim A As String
Dim B As String
    
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    
    A = Buffer.ReadString
    
    B = FindPlayer(A)
    
    If IsPlaying(B) Then
            
    ' Check access if everything is right, change Premium
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Call PlayerMsg(Index, "You do not have access to complete this action!", White)
        Exit Sub
    Else
        Call SetPlayerPremium(B, "Não")
        Call SetPlayerStartPremium(B, vbNullString)
        Call SetPlayerDaysPremium(B, 0)
        PlayerMsg B, "His days of premium sold out.", BrightCyan
    End If
    
    SendPlayerData B
    SendDataPremium B
    
    End If
    
    Set Buffer = Nothing
End Sub

Agora no final da ModPlayer, adicione :

Código:
' Premium
Function GetPlayerPremium(ByVal index As Long) As String
    GetPlayerPremium = Trim$(Player(index).Premium)
End Function
 
Sub SetPlayerPremium(ByVal index As Long, ByVal Premium As String)
    Player(index).Premium = Premium
End Sub
 
' Start Premium
Function GetPlayerStartPremium(ByVal index As Long) As String
    GetPlayerStartPremium = Trim$(Player(index).StartPremium)
End Function
 
Sub SetPlayerStartPremium(ByVal index As Long, ByVal StartPremium As String)
    Player(index).StartPremium = StartPremium
End Sub
 
' Days Premium
Function GetPlayerDaysPremium(ByVal index As Long) As Long
    GetPlayerDaysPremium = Player(index).DaysPremium
End Function
 
Sub SetPlayerDaysPremium(ByVal index As Long, ByVal DaysPremium As Long)
    Player(index).DaysPremium = DaysPremium
End Sub

Sub CheckPremium(ByVal index As Long)

    ' Check Premium
    If GetPlayerPremium(index) = "Sim" Then
        If DateDiff("d", GetPlayerStartPremium(index), Date) < GetPlayerDaysPremium(index) Then
            If GetPlayerPremium(index) = "Sim" Then
                Call PlayerMsg(index, "Thank you for purchasing the Premium Plan, Good Game!", White)
            End If
        ElseIf DateDiff("d", GetPlayerStartPremium(index), Date) >= GetPlayerDaysPremium(index) Then
            If GetPlayerPremium(index) = "Sim" Then
                Call SetPlayerPremium(index, "Não")
                Call PlayerMsg(index, "His days with the Premium plan exhausted, Good Game!", White)
            End If
        End If
    End If
End Sub

Agora no final do ModServerTCP, adicione :

Código:
Sub SendDataPremium(ByVal index As Long)
Dim Buffer As clsBuffer
Dim A As Long

    If GetPlayerPremium(index) = "Sim" Then
        A = DateDiff("d", GetPlayerStartPremium(index), Now)
    Else
        A = 0
    End If

    Set Buffer = New clsBuffer
    Buffer.WriteLong SPlayerDPremium
    Buffer.WriteString GetPlayerPremium(index)
    Buffer.WriteLong A
    Buffer.WriteLong GetPlayerDaysPremium(index)
    
    SendDataTo index, Buffer.ToArray()
    Set Buffer = Nothing
End Sub

Sub SendPremiumEditor(ByVal index As Long)
Dim Buffer As clsBuffer

    Set Buffer = New clsBuffer
    Buffer.WriteLong SPremiumEditor
    
    SendDataTo index, Buffer.ToArray()
    Set Buffer = Nothing
End Sub

No ModTypes, Na Type PlayerRec, ache isso :

Código:
Dir As Byte

Abaixo adicione :

Código:
' Premium
    Premium As String
    StartPremium As String
    DaysPremium As Long

No ModPlayer, ache isso :

Código:
Call SendWornEquipment(index)
    Call SendMapEquipment(index)
    Call SendPlayerSpells(index)
    Call SendHotbar(index)

Abaixo, adicione :

Código:
Call CheckPremium(index)

No ModDatabase, Na Sub AddChar, ache isso :

Código:
Player(index).Class = ClassNum

Abaixo, adicione :

Código:
Player(index).Premium = "Não"
        Player(index).StartPremium = "00/00/0000"
        Player(index).DaysPremium = 0

Ainda no ModDatabase, Na Sub ClearPlayer, ache isso :

Código:
Player(index).Class = 1

Abaixo adicione :

Código:
Player(index).Premium = "Não"
    Player(index).StartPremium = "00/00/0000"
    Player(index).DaysPremium = 0

Na ModHandleData, Na Sub HandleLogin, ache isso :

Código:
' Show the player up on the socket status

Acima, adicione :

Código:
Call SendDataPremium(index)

Ainda na ModHandleData, na HandleAddChar, ache :

Código:
Call AddChar(index, Name, Sex, Class, Sprite)

Abaixo adicione :

Código:
Call SendDataPremium(index)

Créditos : Guardian


Última edição por Guardian em Dom 15 Jul 2012, 17:03, editado 5 vez(es)
Guardian
Guardian
Membro de Honra
Membro de Honra

Mensagens : 781

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Eduardo Dom 15 Jul 2012, 03:19

vlw Xara +1
Eduardo
Eduardo
Membro Veterano
Membro Veterano

Mensagens : 1178

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Sαkurαy Dom 15 Jul 2012, 03:25

Isso aí Guardian lindo
Cadê a fanbar pra eu usar?
Sαkurαy
Sαkurαy
Membro Veterano
Membro Veterano

Mensagens : 1386

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por marlongb Dom 15 Jul 2012, 08:01

Parabéns, Muito Bom.
Só me diz uma coisa, como crio um Botão no Painel do ADM pra chamar a "frmEditor_Premium" ?

Ah Consegui setei o "frmEditor_Premium" como Visible=False.
E criei um botão com isso dentro:

Código:

If frmEditor_Premium.visible = True Then
frmEditor_Premium.visible = False
Else
frmEditor_Premium.visible = True
End If


Última edição por marlongb em Dom 15 Jul 2012, 08:23, editado 1 vez(es) (Motivo da edição : Consegui fazer o botão)
marlongb
marlongb
Novato
Novato

Mensagens : 18

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por marlongb Dom 15 Jul 2012, 08:36

Vixe, achei um bug Sad
Se você der VIP pra um Player que não esta Online.
Quando ele entrar da erro no servidor, e o player não conecta.
O Erro Mostra nessa Parte do Código
Server~Side
Código:
Sub SetPlayerPremium(ByVal index As Long, ByVal Premium As String)
    Player(index).Premium = Premium
End Sub
marlongb
marlongb
Novato
Novato

Mensagens : 18

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por GustavoNunes Dom 15 Jul 2012, 09:10

CUIDADO, COM O DOUBLE POST.
Eu vou testar, se der certo dou +1 credito. ou +10 sei lá.
GustavoNunes
GustavoNunes
Membro Sênior
Membro Sênior

Mensagens : 345

http://PHANTOMWAR.webnode.com

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Guardian Dom 15 Jul 2012, 10:20

Eu havia esquecido de por no tutorial a parte da PicAdmin. kkk'

Vai na frmMain, na picAdmin. Crie um botão com o nome : cmdAPremium
Nele adicione :

Código:
' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ' Check Access
    If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then
        Exit Sub
    End If

    Call SendRequestEditPremium
   
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdAPremium_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub

E marlongb, este sistema foi feito pra dar Vip quando o player estiver online... Mas só por garantia de erros. Vou colocar um If IsPlaying ali. kkkk'

Valeu! Wink



---------------------------------------
Edit

No Servidor, substitua a Sub HandleChangePremium e a Sub HandleRemovePremium para :

Código:
Sub HandleChangePremium(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim A As String
Dim B As String
Dim C As Long
Dim D As String
   
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
   
    A = Buffer.ReadString
    B = Buffer.ReadString
    C = Buffer.ReadLong
   
    D = FindPlayer(A)
   
    If IsPlaying(D) Then
           
    ' Check access if everything is right, change Premium
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Call PlayerMsg(Index, "You do not have access to complete this action!", White)
        Exit Sub
    Else
        Call SetPlayerPremium(D, "Sim")
        Call SetPlayerStartPremium(D, B)
        Call SetPlayerDaysPremium(D, C)
        GlobalMsg "The player " & GetPlayerName(D) & " became Premium. Congratulations!", BrightCyan
    End If
   
    SendPlayerData D
    SendDataPremium D
   
    End If
   
    Set Buffer = Nothing
End Sub

Sub HandleRemovePremium(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim A As String
Dim B As String
   
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
   
    A = Buffer.ReadString
   
    B = FindPlayer(A)
   
    If IsPlaying(B) Then
           
    ' Check access if everything is right, change Premium
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Call PlayerMsg(Index, "You do not have access to complete this action!", White)
        Exit Sub
    Else
        Call SetPlayerPremium(B, "Não")
        Call SetPlayerStartPremium(B, vbNullString)
        Call SetPlayerDaysPremium(B, 0)
        PlayerMsg B, "His days of premium sold out.", BrightCyan
    End If
   
    SendPlayerData B
    SendDataPremium B
   
    End If
   
    Set Buffer = Nothing
End Sub

Ja arrumei no tutorial, mas quem ja fez, basta fazer isso ai.
Adicionei um If IsPlaying pra evitar erros.
Guardian
Guardian
Membro de Honra
Membro de Honra

Mensagens : 781

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Frozen Dom 15 Jul 2012, 10:41

Muito bom + 1 credito
Frozen
Frozen
Membro Veterano
Membro Veterano

Mensagens : 1339

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por GustavoNunes Dom 15 Jul 2012, 12:10

Consegui fazer, demoro masi fiz. +5 creditos cara, vc merece.
GustavoNunes
GustavoNunes
Membro Sênior
Membro Sênior

Mensagens : 345

http://PHANTOMWAR.webnode.com

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por BabyFusion Dom 15 Jul 2012, 12:28

Muito bom, testado e aprovado. Smile
BabyFusion
BabyFusion
Membro Sênior
Membro Sênior

Mensagens : 339

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Incrivel508 Dom 15 Jul 2012, 12:47

kkkk belo tutorial
@off: ruffy pelo menos usa minha fan bar kkkkk
Incrivel508
Incrivel508
Membro
Membro

Mensagens : 225

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por BabyFusion Dom 15 Jul 2012, 15:57

Guardian, eu percebi isso agora...
Quando um jogador é Premium aparece na tela quantos dias ele ainda tem para ser Premium, só que aqui ficou fora da tela, olhe:

Sistema de Premium por Data X9fhm
BabyFusion
BabyFusion
Membro Sênior
Membro Sênior

Mensagens : 339

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Valentine Dom 15 Jul 2012, 16:22

Isso é muito bom cara, você realmente sabe trabalhar muito bem com tempo, você está de parabéns, eu fiz algo do tipo, mas esse seu sistema de premmy trabalha com horas também? por exemplo: eu adiciono 2 dias de premmy no dia 15 de julho as 17:21 e ela acabar dia 17 as 17:21?

Eu sei que você pode usar DateDiff para fazer uma segunda condição, mas não tem alguma condição única?
avatar
Valentine
Membro de Honra
Membro de Honra

Mensagens : 472

http://www.aldeiarpgbr.com

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Guardian Dom 15 Jul 2012, 16:38

Valentine escreveu:Isso é muito bom cara, você realmente sabe trabalhar muito bem com tempo, você está de parabéns, eu fiz algo do tipo, mas esse seu sistema de premmy trabalha com horas também? por exemplo: eu adiciono 2 dias de premmy no dia 15 de julho as 17:21 e ela acabar dia 17 as 17:21?

Eu sei que você pode usar DateDiff para fazer uma segunda condição, mas não tem alguma condição única?

Valeu Valentine. Very Happy
Este sistema exatamente não trabalha com Horas, ele só vai tirar por dia. Se você adicionou um Premium no dia 15 de julho as 17:21. Ele só será retirado no dia 16 de Julho.

Mas claro, como você mesmo disse... Eu posso usar o DateDiff pra fazer uma segunda condição. Mas tem uma solução melhor.

Criar na Estrutura do player isso : Player(Index).Time

Então no HandleChangeVip, você vai por pra Player(Index).Time = Time. Visual Basic 6 por padrão vai pegar o "Time" que é o horário atual de quem ta hosteando o Servidor.

Então você pode usar o CheckPremium que tem neste tutorial. Só que ai você vai adicionar o CheckPremium em vários locais primordiais do jogo pra checar a todo momento. Entende ?

Ai na Sub CheckPremium, você cria uma condição dentro dessa condição :

Código:
If DateDiff("d", GetPlayerStartPremium(index), Date) < GetPlayerDaysPremium(index) Then

Ai nessa condição ai em cima ao invés de deixar : <
Você coloca : <=

Porque ai você estaria no dia, então você cria a condição do timer, que seria algo do tipo :

Código:
If Time > Player(Index).Time Then
SetPlayerPremium(Index, "Não")
End If

Espero que tenha respondido. kkkk'
E isso foi quase um tutorial... LOL
Guardian
Guardian
Membro de Honra
Membro de Honra

Mensagens : 781

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por marlongb Dom 15 Jul 2012, 16:46

Obrigado Guardian,
Essa correção ai funcionou perfeitamente... Very Happy
Estou com o mesmo problema do BabyFusion, ta cortando o Display do Texto na tela la.

Mas mesmo assim, ja ta quase perfeito Laughing

marlongb
marlongb
Novato
Novato

Mensagens : 18

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Guardian Dom 15 Jul 2012, 17:02

No Cliente, procure por :

Código:
Public Sub DrawPremium()
Dim x As Long
Dim y As Long

x = Camera.Left + ((MAX_MAPX + 1) * PIC_X / 2) - getWidth(TexthDC, Trim$(Map.Name))
y = Camera.top + 1

Call DrawText(TexthDC, x - 235, y, Premium, QBColor(BrightBlue))
Call DrawText(TexthDC, x - 235, y + 20, RPremium, QBColor(BrightRed))
End Sub

Troque para :

Código:
Public Sub DrawPremium()
Dim x As Long
Dim x2 As Long
Dim y As Long

x = Camera.Left + ((MAX_MAPX + 1) * PIC_X / 2) - getWidth(TexthDC, Trim$(Premium))
x2 = Camera.Left + ((MAX_MAPX + 1) * PIC_X / 2) - getWidth(TexthDC, Trim$(RPremium))
y = Camera.top + 1

Call DrawText(TexthDC, x - 190, y, Premium, QBColor(BrightBlue))
Call DrawText(TexthDC, x2 - 145, y + 20, RPremium, QBColor(BrightRed))
End Sub

Pronto, agora vai escrever certo. Smile
Guardian
Guardian
Membro de Honra
Membro de Honra

Mensagens : 781

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Cris~ Dom 15 Jul 2012, 21:47

Guardian seu lindo merece um beijo kkkkkkkkk -nnnnnnn, Tava precisando manolo (;

+ 1 de Credito
Cris~
Cris~
Membro Veterano
Membro Veterano

Mensagens : 1574

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Sαkurαy Dom 15 Jul 2012, 21:51

Ativei meu vip por volta das 20:00.
1 Dia vip, no caso, pra ver oquê ia dar quando chega-se 00:00..
Agora, nesse exato momento, já tá em 0 o vip.. Ou seja, a remoção por tempo funciona, mais o tempo não.. Não sei bem, mais creio que ele está usando a hora dos EUA, lá já é mais de meia noite, que no caso é outro dia, assim como Valentine falou, dia seguinte acaba o vip .
Veja isso aí Guardian.
Sαkurαy
Sαkurαy
Membro Veterano
Membro Veterano

Mensagens : 1386

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Valentine Dom 15 Jul 2012, 22:32

Guardian escreveu:
Valentine escreveu:Isso é muito bom cara, você realmente sabe trabalhar muito bem com tempo, você está de parabéns, eu fiz algo do tipo, mas esse seu sistema de premmy trabalha com horas também? por exemplo: eu adiciono 2 dias de premmy no dia 15 de julho as 17:21 e ela acabar dia 17 as 17:21?

Eu sei que você pode usar DateDiff para fazer uma segunda condição, mas não tem alguma condição única?

Valeu Valentine. Very Happy
Este sistema exatamente não trabalha com Horas, ele só vai tirar por dia. Se você adicionou um Premium no dia 15 de julho as 17:21. Ele só será retirado no dia 16 de Julho.

Mas claro, como você mesmo disse... Eu posso usar o DateDiff pra fazer uma segunda condição. Mas tem uma solução melhor.

Criar na Estrutura do player isso : Player(Index).Time

Então no HandleChangeVip, você vai por pra Player(Index).Time = Time. Visual Basic 6 por padrão vai pegar o "Time" que é o horário atual de quem ta hosteando o Servidor.

Então você pode usar o CheckPremium que tem neste tutorial. Só que ai você vai adicionar o CheckPremium em vários locais primordiais do jogo pra checar a todo momento. Entende ?

Ai na Sub CheckPremium, você cria uma condição dentro dessa condição :

Código:
If DateDiff("d", GetPlayerStartPremium(index), Date) < GetPlayerDaysPremium(index) Then

Ai nessa condição ai em cima ao invés de deixar : <
Você coloca : <=

Porque ai você estaria no dia, então você cria a condição do timer, que seria algo do tipo :

Código:
If Time > Player(Index).Time Then
SetPlayerPremium(Index, "Não")
End If

Espero que tenha respondido. kkkk'
E isso foi quase um tutorial... LOL
Muito bom, só que eu achei que tivesse alguma possibilidade de usar apenas uma condição, porque o Now mostra a data e a hora ai por isso achei que daria pra fazer uma condição só, mas não achei nada sobre isso pelo menos do DateDiff.


Última edição por Valentine em Dom 15 Jul 2012, 22:34, editado 2 vez(es)
avatar
Valentine
Membro de Honra
Membro de Honra

Mensagens : 472

http://www.aldeiarpgbr.com

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por BabyFusion Dom 15 Jul 2012, 22:33

Obrigado, agora resolveu Smile
BabyFusion
BabyFusion
Membro Sênior
Membro Sênior

Mensagens : 339

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por lucas1802012 Seg 23 Jul 2012, 10:45

aki de tudo certo mas quando um player ganha o vip quando ele sai do jogo e entra o vip some pq ?
me ajuda aki pfv Sad
lucas1802012
lucas1802012
Novato
Novato

Mensagens : 42

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por gustavoHD500 Ter 24 Jul 2012, 16:02

Ae mano tópico parece dificil quando fui ver que tinha tanta coisa, mais depois que começa a fazer vc ver que é facil kk

Me aceita no MSN xD quero fala de umas coisa com você

+1 credito pra tu xD
gustavoHD500
gustavoHD500
Novato
Novato

Mensagens : 26

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Guardian Ter 24 Jul 2012, 17:44

lucas1802012 escreveu:aki de tudo certo mas quando um player ganha o vip quando ele sai do jogo e entra o vip some pq ?
me ajuda aki pfv Sad

Refaça o Tutorial parceiro. Ja testei isso ai que você fez e bom... Aqui funcionou normalmente, se o problema persistir, vou fazer em uma EO zerada aqui o Tutorial baseado no tópico pra ve se esqueci de algo.

Att.Guardian
Guardian
Guardian
Membro de Honra
Membro de Honra

Mensagens : 781

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Rodrigo JC Ter 24 Jul 2012, 19:05

Então mano..o Sistema ta de boa..eu fiz todo não deu nenhum erro..
Bom Tutorial..ja ganho meu Cred bounce
Rodrigo JC
Rodrigo JC
Membro Junior
Membro Junior

Mensagens : 70

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Wellington Cortez Dom 12 Ago 2012, 13:54

Cara achei bem legal,mas o foda é que eu não sei criar frm etc...e o tutorial é grandinho, eu quero muito fazer mas não sei se consigo --'
Wellington Cortez
Wellington Cortez
Membro Junior
Membro Junior

Mensagens : 96

Ir para o topo Ir para baixo

Sistema de Premium por Data Empty Re: Sistema de Premium por Data

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Página 1 de 4 1, 2, 3, 4  Seguinte

Ir para o topo


 
Permissões neste sub-fórum
Não podes responder a tópicos