View Single Post
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 12-13-2015 , 20:51   Re: F2P Detections not working correctly!
Reply With Quote #2

Most plugins unset this FreeToPlay[client] status variable when people disconnect, however, based on your shared code, it doesn't seem like you do that.

If some F2P client has been on your server, but you are now using his/her ID, and you are except from this check, then your FreeToPlay[client] might returns true if you are not removing / clearing the variable in OnClientDisconnect.

Based on your own code - you could eventually try something like this:

Code:
public OnClientPostAdminCheck(client)
{
    if (CheckCommandAccess(client, "BypassPremiumCheck", ADMFLAG_ROOT, true))
    {
        FreeToPlay[client] = false; /* People bypassing our check means ... not a F2P player. */
        return;
    }

    if (Steam_CheckClientSubscription(client, 0) && !Steam_CheckClientDLC(client, 459))
    {
        FreeToPlay[client] = true;
    }
    else
    {
        FreeToPlay[client] = false;
    }

    return;
}
Or eventually less code, by starting with false for all, then change to true if F2P is being detected:
Code:
public OnClientPostAdminCheck(client)
{
    FreeToPlay[client] = false; /* By default, Let's assume everyone has the game license ... */

    if (CheckCommandAccess(client, "BypassPremiumCheck", ADMFLAG_ROOT, true))
    {
        return;
    }

    if (Steam_CheckClientSubscription(client, 0) && !Steam_CheckClientDLC(client, 459))
    {
        FreeToPlay[client] = true;
    }

    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