Hey, i have a problem. I need to save user information after that when plugin do database connection and get from there steam id.
Piece of my code
PHP Code:
// Include
#include <sourcemod>
#include <dbi>
// Database
new Handle:Database;
// Privileges
new privileges;
// Version
#define _V "1.0.0"
public Plugin:myinfo =
{
name = "Name",
author = "author",
description = "description",
version = _V,
url = "url"
}
public OnPluginStart()
{
// Set log file
BuildPath(Path_SM, logFile, sizeof(logFile), "logs/premium.log");
// Connect to database
SQL_TConnect(GotDatabase, "premium");
}
public OnClientAuthorized(client)
{
decl String:auth[32];
GetClientAuthString(client, auth, sizeof(auth));
CheckSteamID(client, auth);
}
public GotDatabase(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
{
LogToFile(logFile, "%s.", error);
}
else
{
Database = hndl;
}
}
CheckSteamID(userid, const String:auth[])
{
decl String:query[255];
Format(query, sizeof(query), "SELECT steam_id FROM premium_users WHERE steam_id = '%s'", auth);
SQL_TQuery(Database, T_CheckSteamID, query, userid);
}
public T_CheckSteamID(Handle:owner, Handle:hndl, const String:error[], any:client)
{
if (hndl == INVALID_HANDLE)
{
LogToFile(logFile, "%s.", error);
privileges = 0;
}
else if (!SQL_GetRowCount(hndl))
{
privileges = 0;
}
else
{
privileges = 1;
}
}
This is not all my code, only piece wich connected with database
Problem:
When i connected i have
privileges = 1, when someone connectec and happend restart round,
privileges = 1 set to
privileges = 0. But i need that i have
privileges = 1 all map.
P.S - Sorry for my bad english.
Please help me.