diff --git a/SMRPG/smrpg_vip_multiplier.sp b/SMRPG/smrpg_vip_multiplier.sp new file mode 100644 index 00000000..df8884fe --- /dev/null +++ b/SMRPG/smrpg_vip_multiplier.sp @@ -0,0 +1,77 @@ +#pragma semicolon 1 + +#include +#include +#include +#include +#include + +//#define PXP_DEBUG + +ConVar g_hCVXPMultiplier; +ConVar g_hCVAdminFlag; + +public Plugin myinfo = +{ + name = "SMRPG VIP XP", + author = "Nano", + description = "Gives extra credits to players with a given flag", + version = "1.0", + url = "" +} + +public void OnPluginStart() +{ + AutoExecConfig_SetFile("plugin.smrpg_vip_multiplier"); + AutoExecConfig_SetCreateFile(true); + AutoExecConfig_SetPlugin(null); + + g_hCVXPMultiplier = AutoExecConfig_CreateConVar("smrpg_vip_multiplier", "2.0", "Multiplier for the XP a player gains", 0, true, 1.0); + g_hCVAdminFlag = AutoExecConfig_CreateConVar("smrpg_vip_multiplier_flag", "3.0", "Admin flag: (1 = o), (2 = p), ..., (6 = t)", 0, true, 1.0, true, 6.0); + + AutoExecConfig_ExecuteFile(); +} + +public Action SMRPG_OnAddExperience(int client, const char[] reason, int &iExperience, int other) +{ + int iAdmFlagCVAR = GetConVarInt(g_hCVAdminFlag); + float iMultiplier = GetConVarFloat (g_hCVXPMultiplier); + bool bClientHasFlag = false; + + switch(iAdmFlagCVAR) + { + case 1: + { + bClientHasFlag = CheckCommandAccess(client, "", ADMFLAG_CUSTOM1); + } + case 2: + { + bClientHasFlag = CheckCommandAccess(client, "", ADMFLAG_CUSTOM2); + } + case 3: + { + bClientHasFlag = CheckCommandAccess(client, "", ADMFLAG_CUSTOM3); + } + case 4: + { + bClientHasFlag = CheckCommandAccess(client, "", ADMFLAG_CUSTOM4); + } + case 5: + { + bClientHasFlag = CheckCommandAccess(client, "", ADMFLAG_CUSTOM5); + } + case 6: + { + bClientHasFlag = CheckCommandAccess(client, "", ADMFLAG_CUSTOM6); + } + } + if(bClientHasFlag) + { + #if defined PXP_DEBUG + LogMessage("%N received %i times the added XP for being VIP. Original XP: %i, new XP: %i", client, iMultiplier, iExperience, iMultiplier*iExperience); + #endif + iExperience = RoundToFloor(iMultiplier*iExperience); + } + + return Plugin_Continue; +} \ No newline at end of file