View Single Post
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 04-27-2018 , 16:58   Re: [CSGO] Upgraded & Fixed VIP System - On Database With Perks
#5

public Action Command_AddVIP(int client, int args):

Code:
[...]
				//Info
				char playername[MAX_NAME_LENGTH], steamid[32];
				GetClientName(target_list[i], playername, MAX_NAME_LENGTH);
				GetClientAuthId(target_list[i], AuthId_Steam2, steamid, 32);
				
				int iLength = ((strlen(playername) * 2) + 1);
[...]
public Action Command_RemoveVIP(int client, int args):

Code:
[...]
			for (int i = 0; i < target_count; i++)
			{
				char steamid[64];
				GetClientAuthId(target_list[i], AuthId_Steam2, steamid, sizeof(steamid));
				SQL_RemoveVIP(steamid);
				g_iClientTime[target_list[i]] = 0;
				b_bIsClientVIP[target_list[i]] = false;
				PrintToChat(client, "%s%N has been removed from a VIP", prefix, target_list[i]);
			}
[...]
void UpdatePlayer(int client):

Code:
[...]
	char gB_Query[512], steamid[32];
	GetClientAuthId(client, AuthId_Steam2, steamid, 32);
[...]
public void SQL_InsertPlayer_Callback(Database db, DBResultSet results, const char[] error, any data):

Code:
[...]
	if (SQL_GetRowCount(results) == 0)
	{
		char steamid[64];
		GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
		SQL_RemoveVIP(steamid);
	}
[...]
stock void CheckTimeLeft(int client):

Code:
[...]
	char authid[64];
	GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
[...]


GetClientAuthId gives a boolean value, check it before you use it? :'(

Just like you did in:

public void SQL_SelectPlayer_Callback(Database db, DBResultSet results, const char[] error, any data):

Code:
[...]
	char steamid[32];
	if (!GetClientAuthId(client, AuthId_Steam2, steamid, 32))
	{
		return;
	}
[...]
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline