beautified the plugin #1

Merged
Totenfluch merged 10 commits from master into master 2019-05-01 00:25:24 +02:00
Showing only changes of commit 9776d221ae - Show all commits

View file

@ -14,19 +14,19 @@ public Plugin myinfo =
url = "https://deadnationgaming.eu/"
};
ConVar g_hNormalEnabled;
ConVar g_cvNormalEnabled;
int g_iNormalEnabled
ConVar g_hWREnabled;
ConVar g_cvWREnabled;
int g_iWREnabled;
ConVar g_hEnabledPb;
ConVar g_cvEnabledPb;
int g_iPBEnabled;
ConVar g_hT1Enabled;
ConVar g_cvT1Enabled;
int g_iT1Enabled;
ConVar g_hNormalAmount;
ConVar g_cvNormalAmount;
int g_iNormalAmount;
ConVar g_hWrAmount;
ConVar g_cvWrAmount;
int g_iWrAmount;
ConVar g_hPBAmount;
ConVar g_cvPBAmount;
int g_iPBAmount;
@ -40,26 +40,26 @@ public void OnPluginStart() {
AutoExecConfig_SetCreateFile(true);
CreateConVar("shavit_credits_version", PLUGIN_VERSION, "Zephyrus-Store : Shavit Credits Map Finish", FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY);
g_hNormalEnabled = AutoExecConfig_CreateConVar("credits_enable_normal", "1", "Store money give for map finish is enabled?", 0, true, 0.0, true, 1.0);
g_hWREnabled = AutoExecConfig_CreateConVar("credits_enable_wr", "1", "Store money given for map World Record is enabled?", 0, true, 0.0, true, 1.0);
g_hEnabledPb = AutoExecConfig_CreateConVar("credits_enable_pb", "1", "Store money given for map Personal Best is enabled?", 0, true, 0.0, true, 1.0);
g_hT1Enabled = AutoExecConfig_CreateConVar("credits_enable_t1", "1", "Enable/Disable give credits for Tier 1 Has no effect on WRs and PBs!", 0, true, 0.0, true, 1.0);
g_hNormalAmount = AutoExecConfig_CreateConVar("credits_amount_normal", "10", "Amount of credits are given on map finish.", 0, true, 1.0, false);
g_hWrAmount = AutoExecConfig_CreateConVar("credits_amount_wr", "25", "Amount of credits are given on breaking world records.", 0, true, 1.0, false);
g_hPBAmount = AutoExecConfig_CreateConVar("credits_amount_pb", "10", "Amount of credits are given on breaking your personal best.", 0, true, 1.0, false);
g_cvNormalEnabled = AutoExecConfig_CreateConVar("credits_enable_normal", "1", "Store money give for map finish is enabled?", 0, true, 0.0, true, 1.0);
g_cvWREnabled = AutoExecConfig_CreateConVar("credits_enable_wr", "1", "Store money given for map World Record is enabled?", 0, true, 0.0, true, 1.0);
g_cvEnabledPb = AutoExecConfig_CreateConVar("credits_enable_pb", "1", "Store money given for map Personal Best is enabled?", 0, true, 0.0, true, 1.0);
g_cvT1Enabled = AutoExecConfig_CreateConVar("credits_enable_t1", "1", "Enable/Disable give credits for Tier 1 Has no effect on WRs and PBs!", 0, true, 0.0, true, 1.0);
g_cvNormalAmount = AutoExecConfig_CreateConVar("credits_amount_normal", "10", "Amount of credits are given on map finish.", 0, true, 1.0, false);
g_cvWrAmount = AutoExecConfig_CreateConVar("credits_amount_wr", "25", "Amount of credits are given on breaking world records.", 0, true, 1.0, false);
g_cvPBAmount = AutoExecConfig_CreateConVar("credits_amount_pb", "10", "Amount of credits are given on breaking your personal best.", 0, true, 1.0, false);
AutoExecConfig_CleanFile();
AutoExecConfig_ExecuteFile();
}
public void OnConfigsExecuted() {
g_iNormalEnabled = GetConVarInt(g_hNormalEnabled);
g_iWREnabled = GetConVarInt(g_hWREnabled);
g_iPBEnabled = GetConVarInt(g_hEnabledPb);
g_iT1Enabled = GetConVarInt(g_hT1Enabled);
g_iNormalAmount = GetConVarInt(g_hNormalAmount);
g_iWrAmount = GetConVarInt(g_hWrAmount);
g_iPBAmount = GetConVarInt(g_hPBAmount);
g_iNormalEnabled = GetConVarInt(g_cvNormalEnabled);
g_iWREnabled = GetConVarInt(g_cvWREnabled);
g_iPBEnabled = GetConVarInt(g_cvEnabledPb);
g_iT1Enabled = GetConVarInt(g_cvT1Enabled);
g_iNormalAmount = GetConVarInt(g_cvNormalAmount);
g_iWrAmount = GetConVarInt(g_cvWrAmount);
g_iPBAmount = GetConVarInt(g_cvPBAmount);
}
public void OnMapStart() {
@ -76,7 +76,7 @@ public Action Shavit_OnStart(int client, int track) {
public void Shavit_OnFinish(int client, int style, float time, int jumps, int track) {
if (g_iNormalEnabled == 1) {
if (g_iT1Enabled == 1 || g_iTier != 1) {
int fcredits = GetConVarInt(g_hNormalAmount) * g_iTier;
int fcredits = GetConVarInt(g_cvNormalAmount) * g_iTier;
Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits);
PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for finishing this map.", fcredits);
@ -86,7 +86,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int tr
if (g_iPBEnabled == 1) {
if (time < g_fPB) {
int fcredits = GetConVarInt(g_hPBAmount) * g_iTier;
int fcredits = GetConVarInt(g_cvPBAmount) * g_iTier;
Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits);
PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for breaking your Personal Best.", fcredits);
@ -96,7 +96,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int tr
}
public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int track) {
if (g_iWREnabled == 1) {
int fcredits = GetConVarInt(g_hWrAmount) * g_iTier;
int fcredits = GetConVarInt(g_cvWrAmount) * g_iTier;
Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits);
PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for break the world records.", fcredits);