PHP Code:
/* Plugin Template generated by Pawn Studio */
#include <sourcemod>
public Plugin:myinfo =
{
name = "Sourcep's DB",
author = "Sputnik/miniman",
description = "SourceOP's database decompiler",
version = "0.1",
url = "SM"
}
#define CLIENTSTOLOAD 100
/*typedef struct creditsver_s
{
char type[12];
int ver;
} creditsver_t;
typedef struct credits_t
{
char szSteamID[24]; //player's SteamID
int credits; //amount of credits
int timeonserver; //the time the player has been on the server
unsigned long lastsave; //time in seconds since UTC 1/1/70
int totalconnects; //previously total credits
int iuser1; //stores flags
char emptyspace[64]; //for future use
char FirstName[36]; //stores the player's first ever name used
char LastName[36]; //stores the player's last used name
char CurrentName[36];//stores the player's name during save
} credits_t;
*/
new String:szSteamID[CLIENTSTOLOAD][24];
new credits[CLIENTSTOLOAD];
new timeonserver[CLIENTSTOLOAD];
new lastsave[CLIENTSTOLOAD];
new totalconnects[CLIENTSTOLOAD];
new iuser1[CLIENTSTOLOAD];
//emptyspace[64] ... lol
new String:FirstName[CLIENTSTOLOAD][36];
new String:LastName[CLIENTSTOLOAD][36];
new String:CurrentName[CLIENTSTOLOAD][36];
public OnPluginStart()
{
RegAdminCmd("sm_loadsop",LoadSop,ADMFLAG_ROOT);
}
public Action:LoadSop(client,args)
{
if(!FileExists("addons/SourceOP/DF_credits.cdb"))
{
PrintToServer("File does not exist");
return Plugin_Handled;
}
new Handle:DB=OpenFile("addons/SourceOP/DF_credits.cdb","r");
decl String:Type[12]="0";
ReadFileString(DB,Type,12);
if(strcmp("SOPCRED",Type)!=0)
{
PrintToServer("Type file problem Another version?");
return Plugin_Handled;
}
FileSeek(DB,12,SEEK_SET);
new version;
ReadFileCell(DB,version,4);
if(version!=1)
{
PrintToServer("The Version of the databse %i does not supported by the plugin",version);
}
new LastPos;
new i =0;
new size=FileSize("addons/SourceOP/DF_credits.cdb");
do
{
LastPos=FilePosition(DB);
ReadFileString(DB,szSteamID[i],24);
FileSeek(DB,LastPos+24,SEEK_SET);
LogToFile("DB.txt","SteamId: %s",szSteamID[i]);
ReadFileCell(DB,credits[i],4);
LogToFile("DB.txt","Credits: %i",credits[i]);
ReadFileCell(DB,timeonserver[i],4);
LogToFile("DB.txt","TimeOnServer: %i",timeonserver[i]);
ReadFileCell(DB,lastsave[i],4);
LogToFile("DB.txt","LastSave: %i",lastsave[i]);
ReadFileCell(DB,totalconnects[i],4);
LogToFile("DB.txt","TotalConnects: %i",totalconnects[i]);
ReadFileCell(DB,iuser1[i],4);
LogToFile("DB.txt","UserFlags: %i",iuser1[i]);
LastPos=FilePosition(DB);
FileSeek(DB,LastPos+64,SEEK_SET);
LastPos=FilePosition(DB);
ReadFileString(DB,FirstName[i],36);
FileSeek(DB,LastPos+36,SEEK_SET);
LogToFile("DB.txt","Firstname: %s",FirstName[i]);
LastPos=FilePosition(DB);
ReadFileString(DB,LastName[i],36);
FileSeek(DB,LastPos+36,SEEK_SET);
LogToFile("DB.txt","LastName: %s",LastName[i]);
LastPos=FilePosition(DB);
ReadFileString(DB,CurrentName[i],36);
FileSeek(DB,LastPos+36,SEEK_SET);
LogToFile("DB.txt","CurrentName: %s",CurrentName[i]);
i++;
}
while(i<CLIENTSTOLOAD&&(216*i+16)<size)
CloseHandle(DB);
return Plugin_Handled;
}
This plugin decompiles the sourceop's database and saves it to DB.txt in the mod folder