Raised This Month: $32 Target: $400
 8% 

[CS:GO] Show players faceit level in TAB


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lemmon_cs
Member
Join Date: Jan 2019
Location: Romania
Old 05-11-2020 , 10:43   [CS:GO] Show players faceit level in TAB
Reply With Quote #1

I want a plugin that shows players faceit level on TAB Score automatically without any commands , it looks like this https://imgur.com/a/ilIVCDj and it's possible to do with this https://developers.faceit.com/
lemmon_cs is offline
CowGod
Senior Member
Join Date: Feb 2015
Old 05-11-2020 , 12:14   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #2

********* on discord
CowGod is offline
Send a message via Skype™ to CowGod
OcC
Senior Member
Join Date: Mar 2012
Location: Romania
Old 05-11-2020 , 12:34   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #3

Quote:
Originally Posted by lemmon_cs View Post
I want a plugin that shows players faceit level on TAB Score automatically without any commands , it looks like this https://imgur.com/a/ilIVCDj and it's possible to do with this https://developers.faceit.com/
you can try this

PHP Code:
#pragma semicolon 1
#pragma newdecls required
#pragma dynamic 16384

#include <sdktools>
#include <sdkhooks>
#include <json>
#include <SteamWorks>

public Plugin myinfo =
{
    
name "Faceit Level",
    
description "Show players faceit rank",
    
author "Phoenix (˙·٠●Феникс●٠·˙)",
    
version "1.0.2",
    
url "zizt.ru hlmod.ru"
};

//Ваш ключ API
#define API_KEY     "ВАШ API КЛЮЧ"

enum struct Player
{
    
int iUserID;
    
int iSkillLevel;
    
bool bLoad;
}

Player g_Players[MAXPLAYERS+1];
int m_nPersonaDataPublicLevel;


public 
void OnPluginStart()
{
    
m_nPersonaDataPublicLevel FindSendPropInfo("CCSPlayerResource""m_nPersonaDataPublicLevel");
    
    for (
int i 1<= MaxClients; ++i)
    {
        if (
IsClientAuthorized(i) && !IsFakeClient(i))
        {
            
OnClientAuthorized(iNULL_STRING);
        }
    }
}

public 
void OnMapStart()
{
    
char sBuf[PLATFORM_MAX_PATH];
    
    for(
int i 010i++)
    {
        
FormatEx(sBufsizeof sBuf"materials/panorama/images/icons/xp/level%i.png"5001 i);
        
        
AddFileToDownloadsTable(sBuf);
    }
    
    
SDKHook(GetPlayerResourceEntity(), SDKHook_ThinkPostHook_OnThinkPost);
}

//Чтобы уменьшить количество запросов к API
public void OnClientConnected(int iClient)
{
    
int iUserID GetClientUserId(iClient);
    
    if(
g_Players[iClient].iUserID != iUserID)
    {
        
g_Players[iClient].iUserID iUserID;
        
g_Players[iClient].iSkillLevel 0;
        
g_Players[iClient].bLoad false;
    }
}

public 
void OnClientAuthorized(int iClient, const char[] sAuth)
{
    if(
g_Players[iClient].bLoad || IsFakeClient(iClient))
    {
        return;
    }
    
    
char sBuf[20];
    
    
GetClientAuthId(iClientAuthId_SteamID64sBufsizeof sBuf);
    
    
Handle hRequest SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET"https://open.faceit.com/data/v4/players");
    
SteamWorks_SetHTTPRequestNetworkActivityTimeout(hRequest10);
    
    
SteamWorks_SetHTTPRequestHeaderValue(hRequest"Authorization""Bearer " ... API_KEY);
    
    
SteamWorks_SetHTTPRequestGetOrPostParameter(hRequest"game""csgo");
    
SteamWorks_SetHTTPRequestGetOrPostParameter(hRequest"game_player_id"sBuf);
    
    
SteamWorks_SetHTTPRequestContextValue(hRequestGetClientUserId(iClient));
    
    
SteamWorks_SetHTTPCallbacks(hRequestHTTPPlayerDetailsComplete);
    
    
SteamWorks_SendHTTPRequest(hRequest);
}

void HTTPPlayerDetailsComplete(Handle hRequestbool bFailurebool bRequestSuccessfulEHTTPStatusCode eStatusCodeany iUserID)
{
    
//Пока что игнорируем ошибки при загрузке
    
if(eStatusCode == k_EHTTPStatusCode200OK || eStatusCode == k_EHTTPStatusCode404NotFound)
    {
        
int iClient GetClientOfUserId(iUserID);
        
        if(
iClient)
        {
            
//Если игрок играл на faceit
            
if(eStatusCode == k_EHTTPStatusCode200OK)
            {
                
SteamWorks_GetHTTPResponseBodyCallback(hRequestHTTPPlayerDetailsCompleteDataiUserID);
            }
            else
            {
                
g_Players[iClient].bLoad true;
            }
        }
    }
    
    
delete hRequest;
}

void HTTPPlayerDetailsCompleteData(const char[] sDataany iUserID)
{
    
int iClient GetClientOfUserId(iUserID);
    
    if(
iClient)
    {
        
JSON_Object root json_decode(sData);
        
JSON_Object games root.GetObject("games");
        
JSON_Object csgo games.GetObject("csgo");
        
        if(
csgo)
        {
            
g_Players[iClient].iSkillLevel csgo.GetInt("skill_level"0);
        }
        
        
root.Cleanup();
        
delete root;
        
        
g_Players[iClient].bLoad true;
    }
}

void Hook_OnThinkPost(int iEnt)
{
    for (
int i 1<= MaxClientsi++)
    {
        if(
g_Players[i].iSkillLevel)
        {
            
SetEntData(iEntm_nPersonaDataPublicLevel 4g_Players[i].iSkillLevel 5000);
        }
    }

__________________
OcC is offline
Send a message via Yahoo to OcC
raj kaul
Senior Member
Join Date: Mar 2018
Location: www.lotgaming.xyz
Old 05-11-2020 , 16:09   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #4

Quote:
Originally Posted by OcC View Post
you can try this


// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(215) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(216) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(217) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(21 : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(219) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(219) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(220) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(220) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(221) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(221) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(222) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(223) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(223) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(223) : error 147: new-style declarations are required
// C:\Users\PC\Desktop\compiler\scripting\includ e\SteamWorks.inc(223) : fatal error 190: too many error messages on one line]

i dont know about coding and getting this errors . can you help me ?
__________________

Last edited by raj kaul; 05-11-2020 at 20:18.
raj kaul is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 05-12-2020 , 03:00   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #5

Quote:
Originally Posted by raj kaul View Post
i dont know about coding and getting this errors . can you help me ?
PHP Code:
#pragma semicolon 1

#include <SteamWorks>
#pragma newdecls required
#pragma dynamic 16384

#include <sdktools>
#include <sdkhooks>
#include <json>

public Plugin myinfo =
{
    
name "Faceit Level",
    
description "Show players faceit rank",
    
author "Phoenix (˙·٠●Феникс●٠·˙)",
    
version "1.0.2",
    
url "zizt.ru hlmod.ru"
};

//Ваш ключ API
#define API_KEY     "ВАШ API КЛЮЧ"

enum struct Player
{
    
int iUserID;
    
int iSkillLevel;
    
bool bLoad;
}

Player g_Players[MAXPLAYERS+1];
int m_nPersonaDataPublicLevel;


public 
void OnPluginStart()
{
    
m_nPersonaDataPublicLevel FindSendPropInfo("CCSPlayerResource""m_nPersonaDataPublicLevel");
    
    for (
int i 1<= MaxClients; ++i)
    {
        if (
IsClientAuthorized(i) && !IsFakeClient(i))
        {
            
OnClientAuthorized(iNULL_STRING);
        }
    }
}

public 
void OnMapStart()
{
    
char sBuf[PLATFORM_MAX_PATH];
    
    for(
int i 010i++)
    {
        
FormatEx(sBufsizeof sBuf"materials/panorama/images/icons/xp/level%i.png"5001 i);
        
        
AddFileToDownloadsTable(sBuf);
    }
    
    
SDKHook(GetPlayerResourceEntity(), SDKHook_ThinkPostHook_OnThinkPost);
}

//Чтобы уменьшить количество запросов к API
public void OnClientConnected(int iClient)
{
    
int iUserID GetClientUserId(iClient);
    
    if(
g_Players[iClient].iUserID != iUserID)
    {
        
g_Players[iClient].iUserID iUserID;
        
g_Players[iClient].iSkillLevel 0;
        
g_Players[iClient].bLoad false;
    }
}

public 
void OnClientAuthorized(int iClient, const char[] sAuth)
{
    if(
g_Players[iClient].bLoad || IsFakeClient(iClient))
    {
        return;
    }
    
    
char sBuf[20];
    
    
GetClientAuthId(iClientAuthId_SteamID64sBufsizeof sBuf);
    
    
Handle hRequest SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET"https://open.faceit.com/data/v4/players");
    
SteamWorks_SetHTTPRequestNetworkActivityTimeout(hRequest10);
    
    
SteamWorks_SetHTTPRequestHeaderValue(hRequest"Authorization""Bearer " ... API_KEY);
    
    
SteamWorks_SetHTTPRequestGetOrPostParameter(hRequest"game""csgo");
    
SteamWorks_SetHTTPRequestGetOrPostParameter(hRequest"game_player_id"sBuf);
    
    
SteamWorks_SetHTTPRequestContextValue(hRequestGetClientUserId(iClient));
    
    
SteamWorks_SetHTTPCallbacks(hRequestHTTPPlayerDetailsComplete);
    
    
SteamWorks_SendHTTPRequest(hRequest);
}

void HTTPPlayerDetailsComplete(Handle hRequestbool bFailurebool bRequestSuccessfulEHTTPStatusCode eStatusCodeany iUserID)
{
    
//Пока что игнорируем ошибки при загрузке
    
if(eStatusCode == k_EHTTPStatusCode200OK || eStatusCode == k_EHTTPStatusCode404NotFound)
    {
        
int iClient GetClientOfUserId(iUserID);
        
        if(
iClient)
        {
            
//Если игрок играл на faceit
            
if(eStatusCode == k_EHTTPStatusCode200OK)
            {
                
SteamWorks_GetHTTPResponseBodyCallback(hRequestHTTPPlayerDetailsCompleteDataiUserID);
            }
            else
            {
                
g_Players[iClient].bLoad true;
            }
        }
    }
    
    
delete hRequest;
}

void HTTPPlayerDetailsCompleteData(const char[] sDataany iUserID)
{
    
int iClient GetClientOfUserId(iUserID);
    
    if(
iClient)
    {
        
JSON_Object root json_decode(sData);
        
JSON_Object games root.GetObject("games");
        
JSON_Object csgo games.GetObject("csgo");
        
        if(
csgo)
        {
            
g_Players[iClient].iSkillLevel csgo.GetInt("skill_level"0);
        }
        
        
root.Cleanup();
        
delete root;
        
        
g_Players[iClient].bLoad true;
    }
}

void Hook_OnThinkPost(int iEnt)
{
    for (
int i 1<= MaxClientsi++)
    {
        if(
g_Players[i].iSkillLevel)
        {
            
SetEntData(iEntm_nPersonaDataPublicLevel 4g_Players[i].iSkillLevel 5000);
        }
    }

should work
__________________
8guawong is offline
raj kaul
Senior Member
Join Date: Mar 2018
Location: www.lotgaming.xyz
Old 05-12-2020 , 03:19   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #6

Quote:
Originally Posted by 8guawong View Post
should work
PHP Code:
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(23) : error 001: expected token: "{", but found "struct"
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(25) : error 001: expected token: "public", but found "int"
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(26) : error 001: expected token: "}", but found "int"
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(28) : error 054: unmatched closing brace ("}")
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(66) : error 017: undefined symbol "g_Players"
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(66) : warning 215: expression has no effect
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(66) : error 001: expected token: ";", but found "]"
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(66) : error 029: invalid expression, assumed zero
// C:\Users\PC\Desktop\compiler\scripting\faceitapi.sp(66) : fatal error 190: too many error messages on one line 
__________________
raj kaul is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 05-12-2020 , 04:19   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #7

I added a cvar for people that dont know how to compile and I added the downlodable content.

EDIT: use this.
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 06-03-2020 at 20:03.
Franc1sco is offline
Send a message via MSN to Franc1sco
LowPriority
New Member
Join Date: May 2020
Old 05-12-2020 , 04:40   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #8

Quote:
Originally Posted by Franc1sco View Post
I added a cvar for people that dont know how to compile and I added the downlodable content.
thank you for this but i still get this error
PHP Code:
L 05/12/2020 08:37:47: [SMException reportedString formatted incorrectly parameter 4 (total 3)
L 05/12/2020 08:37:47: [SMBlamingfaceit_level.smx
L 05
/12/2020 08:37:47: [SMCall stack trace:
L 05/12/2020 08:37:47: [SM]   [0Format
L 05
/12/2020 08:37:47: [SM]   [1Line 85E:\Dropbox\UEA\1css server\faceit\faceit_level.sp::OnClientAuthorized 
my server.cfg settings

HTML Code:
sm_faceitlevel_api "MY API" // change the value for your api key
LowPriority is offline
enjoi.
Veteran Member
Join Date: Mar 2011
Old 05-12-2020 , 04:55   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #9

I love your idea.
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 05-12-2020 , 05:20   Re: [CS:GO] Show players faceit level in TAB
Reply With Quote #10

Quote:
Originally Posted by LowPriority View Post
my server.cfg settings

HTML Code:
sm_faceitlevel_api "MY API" // change the value for your api key
You need a api from https://developers.faceit.com/
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 05-12-2020 at 05:25.
Franc1sco is offline
Send a message via MSN to Franc1sco
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode