levelsranks / levels-ranks-core

Statistics plugin for servers on the Source Engine
GNU General Public License v3.0
73 stars 39 forks source link

[Question] LR_GetClientInfo how to get data #62

Closed Nerus87 closed 3 years ago

Nerus87 commented 3 years ago

How to use this native to get stats from DB when player -> OnClientPostAdminCheck?

 /**
 * Gets detailed statistics about the client.
 *
 * @param iClient             Client index.
 * @param StatsType           Type data.
 * @param bSession            Output data from session.
 *
 * @return                    Data value.
 */
native int LR_GetClientInfo(int iClient, LR_StatsType StatsType, bool bSession = false);

Example usage:

player.Rank = LR_GetClientInfo(player.Index, ST_RANK);
float kills = float(LR_GetClientInfo(player.Index, ST_KILLS));
float deaths = float(LR_GetClientInfo(player.Index, ST_DEATHS));
Wend4r commented 3 years ago

Example - https://github.com/levelsranks/levels-ranks-modules/blob/master/%5BLevels%20Ranks%5D%20Module%20-%20ExStats%20Maps/addons/sourcemod/scripting/levelsranks_exstats_maps.sp#L61