ZR: fix SMRPG XP multiplier only accepting int (uploading correctly this time)
This commit is contained in:
parent
5a3790afb3
commit
9c9dbf203a
77
SMRPG/smrpg_vip_multiplier.sp
Normal file
77
SMRPG/smrpg_vip_multiplier.sp
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#pragma semicolon 1
|
||||||
|
|
||||||
|
#include <sourcemod>
|
||||||
|
#include <sdktools>
|
||||||
|
#include <smrpg>
|
||||||
|
#include <cstrike>
|
||||||
|
#include <autoexecconfig>
|
||||||
|
|
||||||
|
//#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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user