Added rankings exists check and enabled non rankings calculating
This commit is contained in:
parent
b48878fe4e
commit
956acff3e2
4 changed files with 174 additions and 32 deletions
69
.gitignore
vendored
Normal file
69
.gitignore
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
|
||||
scripting/include/version_auto.inc
|
||||
scripting/include/admin.inc
|
||||
scripting/include/adminmenu.inc
|
||||
scripting/include/adt.inc
|
||||
scripting/include/adt_array.inc
|
||||
scripting/include/adt_stack.inc
|
||||
scripting/include/adt_trie.inc
|
||||
scripting/include/banning.inc
|
||||
scripting/include/basecomm.inc
|
||||
scripting/include/bitbuffer.inc
|
||||
scripting/include/clientprefs.inc
|
||||
scripting/include/clients.inc
|
||||
scripting/include/commandfilters.inc
|
||||
scripting/include/commandline.inc
|
||||
scripting/include/console.inc
|
||||
scripting/include/convars.inc
|
||||
scripting/include/core.inc
|
||||
scripting/include/cstrike.inc
|
||||
scripting/include/datapack.inc
|
||||
scripting/include/dbi.inc
|
||||
scripting/include/entity.inc
|
||||
scripting/include/entity_prop_stocks.inc
|
||||
scripting/include/events.inc
|
||||
scripting/include/files.inc
|
||||
scripting/include/float.inc
|
||||
scripting/include/functions.inc
|
||||
scripting/include/geoip.inc
|
||||
scripting/include/halflife.inc
|
||||
scripting/include/handles.inc
|
||||
scripting/include/helpers.inc
|
||||
scripting/include/keyvalues.inc
|
||||
scripting/include/lang.inc
|
||||
scripting/include/logging.inc
|
||||
scripting/include/mapchooser.inc
|
||||
scripting/include/menus.inc
|
||||
scripting/include/nextmap.inc
|
||||
scripting/include/profiler.inc
|
||||
scripting/include/regex.inc
|
||||
scripting/include/protobuf.inc
|
||||
scripting/include/sdkhooks.inc
|
||||
scripting/include/sdktools.inc
|
||||
scripting/include/sdktools_client.inc
|
||||
scripting/include/sdktools_engine.inc
|
||||
scripting/include/sdktools_entinput.inc
|
||||
scripting/include/sdktools_entoutput.inc
|
||||
scripting/include/sdktools_functions.inc
|
||||
scripting/include/sdktools_gamerules.inc
|
||||
scripting/include/sdktools_hooks.inc
|
||||
scripting/include/sdktools_sound.inc
|
||||
scripting/include/sdktools_stocks.inc
|
||||
scripting/include/sdktools_stringtables.inc
|
||||
scripting/include/sdktools_tempents.inc
|
||||
scripting/include/sdktools_tempents_stocks.inc
|
||||
scripting/include/sdktools_trace.inc
|
||||
scripting/include/sdktools_variant_t.inc
|
||||
scripting/include/sdktools_voice.inc
|
||||
scripting/include/sorting.inc
|
||||
scripting/include/sourcemod.inc
|
||||
scripting/include/string.inc
|
||||
scripting/include/testing.inc
|
||||
scripting/include/textparse.inc
|
||||
scripting/include/tf2.inc
|
||||
scripting/include/tf2_stocks.inc
|
||||
scripting/include/timers.inc
|
||||
scripting/include/topmenus.inc
|
||||
scripting/include/usermessages.inc
|
||||
scripting/include/vector.inc
|
||||
scripting/include/version.inc
|
Binary file not shown.
|
@ -6,7 +6,7 @@
|
|||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
#define PLUGIN_VERSION "1.3.6"
|
||||
#define PLUGIN_VERSION "1.3.7"
|
||||
chatstrings_t gS_ChatStrings;
|
||||
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
|
||||
|
||||
|
@ -16,7 +16,7 @@ public Plugin myinfo =
|
|||
author = "SaengerItsWar",
|
||||
description = "Gives Kxnrl Store Credits for records",
|
||||
version = PLUGIN_VERSION,
|
||||
url = "https://deadnationgaming.eu/"
|
||||
url = "https://github.com/saengeritswar/shavit-credits/"
|
||||
}
|
||||
|
||||
// convars
|
||||
|
@ -39,6 +39,7 @@ char g_cMap[160];
|
|||
int g_iTier;
|
||||
int g_iStyle;
|
||||
float g_fPB;
|
||||
bool g_bRankings;
|
||||
|
||||
public void OnAllPluginsLoaded()
|
||||
{
|
||||
|
@ -46,6 +47,11 @@ public void OnAllPluginsLoaded()
|
|||
{
|
||||
SetFailState("Kxnrl store is required for the plugin to work.");
|
||||
}
|
||||
else if(!LibraryExists("shavit-wr"))
|
||||
{
|
||||
SetFailState("Shavit WR is required for the plugin to work.");
|
||||
}
|
||||
g_bRankings = LibraryExists("shavit-rankings");
|
||||
}
|
||||
|
||||
public void OnPluginStart()
|
||||
|
@ -88,6 +94,22 @@ public void Shavit_OnChatConfigLoaded()
|
|||
Shavit_GetChatStrings(sMessageStyle, gS_ChatStrings.sStyle, sizeof(chatstrings_t::sStyle));
|
||||
}
|
||||
|
||||
public void OnLibraryAdded(const char[] name)
|
||||
{
|
||||
if(StrEqual(name, "shavit-rankings"))
|
||||
{
|
||||
g_bRankings = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnLibraryRemoved(const char[] name)
|
||||
{
|
||||
if(StrEqual(name, "shavit-rankings"))
|
||||
{
|
||||
g_bRankings = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Shavit_OnStyleConfigLoaded(int styles)
|
||||
{
|
||||
if (styles == -1)
|
||||
|
@ -104,9 +126,12 @@ public void Shavit_OnStyleConfigLoaded(int styles)
|
|||
|
||||
public void Shavit_OnLeaveZone(int client, int zone, int track, int id, int entity)
|
||||
{
|
||||
g_iStyle = Shavit_GetBhopStyle(client);
|
||||
g_fPB = Shavit_GetClientPB(client, g_iStyle, track);
|
||||
if(zone == Zone_Start){
|
||||
g_iStyle = Shavit_GetBhopStyle(client);
|
||||
g_fPB = Shavit_GetClientPB(client, g_iStyle, track);
|
||||
}
|
||||
}
|
||||
|
||||
public void Shavit_OnFinish(int client, int style, float time, int jumps, int strafes, float sync, int track)
|
||||
{
|
||||
char sStyleSpecialString[sizeof(stylestrings_t::sSpecialString)];
|
||||
|
@ -122,11 +147,19 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
|
|||
|
||||
if(track == 0)
|
||||
{
|
||||
int iCredits;
|
||||
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvNormalAmount.IntValue * g_iTier) * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
int iCredits = iRoundResult;
|
||||
if(g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvNormalAmount.IntValue * g_iTier) * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
iCredits = iRoundResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCredits = g_cvNormalAmount.IntValue * g_iTier;
|
||||
}
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "finishing map");
|
||||
|
||||
|
@ -136,11 +169,19 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
|
|||
|
||||
else if(g_cvBNormalEnabled.BoolValue == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvNormalBAmount.IntValue * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
int iCredits = iRoundResult;
|
||||
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvNormalBAmount.IntValue * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
iCredits = iRoundResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCredits = g_cvNormalBAmount.IntValue;
|
||||
}
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "finishing map Bonus");
|
||||
Shavit_PrintToChat(client, "%t", "NormalBonusFinish", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
|
@ -153,10 +194,18 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
|
|||
{
|
||||
if(track == 0)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvPBAmount.IntValue * g_iTier) * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
int iCredits = iRoundResult;
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvPBAmount.IntValue * g_iTier) * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
iCredits = iRoundResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCredits = g_cvPBAmount.IntValue * g_iTier;
|
||||
}
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Personal Best");
|
||||
Shavit_PrintToChat(client, "%t", "PersonalBest", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
|
@ -164,11 +213,19 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
|
|||
|
||||
else if(g_cvEnabledBPb.BoolValue == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvBPbAmount.IntValue * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
int iCredits = iRoundResult;
|
||||
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvBPbAmount.IntValue * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
iCredits = iRoundResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCredits = g_cvBPbAmount.IntValue;
|
||||
}
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Bonus Personal Best");
|
||||
Shavit_PrintToChat(client, "%t", "BonusPersonalBest", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
|
@ -188,21 +245,37 @@ public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, i
|
|||
{
|
||||
if(track == 0)
|
||||
{
|
||||
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvWrAmount.IntValue * g_iTier) * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
int iCredits = iRoundResult;
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvWrAmount.IntValue * g_iTier) * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
iCredits = iRoundResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCredits = g_cvWrAmount.IntValue * g_iTier;
|
||||
}
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "breaking map record");
|
||||
Shavit_PrintToChat(client, "%t", "WorldRecord", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
|
||||
else if(g_cvBWREnabled.BoolValue == true) {
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvWrBAmount.IntValue * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
int iCredits = iRoundResult;
|
||||
else if(g_cvBWREnabled.BoolValue == true)
|
||||
{
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvWrBAmount.IntValue * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
iCredits = iRoundResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCredits = g_cvWrBAmount.IntValue;
|
||||
}
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "breaking Bonus record");
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue