Quote:
Originally Posted by Arkarr
Wait, I gotta do the whole registration thing ? If yes, then I'll do it the next weekend.
|
Okey i found a code that could be moded really really quick! But i feel dumb atm and idk how to handle it..
IF someone can do it, will be cool!
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;
public void OnPluginStart()
{
SQL_TConnect(SQLCallback_Connect, "ckSurf");
}
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 >= 1000)
{
KickClient(client, "This server is for beginners.");
}
}
}
This is the original code.
This how should look i guess
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;
public void OnPluginStart()
{
SQL_TConnect(SQLCallback_Connect, "ckSurf");
}
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 `steam_id` FROM `users` 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 >= 1000)
{
KickClient(client, "Please register before you play!");
}
}
}
But, i dont know hoow to make the check nor get the IP from my user that is connected