Esempio n. 1
0
static cell_t sm_GetClientSerial(IPluginContext *pContext, const cell_t *params)
{
    int client = params[1];

    IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
    if (!pPlayer)
    {
        return pContext->ThrowNativeError("Client index %d is invalid", client);
    }

    return pPlayer->GetSerial();
}
Esempio n. 2
0
void CookieManager::OnClientAuthorized(int client, const char *authstring)
{
    IGamePlayer *player = playerhelpers->GetGamePlayer(client);

    if (player == NULL)
    {
        return;
    }

    connected[client] = true;

    TQueryOp *op = new TQueryOp(Query_SelectData, player->GetSerial());
    strcpy(op->m_params.steamId, authstring);

    g_ClientPrefs.AddQueryToQueue(op);
}
Esempio n. 3
0
void CookieManager::OnClientDisconnecting(int client)
{
	connected[client] = false;
	statsLoaded[client] = false;
	statsPending[client] = false;

	CookieData *current = NULL;

	g_ClientPrefs.AttemptReconnection();
	
	/* Save this cookie to the database */
	IGamePlayer *player = playerhelpers->GetGamePlayer(client);
	const char *pAuth = NULL;
	int dbId;
	
	if (player)
	{
		pAuth = GetPlayerCompatAuthId(player);
		g_ClientPrefs.ClearQueryCache(player->GetSerial());
	}

	ke::Vector<CookieData *> &clientvec = clientData[client];
	for (size_t iter = 0; iter < clientvec.length(); ++iter)
	{
		current = clientvec[iter];
		dbId = current->parent->dbid;
		
		if (player == NULL || pAuth == NULL || !current->changed || dbId == -1)
		{
			current->parent->data[client] = NULL;
			delete current;
			continue;
		}

		TQueryOp *op = new TQueryOp(Query_InsertData, client);

		UTIL_strncpy(op->m_params.steamId, pAuth, MAX_NAME_LENGTH);
		op->m_params.cookieId = dbId;
		op->m_params.data = current;

		g_ClientPrefs.AddQueryToQueue(op);

		current->parent->data[client] = NULL;
	}
	
	clientvec.clear();
}
Esempio n. 4
0
void CookieManager::OnClientAuthorized(int client, const char *authstring)
{
	IGamePlayer *player = playerhelpers->GetGamePlayer(client);

	if (player == NULL)
	{
		return;
	}

	connected[client] = true;
	statsPending[client] = true;

	g_ClientPrefs.AttemptReconnection();
	
	TQueryOp *op = new TQueryOp(Query_SelectData, player->GetSerial());
	UTIL_strncpy(op->m_params.steamId, GetPlayerCompatAuthId(player), MAX_NAME_LENGTH);

	g_ClientPrefs.AddQueryToQueue(op);
}