Lucas Roberto Administrador
Mensagens : 711
| Assunto: Sistema Cash Dom 26 Jun 2011, 17:14 | |
| Well, primeiro venho lhes dizer que não é um sistema completo (*olhamos para o shop), na verdade, esse sistema irá apenas mostar o cash do player na frmMirage e no server será possível editar o cash que o usuário tiver. Already? Client~Side Na frmMirage, crie uma label e coloque o nome de lblCash. Agora no modClientTCP procure por: - Código:
-
' ::::::::::::::::::::::::: ' :: Player Stats Packet :: ' ::::::::::::::::::::::::: E embaixo de: - Código:
-
frmMirage.lblLevel.Caption = "Level " & Val(Parse(7)) Coloque: - Código:
-
frmMirage.lblCash.Caption = "Meus Cash: " & Val(Parse(8)) Ok, parte client~side pronta. Server~Side Na frmServer, aba Jogadores, na picStats copie a label CharInfo(20) e cole-a novamente, tornando-a label CharInfo(23), isso é automaticamente. Procure por (ainda na frmServer): - Código:
-
CharInfo(20).Caption = "Index: " & Index E embaixo adicione: - Código:
-
CharInfo(23).Caption = "Cash: " & GetPlayerCash(Index) No modDatabase, procure por: - Código:
-
Sub AddAccount(ByVal Index As Long, _ ByVal Name As String, _ ByVal Password As String) Dim i As Long
Player(Index).Login = Name Player(Index).Password = Password
For i = 1 To MAX_CHARS Call ClearChar(Index, i) Next
Call SavePlayer(Index) End Sub E mude a Sub toda por: - Código:
-
Sub AddAccount(ByVal Index As Long, _ ByVal Name As String, _ ByVal Password As String, _ ByVal Cash As Long) Dim i As Long
Player(Index).Login = Name Player(Index).Password = Password Player(Index).Cash = Cash
For i = 1 To MAX_CHARS Call ClearChar(Index, i) Next
Call SavePlayer(Index) End Sub Ainda no modDatabase, na Sub LoadPlayer, procure por: - Código:
-
Player(Index).Password = GetVar(FileName, "GENERAL", "Password") Embaixo adicione: - Código:
-
Player(Index).Cash = Val(GetVar(FileName, "GENERAL", "Cash")) Ainda no modDatabase, na Sub SavePlayer, procure por: - Código:
-
Call PutVar(FileName, "GENERAL", "Password", Trim$(Player(Index).Password)) Embaixo adicione: - Código:
-
Call PutVar(FileName, "GENERAL", "Cash", STR(Player(Index).Cash)) No modTypes, ache: - Código:
-
Password As String * NAME_LENGTH Embaixo adicione: - Código:
-
Cash As Long Ainda no modTypes, na Sub ClearPlayer, ache: - Código:
-
Player(Index).Password = vbNullString Embaixo adicione: - Código:
-
Player(Index).Cash = 0 Continuando no modTypes, procure por: - Código:
-
' ////////////////////// ' // PLAYER FUNCTIONS // ' ////////////////////// Function GetPlayerLogin(ByVal Index As Long) As String GetPlayerLogin = Trim$(Player(Index).Login) End Function Logo embaixo coloque: - Código:
-
Function GetPlayerCash(ByVal Index As Long) As Long GetPlayerCash = Player(Index).Cash End Function
Sub SetPlayerCash(ByVal Index As Long, _ ByVal Cash As Long) Player(Index).Cash = Cash End Sub No modGameLogic, na Sub JoinGame, procure por: - Código:
-
' Mandar quem está online Call SendWhosOnline(Index) Call ShowPLR(Index) Embaixo coloque: - Código:
-
Call UsersCash(Index) Ainda no modGameLogic, na Sub LeftGame, procure por: - Código:
-
Call SavePlayer(Index) Call TextAdd(frmServer.txtText(0), GetPlayerName(Index) & " saiu do " & GAME_NAME & ".", True) Call SendLeftGame(Index) Call RemovePLR
For N = 1 To MAX_PLAYERS Call ShowPLR(N) Next Mude para: - Código:
-
Call SavePlayer(Index) Call TextAdd(frmServer.txtText(0), GetPlayerName(Index) & " saiu do " & GAME_NAME & ".", True) Call SendLeftGame(Index) Call RemovePLR Call RemoveUsersCash
For N = 1 To MAX_PLAYERS Call ShowPLR(N) Call UsersCash(N) Next No modGameLogic, procure por: - Código:
-
Public Sub RemovePLR() frmServer.lvUsers.ListItems.Clear End Sub Embaixo coloque: - Código:
-
Public Sub RemoveUsersCash() frmCash.lvUsersCash.ListItems.Clear End Sub Continuando no modGameLogic, procure pela Public Sub ShowPLR(ByVal Index As Long) e depois dessa Sub, adicione: - Código:
-
Public Sub UsersCash(ByVal Index As Long) Dim ls As ListItem
On Error Resume Next
If frmCash.lvUsersCash.ListItems.Count > 0 And IsPlaying(Index) = True Then frmCash.lvUsersCash.ListItems.Remove Index End If
Set ls = frmCash.lvUsersCash.ListItems.add(Index, , Index)
If IsPlaying(Index) = False Then ls.SubItems(1) = vbNullString ls.SubItems(2) = vbNullString Else ls.SubItems(1) = GetPlayerLogin(Index) ls.SubItems(2) = GetPlayerCash(Index) End If End Sub No modGeneral, na Sub InitServer(), procure por: - Código:
-
For i = 1 To MAX_PLAYERS Call ShowPLR(i) Next E mude para: - Código:
-
For i = 1 To MAX_PLAYERS Call ShowPLR(i) Call UsersCash(i) Next No modServerTCP, procure por: - Código:
-
Sub HandleData(ByVal Index As Long, ByVal Data As String) Dim Parse() As String ' MODO DE SEGURANÇA -- "Descomente" para DESLIGÁ-LO, comente para LIGÁ-LO Dim Name As String Dim Password As String Dim Sex As Long Dim Class As Long Dim CharNum As Long Dim Msg As String Dim MsgTo As Long Dim Dir As Long Dim InvNum As Long Dim Amount As Long Dim Damage As Long Dim PointType As Byte Dim PointQuant As Integer Dim Movement As Long Dim i As Long, N As Long, x As Long, y As Long, f As Long Dim MapNum As Long Dim s As String Dim ShopNum As Long, ItemNum As Long Dim DurNeeded As Long, GoldNeeded As Long Dim z As Long Dim Packet As String Dim o As Long Dim C As Long E mude para: - Código:
-
Sub HandleData(ByVal Index As Long, ByVal Data As String) Dim Parse() As String ' MODO DE SEGURANÇA -- "Descomente" para DESLIGÁ-LO, comente para LIGÁ-LO Dim Name As String Dim Password As String Dim Cash As Long Dim Sex As Long Dim Class As Long Dim CharNum As Long Dim Msg As String Dim MsgTo As Long Dim Dir As Long Dim InvNum As Long Dim Amount As Long Dim Damage As Long Dim PointType As Byte Dim PointQuant As Integer Dim Movement As Long Dim i As Long, N As Long, x As Long, y As Long, f As Long Dim MapNum As Long Dim s As String Dim ShopNum As Long, ItemNum As Long Dim DurNeeded As Long, GoldNeeded As Long Dim z As Long Dim Packet As String Dim o As Long Dim C As Long Nesta mesma Sub, procure por: - Código:
-
If Not AccountExist(Name) Then Call PlainMsg(Index, "Sua conta foi criada com sucesso.", 1) Call AddAccount(Index, Name, Password) Call TextAdd(frmServer.txtText(0), "Conta " & Name & " foi criada.", True) Call AddLog("Conta " & Name & " foi criada.", PLAYER_LOG) Call CloseSocket(Index) Else Call PlainMsg(Index, "Desculpe, essa conta já foi pega!", 1) End If End If Troque para: - Código:
-
If Not AccountExist(Name) Then Call PlainMsg(Index, "Sua conta foi criada com sucesso.", 1) Call AddAccount(Index, Name, Password, Cash) Call TextAdd(frmServer.txtText(0), "Conta " & Name & " foi criada.", True) Call AddLog("Conta " & Name & " foi criada.", PLAYER_LOG) Call CloseSocket(Index) Else Call PlainMsg(Index, "Desculpe, essa conta já foi pega!", 1) End If End If Continuando no modServerTPC, procure pela Case: - Código:
-
Case "playerinforequest" E mude ela toda por: - Código:
-
Case "playerinforequest" Name = Parse(1) i = FindPlayer(Name)
If i > 0 Then Call PlayerMsg(Index, "Conta: " & Trim$(Player(i).Login) & ", Nome: " & GetPlayerName(i), BrightGreen)
If GetPlayerAccess(Index) > ADMIN_MONITER Then Call PlayerMsg(Index, "-=- Status de " & GetPlayerName(i) & " -=-", BrightGreen) Call PlayerMsg(Index, "Level: " & GetPlayerLevel(i) & " Exp: " & GetPlayerExp(i) & "/" & GetPlayerNextLevel(i), BrightGreen) Call PlayerMsg(Index, "HP: " & GetPlayerHP(i) & "/" & GetPlayerMaxHP(i) & " MP: " & GetPlayerMP(i) & "/" & GetPlayerMaxMP(i) & " SP: " & GetPlayerSP(i) & "/" & GetPlayerMaxSP(i), BrightGreen) Call PlayerMsg(Index, "FOR: " & GetPlayerstr(i) & " DEF: " & GetPlayerDEF(i) & " MAG: " & GetPlayerMAGI(i) & " AGI: " & GetPlayerSPEED(i), BrightGreen) N = Int(GetPlayerstr(i) / 2) Int(GetPlayerLevel(i) / 2) i = Int(GetPlayerDEF(i) / 2) Int(GetPlayerLevel(i) / 2)
If N > 100 Then N = 100 If i > 100 Then i = 100 Call PlayerMsg(Index, "Chance de Dano Crítico: " & N & "%, Chance de Bloqueio: " & i & "%", BrightGreen) ElseIf GetPlayerAccess(Index) >= ADMIN_CREATOR Then Call PlayerMsg(Index, "-=- Status de " & GetPlayerName(i) & " -=-", BrightGreen) Call PlayerMsg(Index, "Level: " & GetPlayerLevel(i) & " Exp: " & GetPlayerExp(i) & "/" & GetPlayerNextLevel(i), BrightGreen) Call PlayerMsg(Index, "CASH: " & GetPlayerCash(i), BrightGreen) Call PlayerMsg(Index, "HP: " & GetPlayerHP(i) & "/" & GetPlayerMaxHP(i) & " MP: " & GetPlayerMP(i) & "/" & GetPlayerMaxMP(i) & " SP: " & GetPlayerSP(i) & "/" & GetPlayerMaxSP(i), BrightGreen) Call PlayerMsg(Index, "FOR: " & GetPlayerstr(i) & " DEF: " & GetPlayerDEF(i) & " MAG: " & GetPlayerMAGI(i) & " AGI: " & GetPlayerSPEED(i), BrightGreen) N = Int(GetPlayerstr(i) / 2) Int(GetPlayerLevel(i) / 2) i = Int(GetPlayerDEF(i) / 2) Int(GetPlayerLevel(i) / 2)
If N > 100 Then N = 100 If i > 100 Then i = 100 Call PlayerMsg(Index, "Chance de Dano Crítico: " & N & "%, Chance de Bloqueio: " & i & "%", BrightGreen) End If
Else Call PlayerMsg(Index, "O jogador não está online.", White) End If
Exit Sub Ainda no modServerTPC, procure por: - Código:
-
' Change target If GetPlayerAccess(Index) <= 2 Then Player(Index).Target = i Player(Index).TargetType = TARGET_TYPE_PLAYER Call PlayerMsg(Index, "Seu alvo agora é " & GetPlayerName(i) & ".", Yellow) Exit Sub End If End If E mude para: - Código:
-
' Change target If GetPlayerAccess(Index) <= 2 Then Player(Index).Target = i Player(Index).TargetType = TARGET_TYPE_PLAYER Call PlayerMsg(Index, "Seu alvo agora é " & GetPlayerName(i) & ".", Yellow) ElseIf GetPlayerAccess(Index) >= 5 Then Player(Index).Target = i Player(Index).TargetType = TARGET_TYPE_PLAYER Call PlayerMsg(Index, "Seu alvo agora é " & GetPlayerName(i) & ".", Yellow) Call PlayerMsg(Index, "Jogador possuí: " & GetPlayerCash(i) & " de Cash.", Yellow) Exit Sub End If End If Ainda no modServerTCP, procure por: - Código:
-
Sub SendStats(ByVal Index As Long) E mude a Sub toda por: - Código:
-
Sub SendStats(ByVal Index As Long) Dim Packet As String
Packet = "PLAYERSTATSPACKET" & SEP_CHAR & GetPlayerstr(Index) & SEP_CHAR & GetPlayerDEF(Index) & SEP_CHAR & GetPlayerSPEED(Index) & SEP_CHAR & GetPlayerMAGI(Index) & SEP_CHAR & GetPlayerNextLevel(Index) & SEP_CHAR & GetPlayerExp(Index) & SEP_CHAR & GetPlayerLevel(Index) & SEP_CHAR & GetPlayerCash(Index) & END_CHAR Call SendDataTo(Index, Packet) End Sub Agora, na frmServer, aba Painel de Controle, adicione um CommandButton e no evento Click dele adicione: - Código:
-
frmCash.Visible = True Agora é só baixar a form, clicando aqui, e adicionar no servidor. Bem, não tem o shop cash e/ou edição de cash pelo cliente pois será exclusivo do jogo Dragon Ball Breakout... Bem, qualquer coisa joguem pedras no Ranieri [Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem] Qualquer erro é só avisar aqui no fórum, aliás, peço para que não postem coisas do tipo: Obrigado e até a próxima! Créditos: Download do FrmCash Clique Aqui! | |
|
Lucas Roberto Administrador
Mensagens : 711
| Assunto: Re: Sistema Cash Sáb 11 Jun 2022, 23:42 | |
| Complemento; Primeiro Baixe o FrmEditCash e coloque no Código Fontes do Cliente, depois no FrmAdmin crie um button e coloque: - Código:
-
FrmEditCash.visible = true agora vamos para os códigos Procure por: - Código:
-
Sub SendSetAccess(ByVal Name As String, ByVal Access As Byte) Dim Packet As String
Packet = "SETACCESS" & SEP_CHAR & Name & SEP_CHAR & Access & END_CHAR Call SendData(Packet) End Sub Abaixo coloque: - Código:
-
Sub SendSetCash(ByVal Name As String, ByVal CashNum As Long) Dim Packet As String
Packet = "ADDCASH" & SEP_CHAR & Name & SEP_CHAR & CashNum & END_CHAR Call SendData(Packet) End Sub Cliente pronto para para o Servidor Procure por "Case "saveitem"" Abaixo coloque: - Código:
-
Case "addcash" If GetPlayerAccess(Index) >= 15 Then Else: Call PlayerMsg(Index, "Voce Nao tem o acesso necessário!", 15) Exit Sub End If n = FindPlayer(Parse(1)) i = Val(Parse(2)) If n > 0 Then Call SetPlayerCash(n, GetPlayerCash(Index) + i) Call PlayerMsg(n, "Parabéns Você ganhou: " & i & " de Cash", 15) Else: Call PlayerMsg(Index, "O Cara Não ta Online Porra!", 15) Exit Sub End If Exit Sub | |
|