Raised This Month: $51 Target: $400
 12% 

SQL plugin help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pancakes_
New Member
Join Date: Feb 2022
Old 08-22-2023 , 00:33   SQL plugin help
Reply With Quote #1

Hi I need help with this plugin I read SQL documentation. How do I make this plugin from SQL documentation run the CheckSteamID? and I'm wondering how do I link CheckSteamID with OnClientAuthorized so its checked when someone joins?

public void OnPluginStart()
{
//Database Connection
StartSQL();
}

Database hDatabase = null;

void StartSQL()
{
Database.Connect(GotDatabase, "databasename");
}

public void GotDatabase(Database db, const char[] error, any data)
{
if (db == null)
{
LogError("Database failure: %s", error);
}
else
{
hDatabase = db;
}
}

public void CheckSteamID(int userid, const char[] auth)
{
char query[255];
FormatEx(query, sizeof(query), "SELECT userid FROM users WHERE steamid = '%s'", auth);
hdatabase.Query(T_CheckSteamID, query, userid);
}

public void T_CheckSteamID(Database db, DBResultSet results, const char[] error, any data)
{
int client = 0;

/* Make sure the client didn't disconnect while the thread was running */
if ((client = GetClientOfUserId(data)) == 0)
{
return;
}

if (db == null || results == null || error[0] != '\0')
{
LogError("Query failed! %s", error);
KickClient(client, "Authorization failed");
}
else if (results.RowCount == 0)
{
KickClient(client, "You are not a member");
}
}
pancakes_ is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode