View Single Post
vERKE
Junior Member
Join Date: Sep 2018
Location: Hungary
Old 12-10-2018 , 15:06   Re: Non-Prime player tag CS:GO
Reply With Quote #7

Quote:
Originally Posted by freak.exe_uLow View Post
I hope it's allowed to post it from a discord server (not my script) credits too OkyHp & Wend4r

If that is against the rules, please delete my post

Code:
#include <sourcemod>
#include <SteamWorks>
#include <cstrike>
#pragma semicolon 1
#pragma newdecls required

bool g_bNoPrime[MAXPLAYERS+1];

public Plugin myinfo =
{
    name        = "No Prime Clan Tag",
    author        = "OkyHp & Wend4r",
    description = "Setting clan tags for NO PRIME players.",
};

public void OnPluginStart()
{
    if(GetEngineVersion() != Engine_CSGO)
    {
        SetFailState("This plugin works only on CS:GO");
    }
}

public void OnMapStart()
{
    CreateTimer(5.0, Timer_SetClanTags, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public void OnClientPostAdminCheck(int iClient)
{
    g_bNoPrime[iClient] = SteamWorks_HasLicenseForApp(iClient, 624820) ? true : false;
    SetClientClanTag(iClient);
}

public Action Timer_SetClanTags(Handle hTimer)
{
    for(int i = 1; i <= MaxClients; i++)
    {
        if (g_bNoPrime[i] && !IsFakeClient(i) && IsClientInGame(i))
        {
            SetClientClanTag(i);
        }
    }
    return Plugin_Continue;
}

public Action SetClientClanTag(int iClient)
{
    if (g_bNoPrime[iClient] && !IsFakeClient(iClient) && IsClientInGame(iClient))
    {
        CS_SetClientClanTag(iClient, "[NO PRIME]");
    }
}
It works, but I have error spam in my log:
L 12/10/2018 - 2095: [SM] Exception reported: Client 7 is not connected
L 12/10/2018 - 2095: [SM] Blaming: f2prename.smx
L 12/10/2018 - 2095: [SM] Call stack trace:
L 12/10/2018 - 2095: [SM] [0] IsFakeClient
L 12/10/2018 - 2095: [SM] [1] Line 39, f2prename.sp::Timer_SetClanTags
__________________
vERKE is offline