Option Explicit     'Quake 3 Arena 1.16 Class by: USALI
Public IsRunning        As String 'shows if quake is running
Public GetGameFolderLoc As String 'gets game folder location
Public GetExeLoc        As String 'get quake3.exe location
Public GetCFGLoc        As String 'gets the location of the player config(cfg) file (have to be connected to a server)
Public Getq3KeyLoc      As String 'gets the location of the q3key(cdkey) file (have to be connected to a server)
Public GetModType       As String 'tells you the mod type
Public FragLine         As String 'x Fragged X
Public ConsoleChat      As String 'shows text typed by players
Public ServerMsgs       As String 'gets server info such as server name, total players, mod, etc...
Public ServerInfo       As String 'same as above but a little better
Public LastConsoleCMD   As String 'shows the last console command typed
Public GetCDKey         As String 'grabs the persons CDKey
Public MapName          As String 'gets map name
Public GetPing          As Long   'gets your current ping
Public GetServerIP      As String 'gets the ip of the current server your in
Public GetUserinfo      As String 'gets the userinfo such as name, cl_maxpackets, snaps, rate, etc..
Public GetKills         As Long   '# of kills
Public GetShotsFired    As Long   '# of shots fired per game
Public GetDeaths        As Long   '# of deaths
Public GetSpawnCount    As Long   '# of times you've spawned
Public GetAmmoRL        As Long   'Ammo of Rocket Launcher
Public GetAmmoGL        As Long   'Ammo of Grenade Launcher
Public GetAmmoMG        As Long   'Ammo of Machine Gun
Public GetAmmoSG        As Long   'Ammo of Shot Gun
Public GetAmmoLG        As Long   'Ammo of Lightning Gun
Public GetAmmoRG        As Long   'Ammo of Rail Gun
Public GetAmmoPG        As Long   'Ammo of Plasma Gun
Public GetAmmoBFG       As Long   'Ammo of BFG
Public GetTeam          As Long   'gets team #, 3 = spectating, 1 = red, 2 = blue
Public GetHealth        As Long   'gets health count
Public GetArmor         As Long   'gets armor count
Public GetModel         As String 'gets model name
Public GetRedScore      As Long   'gets the score for red team
Public GetBlueScore     As Long   'gets the score for blue team
Public GetMaxFPS        As Long   'gets player fps
Public GetAccuracy      As Long   'gets accuracy of player

Public Sub GetPlayerInfo()
IsRunning = ReadAscii(&H5A9385, 256)
GetGameFolderLoc = ReadAscii(&H5A9170, 999)
GetExeLoc = ReadAscii(&H5F3E84, 999)
Getq3KeyLoc = ReadAscii(&H583268, 999)
GetCFGLoc = ReadAscii(&H5831E8, 999)
GetModType = ReadAscii(&H583334, 999)
FragLine = ReadAscii(&HFBD944, 999)
ConsoleChat = ReadAscii(&HFBD954, 999)
ServerMsgs = ReadAscii(&H58B8D8, 999)
ServerInfo = ReadAscii(&H589578, 999)
LastConsoleCMD = ReadAscii(&H7782ED, 32)
GetCDKey = ReadAscii(&H4B3324, 32)
MapName = ReadAscii(&H5B0168, 32)
GetPing = ReadALong(&H6D7DDC, 999)
GetServerIP = ReadAscii(&H58BCD8, 32)
GetUserinfo = ReadAscii(&H580AD8, 999)
GetKills = ReadALong(&H6CE9D8, 999)
GetShotsFired = ReadALong(&H6CEA08, 999)
GetDeaths = ReadALong(&H6CE9F8, 999)
GetSpawnCount = ReadALong(&H6CE9E8, 999)
GetAmmoRL = ReadALong(&H6CEA6C, 999)
GetAmmoGL = ReadALong(&H6CEA68, 999)
GetAmmoMG = ReadALong(&H6CEA60, 999)
GetAmmoSG = ReadALong(&H6CEA64, 999)
GetAmmoLG = ReadALong(&H6CEA70, 999)
GetAmmoRG = ReadALong(&H6CEA74, 999)
GetAmmoPG = ReadALong(&H6CEA78, 999)
GetAmmoBFG = ReadALong(&H6CEA7C, 999)
GetTeam = ReadALong(&H6CE9E4, 16)
GetHealth = ReadALong(&H6CE998, 999)
GetArmor = ReadALong(&H6CE9A4, 999)
GetModel = ReadAscii(&H5ADFD0, 999)
GetRedScore = ReadALong(&H408A010, 999)
GetBlueScore = ReadALong(&H408A014, 999)
GetMaxFPS = ReadALong(&H68B130, 999)
GetAccuracy = ReadALong(&H448E3E9, 999)
End Sub

Public Function ReadAscii(StartAddress As Long, Lenght As Integer) As String
        Dim Address As Long, data As Integer
            For Address = StartAddress To (StartAddress + (Lenght - 1))
                data = ReadAByte(Address, 1)
                    If data <= 0 Then Exit For
                        ReadAscii = ReadAscii & Chr(data)
            Next Address
End Function


Public Function ReadALong(Address As Long, ByteBuffer As Long)
    Dim pid&, phandle&
        If FindProcess = 0 Then Exit Function
            GetWindowThreadProcessId FindProcess, pid
            phandle = OpenProcess(&H1F0FFF, False, pid)
        If phandle = 0 Then Exit Function
            RPM phandle, Address, ByteBuffer, 4, 0&
            ReadALong = ByteBuffer
CloseHandle phandle
End Function