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 391881cf1e - Show all commits

View file

@ -12,39 +12,46 @@ public Plugin myinfo =
version = PLUGIN_VERSION, version = PLUGIN_VERSION,
url = "https://deadnationgaming.eu/" url = "https://deadnationgaming.eu/"
}; };
Handle gh_enabled_normal;
Handle gh_enabled_wr; ConVar g_hNormalEnabled;
Handle gh_enabled_pb; int g_iNormalEnabled
Handle gh_amount_normal; ConVar g_hWREnabled;
Handle gh_amount_wr; int g_iWREnabled;
Handle gh_amount_pb; ConVar g_hEnabledPb;
Handle gh_enabled_t1; int g_iPBEnabled;
ConVar g_hT1Enabled;
int g_iT1Enabled;
ConVar g_hNormalAmount;
int g_iNormalAmount;
ConVar g_hWrAmount;
int g_iWrAmount;
ConVar g_hPBAmount;
int g_iPBAmount;
char gS_Map[160]; char gS_Map[160];
int iTier; int iTier;
int istyle; int istyle;
float fpb; float fpb;
int nr_enabled;
int wr_enabled;
int pb_enabled;
int t1_enabled;
public void OnPluginStart() public void OnPluginStart()
{ {
CreateConVar("shavit_creds_version", PLUGIN_VERSION, "Zephyrus-Store : Shavit Credits Map Finish", FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY); CreateConVar("shavit_creds_version", PLUGIN_VERSION, "Zephyrus-Store : Shavit Credits Map Finish", FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY);
gh_enabled_normal = CreateConVar("credits_enable_normal", "1", "Store money give for map finish is enabled?", 0, true, 0.0, true, 1.0); g_hNormalEnabled = CreateConVar("credits_enable_normal", "1", "Store money give for map finish is enabled?", 0, true, 0.0, true, 1.0);
gh_enabled_wr = CreateConVar("credits_enable_wr", "1", "Store money given for map World Record is enabled?", 0, true, 0.0, true, 1.0); g_hWREnabled = CreateConVar("credits_enable_wr", "1", "Store money given for map World Record is enabled?", 0, true, 0.0, true, 1.0);
gh_enabled_pb = CreateConVar("credits_enable_pb", "1", "Store money given for map Personal Best is enabled?", 0, true, 0.0, true, 1.0); g_hEnabledPb = CreateConVar("credits_enable_pb", "1", "Store money given for map Personal Best is enabled?", 0, true, 0.0, true, 1.0);
gh_enabled_t1 = 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_hT1Enabled = 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);
gh_amount_normal = CreateConVar("credits_amount_normal", "10", "Amount of credits are given on map finish.", 0, true, 1.0, false); g_hNormalAmount = CreateConVar("credits_amount_normal", "10", "Amount of credits are given on map finish.", 0, true, 1.0, false);
gh_amount_wr = CreateConVar("credits_amount_wr", "25", "Amount of credits are given on breaking world records.", 0, true, 1.0, false); g_hWrAmount = CreateConVar("credits_amount_wr", "25", "Amount of credits are given on breaking world records.", 0, true, 1.0, false);
gh_amount_pb = CreateConVar("credits_amount_pb", "10", "Amount of credits are given on breaking your personal best.", 0, true, 1.0, false); g_hPBAmount = CreateConVar("credits_amount_pb", "10", "Amount of credits are given on breaking your personal best.", 0, true, 1.0, false);
AutoExecConfig(true, "shavit-credits"); AutoExecConfig(true, "shavit-credits");
nr_enabled = GetConVarInt(gh_enabled_normal); g_iNormalEnabled = GetConVarInt(g_hNormalEnabled);
wr_enabled = GetConVarInt(gh_enabled_wr); g_iWREnabled = GetConVarInt(g_hWREnabled);
pb_enabled = GetConVarInt(gh_enabled_pb); g_iPBEnabled = GetConVarInt(g_hEnabledPb);
t1_enabled = GetConVarInt(gh_enabled_t1); g_iT1Enabled = GetConVarInt(g_hT1Enabled);
} }
@ -64,22 +71,22 @@ public Action Shavit_OnStart(int client, int track)
public void Shavit_OnFinish(int client, int style, float time, int jumps, int track) public void Shavit_OnFinish(int client, int style, float time, int jumps, int track)
{ {
if(nr_enabled == 1) if(g_iNormalEnabled == 1)
{ {
if(t1_enabled == 1 || iTier != 1) if(g_iT1Enabled == 1 || iTier != 1)
{ {
int fcredits = GetConVarInt(gh_amount_normal)*iTier; int fcredits = GetConVarInt(g_hNormalAmount)*iTier;
Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits); Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits);
PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for finishing this map.", fcredits); PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for finishing this map.", fcredits);
} }
} }
if(pb_enabled == 1) if(g_iPBEnabled == 1)
{ {
if(time<fpb){ if(time<fpb){
int fcredits = GetConVarInt(gh_amount_pb)*iTier; int fcredits = GetConVarInt(g_hPBAmount)*iTier;
Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits); Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits);
PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for breaking your Personal Best.", fcredits); PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for breaking your Personal Best.", fcredits);
@ -89,9 +96,9 @@ 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) public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int track)
{ {
if(wr_enabled == 1) if(g_iWREnabled == 1)
{ {
int fcredits = GetConVarInt(gh_amount_wr)*iTier; int fcredits = GetConVarInt(g_hWrAmount)*iTier;
Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits); Store_SetClientCredits(client, Store_GetClientCredits(client) + fcredits);
PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for break the world records.", fcredits); PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for break the world records.", fcredits);