PDA

View Full Version : [REQ] Register on website before joining a server, Simple auth system.


ItsCEED
06-20-2016, 15:46
Hi there, i know.. its my first post but im loorking around for ages since i start with my CS 1.6 Community.

My request is simple..

All i need is a plugin that checks a database from a website to check if the user is signed up before playing.

The website will use steam auth, so if the player is not in the database will be kicked and recive message like "You are not registed, please signup at www.xxxx.tld before you join the server"


Simple as that.

I was looking around the forum and cant find something like this, so i will be really happy if someone made it cuz its not a big thing (for me it is, i tried to make it but i faild since my knowladge is kinda crappy :/)

Thank you very much!

Maxximou5
06-20-2016, 15:50
There are plugins like this available, but the greater questions are:
How is your system storing the auths?
Is you auth system using a plugin?
What forum does your website use?

ItsCEED
06-20-2016, 15:54
There are plugins like this available, but the greater questions are:
How is your system storing the auths?
Is you auth system using a plugin?
What forum does your website use?

ID / SteamID/ etc / etc directly from the steam login.

Will be self made website


Also, i didnt manage to find the plugin :/

Maxximou5
06-20-2016, 16:27
If that's the case anyone of us can do it, it should be done with relative ease. Just choose which method you are using to store it and we could get started. If you plan to store all three, even better.
Example:
steamID: STEAM_1:1:1337
steamID3: [U:1:2675]
steamID64: 76561197960268403

ItsCEED
06-20-2016, 16:44
If that's the case anyone of us can do it, it should be done with relative ease. Just choose which method you are using to store it and we could get started. If you plan to store all three, even better.
Example:
steamID: STEAM_1:1:1337
steamID3: [U:1:2675]
steamID64: 76561197960268403


Any oof it :3

SteamID or SteamID64 i dont really mind :3
Ty!

ItsCEED
06-21-2016, 12:22
Update:
steamID64 is is needed :3

And anyone? :3

Arkarr
06-21-2016, 12:45
Update:
steamID64 is is needed :3

And anyone? :3
Wait, I gotta do the whole registration thing ? If yes, then I'll do it the next weekend.

ItsCEED
06-23-2016, 20:04
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!
#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

#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 :(

8guawong
06-23-2016, 20:38
the most important part is how you are going to store player steaminfo in your db
then it's just sql query from there
if you already have a system that store players steaminfo then checkout the following link
https://forums.alliedmods.net/showthread.php?p=2242960
you can use the native that Plugin provides to kick player if want

ItsCEED
06-23-2016, 20:42
the most important part is how you are going to store player steaminfo in your db
then it's just sql query from there
if you already have a system that store players steaminfo then checkout the following link
https://forums.alliedmods.net/showthread.php?p=2242960
you can use the native that Plugin provides to kick player if want


On the website ID will be saved in STEAMID64 version :3
Also the user must go to the website and login via Steam, i dont want a plugin that will allow the client to register to the website from the server :3

DarkDeviL
06-24-2016, 05:06
Will be self made website

^

A copy of your SQL database table schema where their Steam ID is stored will be required to assist you further than above.