Skip to content

Commit

Permalink
0.6.3.2 (#4)
Browse files Browse the repository at this point in the history
* New config system and logs

* Update README.md

* Update README.md

* Fixes and updates

During catch, CT's speed is increased with 0.5!
Added logging.
Added server command sm_reloadbw.
General fixes.

* Update README.md

* Added command sm_nolr

* Update README.md
  • Loading branch information
jonteohr authored Sep 25, 2017
1 parent d12c8af commit 124768f
Show file tree
Hide file tree
Showing 17 changed files with 1,118 additions and 73 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

## Dependencies
* [SmartJailDoors](https://forums.alliedmods.net/showthread.php?t=264100) _by Kailo_
* [SteamWorks Extension](https://forums.alliedmods.net/showthread.php?t=229556) for Automatic Updates (Included in plugin package)
* [SteamWorks Extension](https://forums.alliedmods.net/showthread.php?t=229556) _for Automatic Updates (Included in plugin package)_

## Features
The major function this plugin offers is that the warden can choose special event days to play out for the round. Each day has some special server rules & features that applies in order to make it much more fun for the players!
Expand Down Expand Up @@ -80,6 +80,8 @@ Some of the other entries in the menu include:
|`sm_warden_icon_path`|**decals/BetterWarden/warden**|The path to the icon. Do not include file extensions! The path here should be from whithin the materials/ folder.|
|`sm_warden_deathsound`|**1**|Play a sound telling everyone the warden has died? 1 = Enable. 0 = Disable.|
|`sm_warden_createsound`|**1**|Play a sound to everyone when someone becomes warden 1 = Enable. 0 = Disable.|
|`sm_warden_logs`|**0**|Do you want the plugin to write logs? Generally only necessary when you're experiencing any sort of issue. 1 = Enable. 0 = Disable.|
|`sm_warden_nolr`|**1**|Allow warden to control if terrorists can do a !lastrequest or !lr when available? 1 = Enable. 0 = Disable.|

### WardenMenu
| ConVar | Default | Description |
Expand Down
18 changes: 13 additions & 5 deletions addons/sourcemod/scripting/BetterWarden/Add-Ons/catch.sp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <colorvariables>
#include <smlib>
#include <BetterWarden/catch>
#include <autoexecconfig>

#pragma semicolon 1
#pragma newdecls required
Expand Down Expand Up @@ -48,9 +49,11 @@ public void OnPluginStart() {
LoadTranslations("BetterWarden.Catch.phrases.txt");
SetGlobalTransTarget(LANG_SERVER);

AutoExecConfig(true, "Catch", "BetterWarden");

gc_bFreezeTime = CreateConVar("sm_warden_catch_freezetime", "1", "Freeze all CT's for 5 seconds when game is started?\n1 = Enable.\n0 = Disable.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
AutoExecConfig_SetFile("Catch", "BetterWarden/Add-Ons");
AutoExecConfig_SetCreateFile(true);
gc_bFreezeTime = AutoExecConfig_CreateConVar("sm_warden_catch_freezetime", "1", "Freeze all CT's for 5 seconds when game is started?\n1 = Enable.\n0 = Disable.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
AutoExecConfig_ExecuteFile();
AutoExecConfig_CleanFile();

HookEvent("player_death", OnPlayerDeath);
HookEvent("round_start", OnRoundStart, EventHookMode_Pre);
Expand All @@ -70,7 +73,7 @@ public void OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) {
}
}

public Action OnClientTouch(int client, int other) {
public Action OnClientTouch(int client, int other) { // Client = The CT. other = the victim (T)
if(g_bIsCatchActive == false) // Don't do anything if Catch ain't active
return Plugin_Continue;
if(!IsValidClient(client) || !IsValidClient(other)) // Make sure client !bot & alive
Expand All @@ -82,6 +85,8 @@ public Action OnClientTouch(int client, int other) {
ForcePlayerSuicide(other);
CPrintToChatAll("%s %t", g_sPrefix, "Player Caught T", client, other);

AddToBWLog("%N caught %N during catch.", client, other);

return Plugin_Handled;
}

Expand Down Expand Up @@ -117,6 +122,7 @@ public void EndCatch() { // End the whole game and choose a winner

if(GetClientTeam(i) != CS_TEAM_T)
continue;
SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", 1.0);
winner = i;
break;
}
Expand Down Expand Up @@ -150,7 +156,7 @@ public Action FreezeTimer(Handle timer) {
continue;
if(GetClientTeam(i) != CS_TEAM_CT)
continue;
SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", 1.5);
}
secs = 5;
return Plugin_Stop;
Expand Down Expand Up @@ -195,5 +201,7 @@ public int Native_initCatch(Handle plugin, int numParams) { // Called to start t
CreateTimer(1.0, FreezeTimer, _, TIMER_REPEAT);
}

AddToBWLog("Catch was initiated!");

return true;
}
10 changes: 7 additions & 3 deletions addons/sourcemod/scripting/BetterWarden/Add-Ons/models.sp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <sdktools>
#include <betterwarden>
#include <cstrike>
#include <autoexecconfig>

// Compiler options
#pragma semicolon 1
Expand All @@ -42,10 +43,13 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
}

public void OnPluginStart() {
AutoExecConfig(true, "models", "BetterWarden/Add-Ons"); // Create a addon-specific config!
AutoExecConfig_SetFile("models", "BetterWarden/Add-Ons"); // Create a addon-specific config!
AutoExecConfig_SetCreateFile(true);
gc_bWardenModel = AutoExecConfig_CreateConVar("sm_warden_model", "1", "Enable or disable the warden getting a player model.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
gc_bDeputyModel = AutoExecConfig_CreateConVar("sm_warden_deputy_model", "0", "Give the other CT's a fitting model aswell?", FCVAR_NOTIFY, true, 0.0, true, 1.0);

gc_bWardenModel = CreateConVar("sm_warden_model", "1", "Enable or disable the warden getting a player model.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
gc_bDeputyModel = CreateConVar("sm_warden_deputy_model", "0", "Give the other CT's a fitting model aswell?", FCVAR_NOTIFY, true, 0.0, true, 1.0);
AutoExecConfig_ExecuteFile();
AutoExecConfig_CleanFile();

HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Pre);
}
Expand Down
12 changes: 9 additions & 3 deletions addons/sourcemod/scripting/BetterWarden/Add-Ons/voteday.sp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <wardenmenu>
#include <cstrike>
#include <colorvariables>
#include <autoexecconfig>

// Optional plugins (Add-Ons)
#undef REQUIRE_PLUGIN
Expand Down Expand Up @@ -71,9 +72,13 @@ public void OnPluginStart() {

HookEvent("round_start", OnRoundStart, EventHookMode_Pre);

AutoExecConfig(true, "voteday", "BetterWarden/Add-Ons");
gc_fVoteTime = CreateConVar("sm_warden_vote_duration", "30.0", "The duration of event day votes.", FCVAR_NOTIFY, true, 1.0, true, 120.0);
gc_bVoteCooldown = CreateConVar("sm_warden_vote_spam", "1", "Prevent users from starting another vote after one has failed in the same round?\n1 = Enable.\n0 = Disable.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
AutoExecConfig_SetFile("voteday", "BetterWarden/Add-Ons");
AutoExecConfig_SetCreateFile(true);
gc_fVoteTime = AutoExecConfig_CreateConVar("sm_warden_vote_duration", "30.0", "The duration of event day votes.", FCVAR_NOTIFY, true, 1.0, true, 120.0);
gc_bVoteCooldown = AutoExecConfig_CreateConVar("sm_warden_vote_spam", "1", "Prevent users from starting another vote after one has failed in the same round?\n1 = Enable.\n0 = Disable.", FCVAR_NOTIFY, true, 0.0, true, 1.0);

AutoExecConfig_ExecuteFile();
AutoExecConfig_CleanFile();
}

public void OnAllPluginsLoaded() { // Handle late loads
Expand Down Expand Up @@ -285,6 +290,7 @@ public void StartVote(int client, int game) {
continue;
BWVoteMenu(i);
}
AddToBWLog("%N started a vote.", client);
}

public bool VoteFinished() {
Expand Down
10 changes: 8 additions & 2 deletions addons/sourcemod/scripting/BetterWarden/Add-Ons/wildwest.sp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <colorvariables>
#include <smlib>
#include <BetterWarden/wildwest>
#include <autoexecconfig>

// Misc variables
bool g_bIsWWActive;
Expand Down Expand Up @@ -54,8 +55,12 @@ public void OnPluginStart() {

gc_bInfAmmo = FindConVar("sv_infinite_ammo"); // This will be changed to 2 when it starts and reset to the value in server.cfg when game ends

AutoExecConfig(true, "wildwest", "BetterWarden/Add-Ons");
gc_sWeaponUsed = CreateConVar("sm_betterwarden_wildwest_weapon", "weapon_revolver", "What weapon is supposed to be used?\nUse the entity names.", FCVAR_NOTIFY);
AutoExecConfig_SetFile("wildwest", "BetterWarden/Add-Ons");
AutoExecConfig_SetCreateFile(true);
gc_sWeaponUsed = AutoExecConfig_CreateConVar("sm_betterwarden_wildwest_weapon", "weapon_revolver", "What weapon is supposed to be used?\nUse the entity names.", FCVAR_NOTIFY);

AutoExecConfig_ExecuteFile();
AutoExecConfig_CleanFile();
}


Expand All @@ -75,6 +80,7 @@ public void StartWW() { // Start the actual event
continue;
GivePlayerItem(i, buff);
}
AddToBWLog("Wild West was initiated.");
g_bIsWWActive = true;
SetConVarInt(gc_bInfAmmo, 2);
}
Expand Down
15 changes: 12 additions & 3 deletions addons/sourcemod/scripting/BetterWarden/Add-Ons/zombie.sp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <cstrike>
#include <smlib>
#include <emitsoundany>
#include <autoexecconfig>

// Compiler options
#pragma semicolon 1
Expand Down Expand Up @@ -58,9 +59,13 @@ public void OnPluginStart() {
HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Pre);
HookEvent("round_end", OnRoundEnd, EventHookMode_PostNoCopy);

AutoExecConfig(true, "zombie", "BetterWarden/Add-Ons");
gc_bSwapBack = CreateConVar("sm_warden_zombie_swapback", "1", "In the round after a zombie round, swap back the CT's, that were infected, to Counter-Terrorists?\n1 = Enable.\n0 = Disable.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
gc_iZombieHealth = CreateConVar("sm_warden_zombie_health", "2000", "How much max-health should zombies have?", FCVAR_NOTIFY);
AutoExecConfig_SetFile("zombie", "BetterWarden/Add-Ons");
AutoExecConfig_SetCreateFile(true);
gc_bSwapBack = AutoExecConfig_CreateConVar("sm_warden_zombie_swapback", "1", "In the round after a zombie round, swap back the CT's, that were infected, to Counter-Terrorists?\n1 = Enable.\n0 = Disable.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
gc_iZombieHealth = AutoExecConfig_CreateConVar("sm_warden_zombie_health", "2000", "How much max-health should zombies have?", FCVAR_NOTIFY);

AutoExecConfig_ExecuteFile();
AutoExecConfig_CleanFile();
}

public void OnMapStart() {
Expand Down Expand Up @@ -130,6 +135,7 @@ public void OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast) {

if(IsValidClient(client) && GetClientTeam(client) == CS_TEAM_T && g_bIsZombieActive) { // Support respawns
SetClientZombie(client);
AddToBWLog("%N was made a zombie.", client);
}
}

Expand Down Expand Up @@ -188,6 +194,7 @@ public Action OnTakeDamageAlive(int victim, int &attacker, int &inflictor, float
if(iSound == 3)
EmitSoundToClientAny(inflictor, "betterwarden/zombie_kill3.mp3");
CPrintToChatAll("%s %t", g_sPrefix, "Zombie Infected", inflictor, victim);
AddToBWLog("%N was infected by %N during zombie round.", victim, inflictor);
return Plugin_Handled;
}

Expand Down Expand Up @@ -221,6 +228,8 @@ public int Native_initZombie(Handle plugin, int numParams) {
CPrintToChatAll("%s {red}****************************************************", g_sPrefix);
CPrintToChatAll("");

AddToBWLog("Zombie mode has started!");

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public Action sm_abortgames(int client, int args) {
CPrintToChatAll("%s %t", g_sCMenuPrefix, "Admin Aborted", client);
abortGames();

AddToBWLog("An admin has stopped the current game.");

return Plugin_Handled;
}

Expand Down
15 changes: 9 additions & 6 deletions addons/sourcemod/scripting/BetterWarden/WardenMenu/forwards.sp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ public void OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) {
if(g_iHnsWinners == g_iAliveTs) {
abortGames();
CPrintToChatAll("%s %t", g_sCMenuPrefix, "HnS Over");

AddToBWLog("Hide n' Seek is now over and there's a winner!");
Call_StartForward(gF_OnHnsOver);
Call_Finish();
} else {
CPrintToChatAll("%s %t", g_sCMenuPrefix, "HnS Players Left", g_iAliveTs);
AddToBWLog("A Terrorist died during Hide n' Seek but there's still contenders left.");
}
}
}
Expand All @@ -49,6 +50,7 @@ public Action OnTakeDamageAlive(int victim, int &attacker, int &inflictor, float
if(g_iHnsActive == 1 && gc_bHnSGod.IntValue == 1) {
if(IsValidClient(victim) && IsValidClient(inflictor) && GetClientTeam(victim) == CS_TEAM_CT && GetClientTeam(inflictor) == CS_TEAM_T) {
CPrintToChat(inflictor, "%s %t", g_sCMenuPrefix, "No Rebel HnS");
AddToBWLog("%N tried attacking %N but was denied since Hide n' Seek is active.", inflictor, victim);
return Plugin_Handled;
}
}
Expand All @@ -63,10 +65,11 @@ public void OnRoundStart(Event event, const char[] name, bool dontBroadcast) {

g_iAliveTs = 0;
g_iAliveTs = GetTeamAliveClientCount(CS_TEAM_T);
for(int client = 1; client <= MaxClients; client++) {
if(IsValidClient(client)) {
if(ClientHasFreeday(client)) {
RemoveClientFreeday(client);
for(int i = 1; i <= MaxClients; i++) {
if(IsValidClient(i)) {
if(ClientHasFreeday(i)) {
RemoveClientFreeday(i);
AddToBWLog("%N's freeday was removed since it's a new round.", i);
}
}
}
Expand Down Expand Up @@ -111,7 +114,7 @@ public void OnWardenCreated(int client) {
if(gc_bAutoOpen.IntValue == 1) {
openMenu(client);
} else {
PrintToServer("Skipping auto open since it's disabled in config.");
AddToBWLog("Skipping auto open since it's disabled in config.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public int DaysMenuHandler(Menu menu, MenuAction action, int client, int param2)
ExecWarday();

if(StrEqual(info, CHOICE5))
initGrav(client);
ExecGravday();

if(StrEqual(info, CHOICE6))
initCatch();
Expand Down
21 changes: 11 additions & 10 deletions addons/sourcemod/scripting/BetterWarden/WardenMenu/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
/*
* Natives
*/
public int Native_IsEventDayActive(Handle plugin, int numParams)
{
public int Native_IsEventDayActive(Handle plugin, int numParams) {
if(g_bIsGameActive) {
return true;
}
Expand Down Expand Up @@ -82,6 +81,7 @@ public int Native_GiveClientFreeday(Handle plugin, int numParams) {
if(IsValidClient(client)) {
g_iClientFreeday[client] = 1;
SetClientBeacon(client, true);
AddToBWLog("%N was given a freeday.", client);
return true;
}

Expand All @@ -94,6 +94,7 @@ public int Native_RemoveClientFreeday(Handle plugin, int numParams) {
if(IsValidClient(client)) {
g_iClientFreeday[client] = 0;
SetClientBeacon(client, false);
AddToBWLog("%N's freeday was cancelled.", client);
return true;
}

Expand Down Expand Up @@ -131,7 +132,7 @@ public int Native_ExecWarday(Handle plugin, int numParams) {
CPrintToChatAll("{blue}-----------------------------------------------------");
g_iWardayActive = 1;
g_bIsGameActive = true;

AddToBWLog("A warday was executed.");
return true;
} else if(gc_iWardayTimes.IntValue != 0 && g_iWarTimes >= gc_iWardayTimes.IntValue) {
CPrintToChat(client, "%s %t", "Too many wardays", g_iWarTimes, gc_iWardayTimes.IntValue);
Expand All @@ -145,7 +146,7 @@ public int Native_ExecWarday(Handle plugin, int numParams) {
g_iWardayActive = 1;
g_bIsGameActive = true;
g_iWarTimes++;

AddToBWLog("A warday was executed.");
return true;
}

Expand All @@ -162,7 +163,7 @@ public int Native_ExecFreeday(Handle plugin, int numParams) {
CPrintToChatAll("{blue}-----------------------------------------------------");
g_iFreedayActive = 1;
g_bIsGameActive = true;

AddToBWLog("A Freeday was executed.");
return true;
} else if(gc_iFreedayTimes.IntValue != 0 && g_iFreedayTimes >= gc_iFreedayTimes.IntValue) {
CPrintToChat(client, "%s %t", g_sCMenuPrefix, "Too many freedays", g_iFreedayTimes, gc_iFreedayTimes.IntValue);
Expand All @@ -175,7 +176,7 @@ public int Native_ExecFreeday(Handle plugin, int numParams) {
g_iFreedayActive = 1;
g_bIsGameActive = true;
g_iFreedayTimes++;

AddToBWLog("A Freeday was executed.");
return true;
}

Expand All @@ -195,7 +196,7 @@ public int Native_ExecHnS(Handle plugin, int numParams) {
g_iHnsActive = 1;
g_bIsGameActive = true;
CreateTimer(0.5, HnSInfo, _, TIMER_REPEAT);

AddToBWLog("A Hide n' Seek was executed.");
return true;

} else if(gc_iHnSTimes.IntValue != 0 && g_iHnsTimes >= gc_iHnSTimes.IntValue) {
Expand All @@ -212,7 +213,7 @@ public int Native_ExecHnS(Handle plugin, int numParams) {
g_bIsGameActive = true;
g_iHnsTimes++;
CreateTimer(0.5, HnSInfo, _, TIMER_REPEAT);

AddToBWLog("A Hide n' Seek was executed.");
return true;
}
} else {
Expand Down Expand Up @@ -249,7 +250,7 @@ public int Native_ExecGravday(Handle plugin, int numParams) {
}
}
}

AddToBWLog("A Gravity Freeday was executed.");
return true;

} else if(gc_iGravTimes.IntValue != 0 && g_iGravTimes >= gc_iGravTimes.IntValue) {
Expand Down Expand Up @@ -280,7 +281,7 @@ public int Native_ExecGravday(Handle plugin, int numParams) {
}
}
}

AddToBWLog("A Gravity Freeday was executed.");
return true;
}

Expand Down
Loading

0 comments on commit 124768f

Please sign in to comment.