Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with .INI files....
#1
Currently, I am working with some code that hopefully when finished will accomplish the fallowing task. What I want is so that every time there is a player killer event, it increases your score based on the level difference (Less then, Equal, or greater then). However, I don't know how to use MySQL and I have no intention of learning it currently, so this left me with only one option... .ini files, which I have never used before. I was getting some help from someone on the basics (get var/putvar) but unfortinatly I need some more assistance. For anyone interested, I'll give you as much information as possible on what I want, and what I already have done...

- Upon Char creation it creates a new line in the .ini file ( CharName = 0 )
- Upon char deletion, it deletes that character in the .ini file
- Every time someone kills someone else, it increses the killers score in the .ini file
- Based on a timer on the client (or another good idea if anyone has one), it sends a packet to the server and requests the information from it.
----------------
Here are the segments of code that I have currently...


::Server Side::

- The packet (unfinished)
Code:
' :::::::::::::::::::::::::::::
        ' :: Player Killer LB packet ::
        ' :::::::::::::::::::::::::::::
        If LCase(Parse(0)) = CPNPKLLeader Then
            Call PlayerMsg(Index, "Packet is retreiveing new player killer information", Red)
            '***Retreive information***
        End If
    Exit Sub

- In the AddChar sub, near the bottom before it saves, I added this to create a new char on the ini file
Code:
' Saves the chars name to 0 on the player leaderboards
        Dim FileName As String
        FileName = App.Path & "\Data\PKLeaderboards.ini"
        Call PutVar(FileName, "PVP Kill Leaderboard", Trim(Player(Index).Char(CharNum).Name), "0")

- In modGameLogic, under "Has been deemed a player killer!" I placed this, and two others simler to it to act out different senerios for killing...

Code:
Dim PKLAmount As Integer, PKTotal As Integer
      Dim FileName As String
                
      ' Kill a lower level player
      If Player(Attacker).Level > Player(Victim).Level Then
          PKLAmount = 5
          FileName = App.Path & "\Data\PKLeaderboards.ini"
          PKTotal = GetVar(FileName, "PVP Kill Leaderboard", Trim(Player(Index).Char(CharNum).Name))
          Call PutVar(FileName, "PVP Kill Leaderboard", Trim(Player(Index).Char(CharNum).Name), PKTotal + PKLAmount)
      End If

::Client Sided::

- Packet Information

Code:
Sub PKLPacket(ByVal First As Integer, second As Integer, third As Integer)
Dim Packet As String

    Packet = CPNPKLLeader & SEP_CHAR & First & SEP_CHAR & second & SEP_CHAR & third & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub

This is basically all I have currently. If you can give me some segments of code or an idea on how to delete the line for the "DelChar" sub, that would be a good start for me. I also need help with displaying the information onto the frmMirage once I get the packet sending the information back and fourth.

Pleas and thank you!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)