added play time requirement for being allowed to spray
This commit is contained in:
parent
cf58c745d2
commit
3ec612167d
@ -5,6 +5,9 @@
|
|||||||
#include <clientprefs>
|
#include <clientprefs>
|
||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
|
|
||||||
|
//add some hour requirement for being allowed to spray
|
||||||
|
#include <unloze_playtime>
|
||||||
|
|
||||||
#undef REQUIRE_PLUGIN
|
#undef REQUIRE_PLUGIN
|
||||||
#include <adminmenu>
|
#include <adminmenu>
|
||||||
#define REQUIRE_PLUGIN
|
#define REQUIRE_PLUGIN
|
||||||
@ -35,6 +38,7 @@ ConVar g_cvarUseProximityCheck = null;
|
|||||||
ConVar g_cvarSendSpraysToConnectingClients = null;
|
ConVar g_cvarSendSpraysToConnectingClients = null;
|
||||||
ConVar g_cvarUsePersistentSprays = null;
|
ConVar g_cvarUsePersistentSprays = null;
|
||||||
ConVar g_cvarMaxSprayLifetime = null;
|
ConVar g_cvarMaxSprayLifetime = null;
|
||||||
|
ConVar g_cvarHourRequirement = null;
|
||||||
|
|
||||||
int g_iNSFWDecalIndex;
|
int g_iNSFWDecalIndex;
|
||||||
int g_iHiddenDecalIndex;
|
int g_iHiddenDecalIndex;
|
||||||
@ -49,6 +53,7 @@ bool g_bGotBlacklist;
|
|||||||
bool g_bGotNSFWList;
|
bool g_bGotNSFWList;
|
||||||
bool g_bFullyConnected;
|
bool g_bFullyConnected;
|
||||||
bool g_bSkipDecalHook;
|
bool g_bSkipDecalHook;
|
||||||
|
bool g_bFullFillHourRequirement[MAXPLAYERS + 1] = {false,...};
|
||||||
|
|
||||||
char g_sBanIssuer[MAXPLAYERS + 1][64];
|
char g_sBanIssuer[MAXPLAYERS + 1][64];
|
||||||
char g_sBanIssuerSID[MAXPLAYERS + 1][32];
|
char g_sBanIssuerSID[MAXPLAYERS + 1][32];
|
||||||
@ -56,6 +61,7 @@ char g_sBanReason[MAXPLAYERS + 1][32];
|
|||||||
char g_sSprayHash[MAXPLAYERS + 1][16];
|
char g_sSprayHash[MAXPLAYERS + 1][16];
|
||||||
char g_csSID[MAXPLAYERS + 1][65];
|
char g_csSID[MAXPLAYERS + 1][65];
|
||||||
|
|
||||||
|
int g_iClientHoursNotFullFilled[MAXPLAYERS + 1];
|
||||||
int g_iClientToClientSprayLifetime[MAXPLAYERS + 1][MAXPLAYERS + 1];
|
int g_iClientToClientSprayLifetime[MAXPLAYERS + 1][MAXPLAYERS + 1];
|
||||||
int g_iClientSprayLifetime[MAXPLAYERS + 1] = { 2, ... };
|
int g_iClientSprayLifetime[MAXPLAYERS + 1] = { 2, ... };
|
||||||
int g_iSprayLifetime[MAXPLAYERS + 1];
|
int g_iSprayLifetime[MAXPLAYERS + 1];
|
||||||
@ -85,7 +91,7 @@ public Plugin myinfo =
|
|||||||
{
|
{
|
||||||
name = "Spray Manager",
|
name = "Spray Manager",
|
||||||
description = "A plugin to help manage player sprays.",
|
description = "A plugin to help manage player sprays.",
|
||||||
author = "Obus",
|
author = "Obus blabla",
|
||||||
version = "2.1.1",
|
version = "2.1.1",
|
||||||
url = ""
|
url = ""
|
||||||
}
|
}
|
||||||
@ -156,6 +162,8 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
g_cvarMaxSprayLifetime = CreateConVar("sm_spraymanager_maxspraylifetime", "2", "If not using persistent sprays, remove sprays after their global lifetime (in rounds) exceeds this number");
|
g_cvarMaxSprayLifetime = CreateConVar("sm_spraymanager_maxspraylifetime", "2", "If not using persistent sprays, remove sprays after their global lifetime (in rounds) exceeds this number");
|
||||||
|
|
||||||
|
g_cvarHourRequirement = CreateConVar("sm_spraymanager_hour_requirement", "5", "Using the unloze play time plugin to set a minimum amount of hours for allowing players access to spraying.");
|
||||||
|
|
||||||
AutoExecConfig(true, "plugin.SprayManager");
|
AutoExecConfig(true, "plugin.SprayManager");
|
||||||
|
|
||||||
g_hTraceTimer = CreateTimer(0.25, Timer_PerformPlayerTraces, _, TIMER_REPEAT);
|
g_hTraceTimer = CreateTimer(0.25, Timer_PerformPlayerTraces, _, TIMER_REPEAT);
|
||||||
@ -330,6 +338,12 @@ public void OnClientPostAdminCheck(int client)
|
|||||||
UpdateHideSprays();
|
UpdateHideSprays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetPlayerHoursServer(int client, int hours)
|
||||||
|
{
|
||||||
|
g_iClientHoursNotFullFilled[client] = hours;
|
||||||
|
g_bFullFillHourRequirement[client] = g_iClientHoursNotFullFilled[client] > g_cvarHourRequirement.IntValue ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
public void update_client_online(int client, int is_online)
|
public void update_client_online(int client, int is_online)
|
||||||
{
|
{
|
||||||
if (!g_hDatabase)
|
if (!g_hDatabase)
|
||||||
@ -363,7 +377,7 @@ public void OnClientDisconnect(int client)
|
|||||||
|
|
||||||
update_client_online(client, 0);
|
update_client_online(client, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearPlayerInfo(client);
|
ClearPlayerInfo(client);
|
||||||
UpdateHideSprays();
|
UpdateHideSprays();
|
||||||
}
|
}
|
||||||
@ -2150,7 +2164,7 @@ public Action Command_ForceSFW(int client, int argc)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
|
||||||
AdminForceSpraySFW(iTarget);
|
AdminForceSpraySFW(iTarget);
|
||||||
PrintToChat(client, "\x01\x04[SprayManager]\x01 Marked \x04%N\x01's spray as SFW.", iTarget);
|
PrintToChat(client, "\x01\x04[SprayManager]\x01 Marked \x04%N\x01 spray as SFW.", iTarget);
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
@ -2165,7 +2179,7 @@ public Action Command_ForceSFW(int client, int argc)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
AdminForceSpraySFW(i);
|
AdminForceSpraySFW(i);
|
||||||
PrintToChat(client, "\x01\x04[SprayManager]\x01 Marked \x04%N\x01's spray as SFW.", i);
|
PrintToChat(client, "\x01\x04[SprayManager]\x01 Marked \x04%N\x01s spray as SFW.", i);
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
@ -2260,6 +2274,13 @@ public Action HookDecal(const char[] sTEName, const int[] iClients, int iNumClie
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check for an arbitrary amount of hours before allowing spraying
|
||||||
|
if (!g_bFullFillHourRequirement[client])
|
||||||
|
{
|
||||||
|
PrintToChat(client, "\x01\x04[SprayManager]\x01 You cannot spray because you dont have enough play time yet. (\x04%i/\x04%i\x01 hours)", g_iClientHoursNotFullFilled[client], g_cvarHourRequirement.IntValue);
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_fNextSprayTime[client] > GetGameTime())
|
if (g_fNextSprayTime[client] > GetGameTime())
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
|
||||||
@ -3306,6 +3327,8 @@ stock void ClearPlayerInfo(int client)
|
|||||||
g_SprayAABB[client] = view_as<float>({ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }); //???
|
g_SprayAABB[client] = view_as<float>({ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }); //???
|
||||||
g_bHasNSFWSpray[client] = false;
|
g_bHasNSFWSpray[client] = false;
|
||||||
g_bMarkedNSFWByAdmin[client] = false;
|
g_bMarkedNSFWByAdmin[client] = false;
|
||||||
|
g_bFullFillHourRequirement[client] = false;
|
||||||
|
g_iClientHoursNotFullFilled[client] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock void UpdateClientToClientSprayLifeTime(int client, int iLifeTime)
|
stock void UpdateClientToClientSprayLifeTime(int client, int iLifeTime)
|
||||||
|
Loading…
Reference in New Issue
Block a user