levelsranks / pawn-levels_ranks-core

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

Module - Boost (VIP Core) | Player are not earning points / xp when killing other players #58

Closed crashzk closed 3 years ago

crashzk commented 3 years ago

I'm having a problem when it comes to earning points / xp when the player kills someone.

Currently, if a player kills the player normally, without any event like HS, NoScope and tals, he is not counting points for the player, he simply does not earn points, same thing if he dies, he does not lose points.

Only if you are gaining or losing points with the kills that you have the Unusual Kills module.

Full list of the plugin and modules I use:

"[Levels Ranks] Core" (v3.1.6) by RoadSide Romeo & Wend4r

  19 "[LR] Module - ExStats Weapons" (v3.1) by RoadSide Romeo & Wend4r
  20 "[LR] Module - ExStats Maps" (3.1 F1) by RoadSide Romeo
  21 "[LR] Module - Boost(Vip)" (v3.1.5) by Designed (Discord: .Designed#7985)
  22 <Failed> "[LR] Module - ExStats GeoIP" (v3.1) by RoadSide Romeo
  23 "[LR] Module - Overlays" (v3.1) by RoadSide Romeo
  24 "[LR] Module - TOP by KDR" (v3.1.5) by Wend4r
  25 "[LR] Module - ExStats Hits" (v3.1) by Wend4r
  26 "[LR] Module - Unusual Kills" (v3.1.6 SR2) by Wend4r
  69 "[Levels Ranks] Core" (v3.1.6) by RoadSide Romeo & Wend4r
Errors:
levels_ranks/levelsranks_exstats_geoip.smx ([LR] Module - ExStats GeoIP): Native "GeoipCity" was not found

Follow the link to download the plugin and module I'm using, configuration included.

https://drive.google.com/file/d/1C6rUIradnMtxvrGT4yR9P7tvy6P38l93/view?usp=sharing

Wend4r commented 3 years ago

Try to unload [LR] Module - Boost(Vip)

crashzk commented 3 years ago

Try to unload [LR] Module - Boost(Vip)

It looks like that was it, I removed the plugin and it was, thank you.

I will leave the code here for anyone who can fix it, I would really like to implement this feature on my servers.

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <vip_core>
#include <lvl_ranks>

#define Crash(%0) SetFailState("[LR::BoostVip] " ... %0)

public Plugin myinfo = 
{
    name = "[LR] Module - Boost (VIP Core)",
    author = "Designed (Discord: .Designed#7985)",
    version = PLUGIN_VERSION,
}

static const char g_szFeature[] = "LrBoost";

public void OnPluginStart() 
{
    if(VIP_IsVIPLoaded())
    {
        VIP_OnVIPLoaded();
    }

    if(LR_IsLoaded())
    {
        LR_OnCoreIsReady();
    }
}

public void LR_OnCoreIsReady()
{
    if (!LR_Hook(LR_OnPlayerKilledPre, CallBack_OnPlayerKilledPre))
        Crash("Failed to hook event");
}

public void VIP_OnVIPLoaded()
{
    VIP_RegisterFeature(g_szFeature, FLOAT, HIDE);
}

public void CallBack_OnPlayerKilledPre(Event hEvent, int& iExpCaused, int iExpVictim, int iExpAttacker)
{
    int iClient = GetClientOfUserId(hEvent.GetInt("attacker"));

    if(VIP_IsClientVIP(iClient) && VIP_IsClientFeatureUse(iClient, g_szFeature))
    {
        iExpCaused = RoundToNearest(iExpCaused * VIP_GetClientFeatureFloat(iClient, g_szFeature));
    }
}

public void OnPluginEnd() 
{
    if(CanTestFeatures() && GetFeatureStatus(FeatureType_Native, "VIP_UnregisterFeature") == FeatureStatus_Available)
    {
        VIP_UnregisterFeature(g_szFeature);
    }
}

Thank you again!