[Tool/Web/Other] [C++] SampFavorites - C++ class for working with SA-MP favorites list (USERDATA.DAT)
#1

SampFavorites
About
C++ class for working with SA-MP favorites list (USERDATA.DAT).

Usage
The example of usage this class:
PHP Code:
#include <iostream>
#include "SampFavorites.hpp"
int main()
{
    
SampFavorites data;
    
data.open("USERDATA.DAT");
    if (!
data.isOpen()) {
        
std::cout << "Error reading file" << std::endl;
        return 
1;
    }
    
SampFavorites::Header header;
    
SampFavorites::Server server;
    
header data.getHeader();
    
std::cout << header.fileTag << "\n"
              
<< header.fileVersion << "\n"
              
<< header.serversCount << "\n";
    for (
int i 0header.serversCounti++) {
        
server data.getServer(i);
        
std::cout << server.address << " | "
                  
<< server.port << " | "
                  
<< server.hostname << " | "
                  
<< server.password << " | "
                  
<< server.rcon << std::endl;
    }
    
server.address = (char *)"999.000.111.32";
    
server.port 4322;
    
server.hostname = (char *)"test host";
    
server.password = (char *)"pass22";
    
server.rcon = (char *)"rcon1";
    
data.addServer(server);
    
data.save("test.dat");
    return 
0;

Download
- GitHub download page: https://github.com/Open-GTO/SampFavorites/releases
Reply
#2

Simple but nice effort.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)