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,
url = "https://deadnationgaming.eu/"
};
Handle gh_enabled_normal;
Handle gh_enabled_wr;
Handle gh_enabled_pb;
Handle gh_amount_normal;
Handle gh_amount_wr;
Handle gh_amount_pb;
Handle gh_enabled_t1;
ConVar g_hNormalEnabled;
int g_iNormalEnabled
ConVar g_hWREnabled;
int g_iWREnabled;
ConVar g_hEnabledPb;
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];
int iTier;
int istyle;
float fpb;
int nr_enabled;
int wr_enabled;
int pb_enabled;
int t1_enabled;
public void OnPluginStart()
{
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);
gh_enabled_wr = 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);
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);
gh_amount_normal = 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);
gh_amount_pb = CreateConVar("credits_amount_pb", "10", "Amount of credits are given on breaking your personal best.", 0, true, 1.0, false);
g_hNormalEnabled = CreateConVar("credits_enable_normal", "1", "Store money give for map finish 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);
g_hEnabledPb = CreateConVar("credits_enable_pb", "1", "Store money given for map Personal Best is enabled?", 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);
g_hNormalAmount = CreateConVar("credits_amount_normal", "10", "Amount of credits are given on map finish.", 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);
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");
nr_enabled = GetConVarInt(gh_enabled_normal);
wr_enabled = GetConVarInt(gh_enabled_wr);
pb_enabled = GetConVarInt(gh_enabled_pb);
t1_enabled = GetConVarInt(gh_enabled_t1);
g_iNormalEnabled = GetConVarInt(g_hNormalEnabled);
g_iWREnabled = GetConVarInt(g_hWREnabled);
g_iPBEnabled = GetConVarInt(g_hEnabledPb);
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)
{
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);
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){
int fcredits = GetConVarInt(gh_amount_pb)*iTier;
int fcredits = GetConVarInt(g_hPBAmount)*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);
@ -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)
{
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);
PrintToChat(client, "[\x04Store\x01] You have earned \x04%d\x01 credits for break the world records.", fcredits);