VIP-Core icon indicating copy to clipboard operation
VIP-Core copied to clipboard

Sometimes it doesn't get vip

Open stefanx111 opened this issue 1 year ago • 3 comments

Why sometimes the player doesn't get the vip when connect? I think the problem is that account_id is 0 This player has vip but IS_VIP = 0 I have to refresh vip to make it work.

Debug-VIPCore-3.0.4R

L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] Clients: OnClientPutInServer xHn (13): 0
L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] API: g_hGlobalForward_OnClientPreLoad(xHn (13), 0)
L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] API: g_hGlobalForward_OnClientPreLoad = 1
L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] Clients: Clients_LoadClient xHn (13), 10: - > 9b100881, 2601519233
L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] SQL_Query: SELECT `expires`, `group`, `name` FROM `vip_users` WHERE `account_id` = 0 AND `sid` = 0 LIMIT 1;
L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] Clients: Event_PlayerSpawn: xHn (13)
L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] SQL_Response: SQL_Callback_OnClientAuthorized
L 03/04/2023 - 15:37:02: [vip/VIP_Core.smx] [VIP] Clients: SQL_Callback_OnClientAuthorized: 13
L 03/04/2023 - 15:37:04: [vip/VIP_Core.smx] [VIP] Clients: OnClientCookiesCached 13 xHn
L 03/04/2023 - 15:37:04: [vip/VIP_Core.smx] [VIP] Clients: AreClientCookiesCached 1
L 03/04/2023 - 15:37:04: [vip/VIP_Core.smx] [VIP] API: Native_IsClientVIP(1)
L 03/04/2023 - 15:37:04: [vip/VIP_Core.smx] [VIP] API: iClient = 13
L 03/04/2023 - 15:37:04: [vip/VIP_Core.smx] [VIP] API: IS_VIP = 0

stefanx111 avatar Mar 04 '23 15:03 stefanx111

@stefanx111

  1. what game?
  2. how often does this happen?
  3. With some specific players or with different ones?

R1KO avatar Mar 05 '23 10:03 R1KO

  1. 3.0.4R
  2. 5-7 times a day
  3. random

in vip/Clients.sp I did something like this and if you look in log at PrintToServer you see that the accountid is displayed when GetSteamAccountID have false argument

void Clients_LoadClient(int iClient, bool bNotify)
{
	char szQuery[512], steamid[32], steamid2[32];

	int iAccountID = GetSteamAccountID(iClient);
	int iAccountID2 = GetSteamAccountID(iClient, false);
	GetClientAuthId(iClient, AuthId_Steam3, steamid2, sizeof(steamid2), false);
	GetClientAuthId(iClient, AuthId_Steam3, steamid, sizeof(steamid), true);
	PrintToServer("%L %s GetClientAuthId - false) (%s GetClientAuthId - true) (%i GetSteamAccountID - true)  (%i GetSteamAccountID - false)", iClient, steamid2, steamid, iAccountID, iAccountID2 );

	DBG_Clients("Clients_LoadClient %N (%d), %b: - > %x, %u", iClient, iClient, g_iClientInfo[iClient], g_hDatabase, g_hDatabase)

	char szWhere[64];
	if(g_szSID[0])
	{
		#if USE_MORE_SERVERS 1
		FormatEx(SZF(szWhere), " AND (`sid` = %d OR `sid` = 0)", g_CVAR_iServerID);
		#else
		strcopy(SZF(szWhere), g_szSID);
		#endif
	}

	FormatEx(SZF(szQuery), "SELECT `expires`, `group`, `name` \
										FROM `vip_users` \
										WHERE `account_id` = %d%s LIMIT 1;",
										iAccountID, szWhere);

	DataPack hDataPack = new DataPack();
	hDataPack.WriteCell(UID(iClient));
	hDataPack.WriteCell(iAccountID);
	hDataPack.WriteCell(bNotify);

	DBG_SQL_Query(szQuery)
	g_hDatabase.Query(SQL_Callback_OnClientAuthorized, szQuery, hDataPack);
}
L 03/05/2023 - 14:03:00: [vip/VIP_Core.smx] [VIP] Clients: OnClientPutInServer toosii -_- (19): 0
L 03/05/2023 - 14:03:00: [vip/VIP_Core.smx] [VIP] Clients: Clients_LoadClient toosii -_- (19), 10: - > e7a00876, 3886024822
L 03/05/2023 - 14:03:00: [vip/VIP_Core.smx] [VIP] SQL_Query: SELECT `expires`, `group`, `name` FROM `vip_users` WHERE `account_id` = 0 AND `sid` = 0 LIMIT 1;

toosii -_-<196><STEAM_ID_PENDING><> [U:1:1312035860] GetClientAuthId - false) (STEAM_ID_STOP_IGNORING_RETVALS GetClientAuthId - true) (0 GetSteamAccountID - true)  (1312035860 GetSteamAccountID - false)

stefanx111 avatar Mar 05 '23 14:03 stefanx111

@stefanx111

try compile with

int iAccountID = GetSteamAccountID(iClient, false);

this should help, but other problems may appear

R1KO avatar Mar 05 '23 20:03 R1KO