Browse Source

хуета

master
gsd 1 year ago
parent
commit
3609e065f6
  1. 61
      FSB_BanSystem/fsb.sp
  2. 4
      FSB_BanSystem/modules/bans.sp
  3. 61
      FSB_BanSystem/modules/killfeed.sp
  4. 78
      FSB_BanSystem/modules/messages.sp
  5. BIN
      FSB_BanSystem/plugins/killfeed.smx
  6. BIN
      FSB_BanSystem/plugins/messages.smx
  7. 32
      PipeRemover/pipe_remover.sp
  8. 103
      TradeBlocker.sp
  9. BIN
      plugins/fsb.smx
  10. BIN
      plugins/pipe_remover.smx
  11. 294
      sql_userconnections.sp

61
FSB_BanSystem/fsb.sp

@ -1,7 +1,10 @@
#include <sourcemod> #include <sourcemod>
#define _ban_module #define _ban_module
//#define _mute_module #define _message_module
#define _mute_module
#define _killfeed_module
//#define _steam_backend //#define _steam_backend
#if defined _ban_module #if defined _ban_module
@ -12,7 +15,16 @@
#include "modules/mutes.sp" #include "modules/mutes.sp"
#endif #endif
#define PLUGIN_VERSION "2.0" #if defined _message_module
#include "modules/messages.sp"
#endif
#if defined _killfeed_module
#include "modules/killfeed.sp"
#endif
#define PLUGIN_VERSION "3.0"
public Plugin:myinfo = { public Plugin:myinfo = {
name = "Facti13 System Browser", name = "Facti13 System Browser",
author = "gsd", author = "gsd",
@ -22,19 +34,52 @@ public Plugin:myinfo = {
}; };
char g_Database_Name[32] = "sql_bans"; char g_Database_Name[32] = "sql_bans";
char g_MainChatPrefix[32] = "[FSB]" char g_MainChatPrefix[32] = "[FSB]";
Handle g_server_id_convar = INVALID_HANDLE;
//MAIN //MAIN
public OnPluginStart() { public OnPluginStart() {
g_server_id_convar = CreateConVar("sm_fsb_server_id", "", "fsb server id");
LoadConfig(); LoadConfig();
SetupDB(); SetupDB();
#if defined _mute_module #if defined _mute_module
MuteSetup() MuteSetup();
#endif
#if defined _message_module
MessageSetup();
#endif
#if defined _killfeed_module
KillfeedSetup();
#endif #endif
RegAdminCmd("sm_fsb_reload", COMMAND_ReloadCfg, ADMFLAG_ROOT); RegAdminCmd("sm_fsb_reload", COMMAND_ReloadCfg, ADMFLAG_ROOT);
HookConVarChange(g_server_id_convar, OnServerIdChanged);
}
public OnServerIdChanged(Handle:cvar, const String:oldVal[], const String:newVal[]) {
#if defined _message_module
messagesSetServerId(newVal, 32);
#endif
#if defined _killfeed_module
killfeedSetServerId(newVal, 32);
#endif
}
public OnMapStart() {
char server_id[32];
GetConVarString(g_server_id_convar, server_id, sizeof(server_id));
#if defined _message_module
messagesSetServerId(server_id, 32);
#endif
#if defined _killfeed_module
killfeedSetServerId(server_id, 32);
#endif
if (strlen(server_id) == 0)
LogError("sm_fsb_server_id is not setted");
} }
public OnPluginEnd() { public OnPluginEnd() {
@ -78,6 +123,14 @@ public GotDatabase(Handle:owner, Handle:hndl, const String:error[], any:data) {
#if defined _mute_module #if defined _mute_module
g_hMuteDatabase = hndl; g_hMuteDatabase = hndl;
#endif #endif
///////////////////////////////
#if defined _message_module
g_hMessageDatabase = hndl;
#endif
///////////////////////////////
#if defined _killfeed_module
g_hKillfeedDatabase = hndl;
#endif
} }
} }

4
FSB_BanSystem/modules/bans.sp

@ -226,6 +226,10 @@ public Callback_Unban(Handle:owner, Handle:hndl, const String:error[], any:data)
//ACTIONS //ACTIONS
public Action:OnBanClient(int client, int time, int flags, const String:reason[], const String:kick_message[], const String:command[], any:admin) { public Action:OnBanClient(int client, int time, int flags, const String:reason[], const String:kick_message[], const String:command[], any:admin) {
if (client == 0) {
ReplyToCommand(client, "Cannot ban from RCON");
return Plugin_Stop;
}
char Query[512]; char Query[512];
char QueryPayload[11][256]; char QueryPayload[11][256];
/* 0/5 - Client SteamID /* 0/5 - Client SteamID

61
FSB_BanSystem/modules/killfeed.sp

@ -0,0 +1,61 @@
#include <sourcemod>
char g_KillfeedChatPrefix[16] = "[FSB.Message]";
char g_KillfeedTableName[32] = "user_killfeed";
char g_SQL_QUERY_ADDKILL[512] = "INSERT INTO `%s` (`attacker_id`, `victim_id`, `assister_id`, `utime`, `weapon_name`, `weapon_id`, `weapon_classname`, `weapon_index`, `custom_kill`, `crit_type`, `server_id`) VALUES ('%d', '%d', '%d', '%d', '%s', '%d', '%s', '%d', '%d', '%d', '%s')";
Handle g_hKillfeedDatabase = INVALID_HANDLE;
char g_kf_server_id[32] = "";
stock KillfeedSetup(){
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post);
}
stock killfeedSetServerId(const char[] server_id, int size) {
strcopy(g_kf_server_id, size, server_id);
PrintToServer("%s server id is setted: %s", g_KillfeedChatPrefix, g_kf_server_id)
}
public CallBack_AddKill(Handle:owner, Handle:hndl, const String:error[], any:data) {
if (hndl == INVALID_HANDLE) {
LogError("%s Query failed! %s", g_KillfeedChatPrefix, error);
return;
}
}
stock void AddKill(int victim_id, int attacked_id, int assister_id,
const String:weapon_name[], int weapon_id, const String:weapon_classname[],
int weapon_index, int custom_kill, int crit_type) {
char Query[512];
Format(Query, sizeof(Query), g_SQL_QUERY_ADDKILL, g_KillfeedTableName,
attacked_id, victim_id, assister_id,
GetTime(), weapon_name, weapon_id, weapon_classname, weapon_index,
custom_kill, crit_type, g_kf_server_id);
SQL_TQuery(g_hKillfeedDatabase, CallBack_AddKill, Query, 0);
}
public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) {
//user data
int victim_id = GetEventInt(event, "userid"); //user ID who died
if (victim_id > 0) victim_id = GetSteamAccountID(GetClientOfUserId(victim_id), true);
int attacker_id = GetEventInt(event, "attacker"); //user ID who killed
if (attacker_id > 0) attacker_id = GetSteamAccountID(GetClientOfUserId(attacker_id), true);
int assister_id = GetEventInt(event, "assister"); //user ID of assister
if (assister_id > 0) assister_id = GetSteamAccountID(GetClientOfUserId(assister_id), true);
//weapon data
char weapon_name[64];
GetEventString(event, "weapon", weapon_name, sizeof(weapon_name)); //weapon name killer used
int weapon_id = GetEventInt(event, "weaponid"); //ID of weapon killed used
char weapon_classname[64];
GetEventString(event, "weapon_logclassname", weapon_classname, sizeof(weapon_classname)); //weapon name that should be printed on the log
int weapon_index = GetEventInt(event, "weapon_def_index"); //item def index of weapon killer used
//death data
int custom_kill = GetEventInt(event, "customkill");//type of custom kill
int crit_type = GetEventInt(event, "crit_type");//Crit type of kill. (0: None, 1: Mini, 2: Full)
AddKill(victim_id, attacker_id, assister_id, weapon_name, weapon_id, weapon_classname, weapon_index, custom_kill, crit_type);
return Plugin_Continue;
}

78
FSB_BanSystem/modules/messages.sp

@ -0,0 +1,78 @@
#include <sourcemod>
char g_MessageChatPrefix[16] = "[FSB.Message]";
char g_MessageTableName[32] = "user_messages";
char g_SQL_QUERY_ADDMESSAGE[512] = "INSERT INTO `%s` (`account_id`, `utime`, `message`, `server_id`) VALUES ('%d', '%d', '%s', '%s')";
Handle g_hMessageDatabase = INVALID_HANDLE;
char g_messages_server_id[32] = "";
stock messagesSetServerId(const char[] server_id, int size) {
strcopy(g_messages_server_id, size, server_id);
PrintToServer("%s server id is setted: %s", g_MessageChatPrefix, g_messages_server_id)
}
stock MessageSetup(){
RegConsoleCmd("say", SayHook);
RegConsoleCmd("say_team", SayHook);
}
stock bool MessageTable_VerifyTable(const char[] database_name, const char[] table_name){
char error[255], query[2048];
new db = SQL_Connect(database_name, true, error, sizeof(error));
if (db == INVALID_HANDLE) {
LogError("%s Cannot connect to Database: %s", g_MessageChatPrefix, database_name);
return false;
}
Format(query, sizeof(query), "%s%s%s%s%s%s%s%s",
"CREATE TABLE IF NOT EXISTS `",
g_MessageTableName,
"`id` int(11) NOT NULL,"
"`account_id` int(11) NOT NULL,"
"`utime` bigint(20) NOT NULL,"
"`message` varchar(512) NOT NULL,"
"`server_id` varchar(32) NOT NULL"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
bool success = SQL_FastQuery(db, query);
if(!success) {
SQL_GetError(db, error, sizeof(error));
LogError("%s [ERROR] Unable to verify %s table:%s", g_MessageChatPrefix, g_MessageTableName, query);
LogError("%s [ERROR] %s", g_MessageChatPrefix, error);
}
CloseHandle(db);
return true;
}
stock void AddMessage(int account_id, const String:message[]) {
char Query[512];
char EscMessage[256];
SQL_EscapeString(g_hMessageDatabase, message, EscMessage, sizeof(EscMessage));
Format(Query, sizeof(Query), g_SQL_QUERY_ADDMESSAGE, g_MessageTableName, account_id, GetTime(), EscMessage, g_messages_server_id);
SQL_TQuery(g_hMessageDatabase, CallBack_AddMessage, Query, 0);
}
public CallBack_AddMessage(Handle:owner, Handle:hndl, const String:error[], any:data) {
if (hndl == INVALID_HANDLE) {
LogError("%s Query failed! %s", g_MessageChatPrefix, error);
return;
}
}
public Action SayHook(int cid, int args){
char message[256];
GetCmdArgString(message, sizeof(message));
StripQuotes(message);
if (message[1] == '!' || message[0] == '!'){//1 потому что ебаные " при вызове GetCmdArgString
return Plugin_Continue;
}
int account_id = GetSteamAccountID(cid, true);
AddMessage(account_id, message);
return Plugin_Continue;
}

BIN
FSB_BanSystem/plugins/killfeed.smx

Binary file not shown.

BIN
FSB_BanSystem/plugins/messages.smx

Binary file not shown.

32
PipeRemover/pipe_remover.sp

@ -0,0 +1,32 @@
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#define nigga_bomb "tf_projectile_pipe_remote"
public Plugin:myinfo =
{
name = "Pipe remover",
author = "gsd",
description = "i hate bugs",
version = "1.0",
url = "https://tf2.pblr-nyk.pro/"
}
public OnEntityCreated (entity, const String:classname[]) {
if(StrEqual(classname, nigga_bomb))
{
//PrintToChatAll("%d place pipe", GetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity"));
SDKHook(entity, SDKHook_Touch, OnPipeTouch);
}
}
public OnPipeTouch(entity, place) {
char place_name[64];
GetEdictClassname(place, place_name, 64);
//PrintToChatAll("pipe touch, %d, %d, %s", entity, place, place_name);
if (StrEqual(place_name, "prop_dynamic")) {
//PrintToChatAll("pipe need dead");
RemoveEntity(entity);
}
}

103
TradeBlocker.sp

@ -0,0 +1,103 @@
#include <sourcemod>
#include <regex>
#define MAX_ARRAY_SIZE 32
#define MAX_MESSAGE_SIZE 256
//TODO MySql Get
char badwords[MAX_ARRAY_SIZE][MAX_MESSAGE_SIZE];
public OnPluginStart() {
fillMe()
AddCommandListener(IncomingMessage, "say");
AddCommandListener(IncomingMessage, "say_team");
AddCommandListener(IncomingMessage, "say2");
}
public OnPluginEnd() {
clearMe()
RemoveCommandListener(IncomingMessage, "say");
RemoveCommandListener(IncomingMessage, "say_team");
RemoveCommandListener(IncomingMessage, "say2");
}
public Action:IncomingMessage(client, const String:command[], args) {
char message[MAX_MESSAGE_SIZE];
GetCmdArgString(message, sizeof(message));
StripQuotes(message);
if (search(message)) {
//FakeClientCommand(client, "explode");
createGayBomb(client);
return Plugin_Handled;
} else return Plugin_Continue;
}
stock clearMe() {
for (int i = 0; i < MAX_ARRAY_SIZE;i++) {
badwords[i][0] = '\0';
}
}
stock fillMe() {
clearMe()
Format(badwords[0], MAX_MESSAGE_SIZE, "трейд");
Format(badwords[1], MAX_MESSAGE_SIZE, "trade");
Format(badwords[2], MAX_MESSAGE_SIZE, "обмен");
Format(badwords[3], MAX_MESSAGE_SIZE, "oбмен");
Format(badwords[4], MAX_MESSAGE_SIZE, "обмeн");
Format(badwords[5], MAX_MESSAGE_SIZE, "oбмeн");
Format(badwords[6], MAX_MESSAGE_SIZE, "trаde");
Format(badwords[7], MAX_MESSAGE_SIZE, "tradе");
Format(badwords[8], MAX_MESSAGE_SIZE, "trаdе");
Format(badwords[9], MAX_MESSAGE_SIZE, "трeйд");
Format(badwords[10], MAX_MESSAGE_SIZE, "тpейд");
Format(badwords[11], MAX_MESSAGE_SIZE, "тpeйд");
Format(badwords[12], MAX_MESSAGE_SIZE, "куплю");
Format(badwords[13], MAX_MESSAGE_SIZE, "продам");
Format(badwords[14], MAX_MESSAGE_SIZE, "sell");
Format(badwords[15], MAX_MESSAGE_SIZE, "sеll");
}
stock genMessage(char[] buffer, int size) {
switch (GetRandomInt(0, 3)) {
case 0: {
Format(buffer, size, "Отсосу за %d рефов", GetRandomInt(10, 99));
}
case 1: {
Format(buffer, size, "Отдам жопу за %d ключей", GetRandomInt(5, 14));
}
case 2: {
Format(buffer, size, "Отдаю родную мать за %d ключей и %d рефов", GetRandomInt(10, 99), GetRandomInt(5,84));
}
case 3: {
Format(buffer, size, "Бесплатно отдамся в руки фембойчику");
}
}
}
stock bool search(const char[] message) {
for (int i = 0; i < MAX_ARRAY_SIZE;i++) {
if (strlen(badwords[i]) == 0) return false;
if (StrContains(message, badwords[i], false) != -1) {
PrintToServer("Found bad word: %s", badwords[i]);
return true;
}
}
return false;
}
stock createGayBomb(client) {
int uid = GetClientUserId(client);
CreateTimer(0.01, GayBomb, uid, TIMER_FLAG_NO_MAPCHANGE);
}
public Action GayBomb(Handle timer, any data) {
int client = GetClientOfUserId(data);
if (client != 0) {
char b[MAX_MESSAGE_SIZE];
genMessage(b, MAX_MESSAGE_SIZE);
FakeClientCommand(client, "say \"%s\"", b);
}
return Plugin_Stop;
}

BIN
plugins/fsb.smx

Binary file not shown.

BIN
plugins/pipe_remover.smx

Binary file not shown.

294
sql_userconnections.sp

@ -0,0 +1,294 @@
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.3"
public Plugin:myinfo = {
name = "[ANY] User Control",
author = "gsd",
description = "Append user connect and disconnect inforamations, for control.Nickname, SteamID, IP, Total game time on server.",
version = PLUGIN_VERSION,
url = "https://kremlin.ru"
};
int iPlayedTime[101] = {-1, ...};
new Handle:hDatabase = INVALID_HANDLE;
////////////////////////////////////////////////////////////
public APLRes:AskPluginLoad2(Handle:hMyself, bool:bLate, String:strError[], iErr_Max){
RegPluginLibrary("usercontrol");
CreateNative("UserControl_PlayedTime", Native_GetClientPlayerTime);
return APLRes_Success;
}
public Native_GetClientPlayerTime(Handle:plugin, numParams){
new client = GetNativeCell(1);
if(client < 1 || client > MaxClients){
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client index %i", client);
return false;
}
if(!IsClientInGame(client)){
ThrowNativeError(SP_ERROR_PARAM, "Client %i is not in game!", client);
return false;
}
return iPlayedTime[client];
}
////////////////////////////////////////////////////////////
public OnPluginStart() {
VerifyTable();
StartSQL();
CreateConVar("sm_ucontrol_version", PLUGIN_VERSION, "User Connection Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("player_disconnect", event_PlayerDisconnect, EventHookMode_Pre);
}
StartSQL() {
SQL_TConnect(GotDatabase, "usercontrol");
}
public GotDatabase(Handle:owner, Handle:hndl, const String:error[], any:data) {
if (hndl == INVALID_HANDLE) {
LogError("Database Connection Error: %s", error);
} else {
hDatabase = hndl;
}
}
public int CopyString(const String:Source[], String:Buffer[]){
new EndPos;
for (new CurrentPos = 0; CurrentPos < strlen(Source); CurrentPos++){
Buffer[CurrentPos] = Source[CurrentPos];
EndPos = CurrentPos;
}
Buffer[EndPos+1] = '\0';
return EndPos;
}
bool:VerifyTable() {
decl String:error[255];
decl String:query[512];
query[0] = '\0';
new Handle:db = SQL_Connect("usercontrol", true, error, sizeof(error));
if (db == INVALID_HANDLE) {
LogError("Could Not Connect to Database, error: %s", error);
return false;
}
Format(query, sizeof(query), "%s%s%s%s%s%s%s%s%s%s",
"CREATE TABLE IF NOT EXISTS `user_connections` (",
" `player_name` VARCHAR(64) NOT NULL ,",
" `steam_id` VARCHAR(32) NOT NULL ,",
" `connect_ip` VARCHAR(15) NOT NULL ,",
" `account_id` BIGINT NOT NULL ,",
" `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,",
" `map` VARCHAR(256) NOT NULL ,",
" `connection_type` VARCHAR(10) NOT NULL ,",
" `connect_duration` INT NOT NULL ",
") ENGINE = MyISAM DEFAULT CHARSET=utf8mb4; ");
new bool:success = SQL_FastQuery(db, query);
if(!success) {
SQL_GetError(db, error, sizeof(error));
LogError("Unable to verify mysql_bans table:%s", query);
}
CloseHandle(db);
return true;
}
public T_SendQuery(Handle:owner, Handle:hndl, const String:error[], any:data) {
if (hndl == INVALID_HANDLE) {
LogError("Query failed! %s", error);
}
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////
public void OnClientAuthorized(int client)
{
GetPlayTimeTotal(client);
}
int GetPlayTimeTotal(int client) {
char Query[512];
int AccountID = GetSteamAccountID(client, true);
char Map[128];
GetCurrentMap(Map,sizeof(Map));
Format(Query, sizeof(Query), "SELECT SUM(connect_duration) total FROM user_connections WHERE connection_type LIKE 'disconnect' AND account_id = %d AND map LIKE '%s'", AccountID, Map);
SQL_TQuery(hDatabase, GetPlayTimeTotalCallback, Query, GetClientUserId(client));
return 0;
}
stock void GetPlayTimeTotalCallback(Handle owner, Handle hndl, char [] error, any data) {
int client;
if((client = GetClientOfUserId(data)) == 0)
{
return;
}
char PlayerName[64];
GetClientName(client, PlayerName, sizeof(PlayerName));
if(hndl == INVALID_HANDLE)
{
LogError("Query failure: %s", error);
return;
}
if (SQL_FetchRow(hndl)) {
iPlayedTime[client] = SQL_FetchInt(hndl, 0);
} else {
iPlayedTime[client] = -1;
}
}
public void OnClientDisconnect(int client)
{
iPlayedTime[client] = -1;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public OnClientPostAdminCheck(client) {
//User Connect to Server
if(IsFakeClient(client)) {
return;
}
//Vars
new String:error[1024];
DataPack hPayload = new DataPack();
/*
0 - User ID INT
1 - Account ID INT
2 - Steam ID STRING
3 - Connection Type STRING
4 - Conncetion IP STRING
5 - Player Name STRING
6 - Disconnect Reason STRING
7 - Game Time On Server STRING
*/
WritePackCell(hPayload, GetClientUserId(client));
WritePackCell(hPayload, GetSteamAccountID(client, true));
char SteamID[64];
GetClientAuthString(client, SteamID, sizeof(SteamID));
WritePackString(hPayload, SteamID);
char ConnectionType[16];
Format(ConnectionType, sizeof(ConnectionType), "%s", "connect");
WritePackString(hPayload, ConnectionType);
char ConnectionIP[16];
GetClientIP(client, ConnectionIP, sizeof(ConnectionIP));
WritePackString(hPayload, ConnectionIP);
char PlayerName[64];
GetClientName(client, PlayerName, sizeof(PlayerName));
WritePackString(hPayload, PlayerName);
WritePackString(hPayload, "");
WritePackCell(hPayload, 0);
/////////////////////////////////////////////////////////////////////////////////////////
SQL_TQuery(hDatabase, T_QueryPost, error, hPayload);
return;
}
public Action:event_PlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast) {
new String:error[1024];
DataPack hPayload = new DataPack();
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(client == 0){
return Plugin_Continue;
}
/*
0 - User ID INT
1 - Account ID INT
2 - Steam ID STRING
3 - Connection Type STRING
4 - Conncetion IP STRING
5 - Player Name STRING
6 - Disconnect Reason STRING
7 - Game Time On Server INT
*/
WritePackCell(hPayload, GetEventInt(event, "userid"));
WritePackCell(hPayload, GetSteamAccountID(client, true));
char SteamID[64];
GetEventString(event, "networkid", SteamID, sizeof(SteamID));
WritePackString(hPayload, SteamID);
char ConnectionType[16];
Format(ConnectionType, sizeof(ConnectionType), "%s", "disconnect");
WritePackString(hPayload, ConnectionType);
char ConnectionIP[16];
GetClientIP(client, ConnectionIP, sizeof(ConnectionIP));
WritePackString(hPayload, ConnectionIP);
char PlayerName[64];
GetEventString(event, "name", PlayerName, sizeof(PlayerName));
WritePackString(hPayload, PlayerName);
char DisconnectReason[256];
GetEventString(event, "reason", DisconnectReason, sizeof(DisconnectReason));
WritePackString(hPayload, DisconnectReason);
WritePackCell(hPayload, RoundFloat(GetClientTime(client)));
SQL_TQuery(hDatabase, T_QueryPost, error, hPayload);
return Plugin_Continue;
}
public T_QueryPost(Handle:owner, Handle:hndl, const String:error[], any:hPayload) {
new String:query[1024];
ResetPack(hPayload);
int UserID;
int AccountID;
char Map[256];
char SteamID[64];
char ConnectionType[16];
char ConnectionIP[16];
char PlayerName[64];
char DisconnectReason[256];
int GameTime;
/*
0 - User ID INT
1 - Account ID INT
2 - Steam ID STRING
3 - Connection Type STRING
4 - Conncetion IP STRING
5 - Player Name STRING
6 - Disconnect Reason STRING
7 - Game Time On Server INT
*/
UserID = ReadPackCell(hPayload);
AccountID = ReadPackCell(hPayload);
ReadPackString(hPayload, SteamID, sizeof(SteamID));
ReadPackString(hPayload, ConnectionType, sizeof(ConnectionType));
ReadPackString(hPayload, ConnectionIP, sizeof(ConnectionIP));
ReadPackString(hPayload, PlayerName, sizeof(PlayerName));
ReadPackString(hPayload, DisconnectReason, sizeof(DisconnectReason));
GameTime = ReadPackCell(hPayload);
GetCurrentMap(Map, sizeof(Map));
//for (new i = 0; i < sizeof(sUserData); i++) {
// SQL_EscapeString(hDatabase, sUserData[i], Payload[i], strlen(Payload[i]) * 2);
//}
char SQL_PlayerName[64];
SQL_EscapeString(hDatabase, PlayerName, SQL_PlayerName, sizeof(SQL_PlayerName));
char SQL_Reason[256];
SQL_EscapeString(hDatabase, DisconnectReason, SQL_Reason, sizeof(SQL_Reason));
char SQL_Map[256];
SQL_EscapeString(hDatabase, Map, SQL_Map, sizeof(SQL_Map));
if (StrEqual(ConnectionType, "connect"))
{
Format(query, sizeof(query), "INSERT INTO user_connections (player_name, steam_id, connect_ip, account_id, timestamp, connection_type, map) VALUES ('%s', '%s', '%s', '%d', CURRENT_TIMESTAMP, '%s', '%s')", SQL_PlayerName, SteamID, ConnectionIP, AccountID, ConnectionType, SQL_Map);
//LogMessage("New connection %s, %s(%s), U:1:%d", sUserData[4], sUserData[0], sUserData[2], iUserData[1]);
LogMessage("Player connected: %s %s|U:1:%d|%s", PlayerName, SteamID, AccountID, ConnectionIP);
}
else
{
Format(query, sizeof(query), "INSERT INTO user_connections (player_name, account_id, connection_type, connect_duration, reason, map) VALUES ('%s', '%d', '%s', '%d', '%s', '%s')", SQL_PlayerName, AccountID, ConnectionType, GameTime, SQL_Reason, SQL_Map);
//LogMessage("%s | U:1:%d disconnect from server, total game time %d seconds", sUserData[0], iUserData[1], iUserData[2]);
LogMessage("Player disconnected: %s %s|U:1:%d|%s\nGame Time: %d sec. Reason: %s", PlayerName, SteamID, AccountID, ConnectionIP,GameTime, DisconnectReason);
}
//LogMessage(query);
CloseHandle(hPayload);
SQL_TQuery(hDatabase, T_SendQuery, query);
return;
}
Loading…
Cancel
Save