Oh boy, I didn't mean for you to delete everything and replace it with what I wrote. I'll send the full plugin with the proper code again, but you have to redo how you grab the clients from your database as I don't know how you did that. Here you go:
Spoiler
PHP Code:
#pragma semicolon 1
#define PLUGIN_VERSION "0.1"
public Plugin:myinfo =
{
name = "ckSurf Kicker",
author = "DeweY",
version = PLUGIN_VERSION,
description = "Kicks clients with 1000 points or more.",
url = "http://Omegagaming.org/"
};
Handle g_hDatabase = null;
int iPoints;
char g_sPortPath[PLATFORM_MAX_PATH];
public void OnPluginStart()
{
SQL_TConnect(SQLCallback_Connect, "ckSurf");
if(KvGotoFirstSubKey(hPorts))
{
do
{
char Port[7];
KvGetString(hPorts, "port", Port, 7);
int kv_iPort = StringToInt(Port);
if (iPort == kv_iPort)
{
char Points[32];
KvGetString(hPorts, "points", Points, 32);
iPoints = StringToInt(Points);
break;
}
} while(KvGotoNextKey(hPorts, false));
}
else
{
SetFailState("Can't find first subkey in configuration file %s!", g_sPortPath);
return;
}
CloseHandle(hPorts);
}
public SQLCallback_Connect(Handle owner, Handle hndl, const char[] error, any data)
{
if (hndl == null)
{
SetFailState("Error connecting to database. %s", error);
}
g_hDatabase = hndl;
}
public void OnClientPostAdminCheck(client)
{
CheckRank(client);
}
public CheckRank(int client)
{
char query[255];
char SteamID[32];
GetClientAuthId(client, AuthId_Steam2, SteamID, 32);
Format(query, 255, "SELECT `score` FROM `ranking` WHERE `id_player`='%s' LIMIT 1", SteamID[10]);
SQL_TQuery(g_hDatabase, SQLCallback_LoadPlayerPoints, query, GetClientUserId(client));
}
public SQLCallback_LoadPlayerPoints(Handle owner, Handle hndl, const char[] error, any data)
{
if (hndl == null)
{
SetFailState("Error grabbing player points. %s", error);
}
int client = GetClientOfUserId(data);
if (SQL_GetRowCount(hndl) == 1)
{
SQL_FetchRow(hndl);
int playerpoints = SQL_FetchInt(hndl, 0);
if (playerpoints >= iPoints)
{
KickClient(client, "This server is for beginners.");
}
}
}
Remember to make a "ports.cfg" in your addons/sourcemod/configs folder that looks like:
Oh boy, I didn't mean for you to delete everything and replace it with what I wrote. I'll send the full plugin with the proper code again, but you have to redo how you grab the clients from your database as I don't know how you did that. Here you go:
Spoiler
PHP Code:
#pragma semicolon 1
#define PLUGIN_VERSION "0.1"
public Plugin:myinfo = { name = "ckSurf Kicker", author = "DeweY", version = PLUGIN_VERSION, description = "Kicks clients with 1000 points or more.", url = "http://Omegagaming.org/" };
Handle g_hDatabase = null;
int iPoints;
char g_sPortPath[PLATFORM_MAX_PATH];
public void OnPluginStart() { SQL_TConnect(SQLCallback_Connect, "ckSurf");
if(KvGotoFirstSubKey(hPorts)) { do { char Port[7]; KvGetString(hPorts, "port", Port, 7); int kv_iPort = StringToInt(Port); if (iPort == kv_iPort) { char Points[32]; KvGetString(hPorts, "points", Points, 32); iPoints = StringToInt(Points); break; }
} while(KvGotoNextKey(hPorts, false)); }
else { SetFailState("Can't find first subkey in configuration file %s!", g_sPortPath); return; }
CloseHandle(hPorts); }
public SQLCallback_Connect(Handle owner, Handle hndl, const char[] error, any data) { if (hndl == null) { SetFailState("Error connecting to database. %s", error); }
g_hDatabase = hndl; }
public void OnClientPostAdminCheck(client) { CheckRank(client); }
public CheckRank(int client) { char query[255]; char SteamID[32]; GetClientAuthId(client, AuthId_Steam2, SteamID, 32); Format(query, 255, "SELECT `score` FROM `ranking` WHERE `id_player`='%s' LIMIT 1", SteamID[10]); SQL_TQuery(g_hDatabase, SQLCallback_LoadPlayerPoints, query, GetClientUserId(client)); }
public SQLCallback_LoadPlayerPoints(Handle owner, Handle hndl, const char[] error, any data) { if (hndl == null) { SetFailState("Error grabbing player points. %s", error); }
int client = GetClientOfUserId(data);
if (SQL_GetRowCount(hndl) == 1) { SQL_FetchRow(hndl); int playerpoints = SQL_FetchInt(hndl, 0); if (playerpoints >= iPoints) { KickClient(client, "This server is for beginners."); } } }
Remember to make a "ports.cfg" in your addons/sourcemod/configs folder that looks like:
Friend,It is working!!!!!!!!!!!Thank you very much for your help.if there is anything I could do to thank, please tell me.
I think this plugin would be interested to very people, you should create a new post about this plugin.Really thanks bro.
Friend,It is working!!!!!!!!!!!Thank you very much for your help.if there is anything I could do to thank, please tell me.
I think this plugin would be interested to very people, you should create a new post about this plugin.Really thanks bro.
I'm glad I could help. I'm not going to ask for anything but I'm always accepting donations. I would submit this to the plugins, but the code is pretty messy and also I just don't see the want for it. Although thanks for the kind words and I'm glad you love it