This commit is contained in:
Jackzie 2024-05-07 12:10:36 -05:00
parent 74f04f4847
commit b6cee78ab0
8 changed files with 55 additions and 32 deletions

View file

@ -52,9 +52,10 @@ static char FORBIDDEN_CLASSNAMES[MAX_FORBIDDEN_CLASSNAMES][] = {
"prop_ragdoll" "prop_ragdoll"
}; };
#define MAX_FORBIDDEN_MODELS 1 #define MAX_FORBIDDEN_MODELS 2
char FORBIDDEN_MODELS[MAX_FORBIDDEN_MODELS][] = { char FORBIDDEN_MODELS[MAX_FORBIDDEN_MODELS][] = {
"models/props_vehicles/c130.mdl", "models/props_vehicles/c130.mdl",
"models/props_vehicles/helicopter_rescue.mdl"
}; };
#define MAX_HIGHLIGHTED_CLASSNAMES 3 #define MAX_HIGHLIGHTED_CLASSNAMES 3

View file

@ -420,7 +420,6 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
static int profanityID; static int profanityID;
static int typooId; static int typooId;
if(profanityID == 0) profanityID = GetTrollID("No Profanity");
if(typooId == 0) typooId = GetTrollID("Typoos"); if(typooId == 0) typooId = GetTrollID("Typoos");
if(t_honk.IsActive(client) && t_honk.GetFlags(client) & 1) { if(t_honk.IsActive(client) && t_honk.GetFlags(client) & 1) {
@ -538,7 +537,7 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
PrintToServer("%N: %s", client, sArgs); PrintToServer("%N: %s", client, sArgs);
CPrintToChatAll("{blue}%N {default}: %s", client, newMessage); CPrintToChatAll("{blue}%N {default}: %s", client, newMessage);
return Plugin_Handled; return Plugin_Handled;
}else if(Trolls[profanityID].IsActive(client)) { } else if(t_noProfanity.IsActive(client)) {
char strings[32][MAX_PHRASE_LENGTH]; char strings[32][MAX_PHRASE_LENGTH];
static ArrayList phrases; static ArrayList phrases;
bool foundWord = false; bool foundWord = false;
@ -796,9 +795,9 @@ Action Event_TakeDamage(int victim, int& attacker, int& inflictor, float& damage
bool disableFF = false; bool disableFF = false;
int flags = t_reverseFF.GetFlags(attacker); int flags = t_reverseFF.GetFlags(attacker);
if(damagetype & DMG_BURN) { if(damagetype & DMG_BURN) {
disableFF = flags & 64 != 0;
} else if(damagetype & DMG_BLAST) {
disableFF = flags & 32 != 0; disableFF = flags & 32 != 0;
} else if(damagetype & DMG_BLAST) {
disableFF = flags & 64 != 0;
} else { } else {
// Does not run if DMG_BURN or DMG_BLAST, basically any other damage was caused besides burn/blast, then allow it // Does not run if DMG_BURN or DMG_BLAST, basically any other damage was caused besides burn/blast, then allow it
disableFF = true; disableFF = true;

View file

@ -21,6 +21,7 @@ Troll t_vocalGag;
Troll t_dullMelee; Troll t_dullMelee;
Troll t_rewind; Troll t_rewind;
Troll t_noRushingUs; Troll t_noRushingUs;
Troll t_noProfanity;
void SetupTrolls() { void SetupTrolls() {
trollKV = new StringMap(); trollKV = new StringMap();
@ -148,13 +149,14 @@ void SetupTrolls() {
SetCategory("Chat"); SetCategory("Chat");
TrollBuilder("Typoos", "", TrollMod_Constant); TrollBuilder("Typoos", "", TrollMod_Constant);
TrollBuilder("iCantSpellNoMore", "Chat messages letter will randomly changed with wrong letters", TrollMod_Constant); TrollBuilder("iCantSpellNoMore", "Chat messages letter will randomly changed with wrong letters", TrollMod_Constant);
TrollBuilder("No Profanity", "Replaces some words with random phrases", TrollMod_Constant) t_noProfanity = TrollBuilder("No Profanity", "Replaces some words with random phrases", TrollMod_Constant)
.AddPrompt() .AddPrompt()
.AddOption("Only Replace Swears") .AddOption("Only Replace Swears")
.AddOption("Replace Full Messages", true) .AddOption("Replace Full Messages", true)
.AddPrompt() .AddPrompt()
.AddOption("Show Modified to Them", true) .AddOption("Show Modified to Them", true)
.AddOption("Show Original to Them"); .AddOption("Show Original to Them")
.Build();
t_vocalGag = TrollBuilder("Vocalize Gag", "Prevents player from sending any vocalizations (even automatic)", TrollMod_Constant) t_vocalGag = TrollBuilder("Vocalize Gag", "Prevents player from sending any vocalizations (even automatic)", TrollMod_Constant)
.AddPromptMulti() .AddPromptMulti()
.AddOption("Quieter", false) .AddOption("Quieter", false)

View file

@ -49,6 +49,10 @@ methodmap BaseGame {
Format(GAMEMODE_PREFIX, sizeof(GAMEMODE_PREFIX), "[%s]", prefix); Format(GAMEMODE_PREFIX, sizeof(GAMEMODE_PREFIX), "[%s]", prefix);
} }
public void Cleanup() {
ClearPortalData();
}
public void PrintToServer(const char[] format, any ...) { public void PrintToServer(const char[] format, any ...) {
VFormat(buffer, sizeof(buffer), format, 3); VFormat(buffer, sizeof(buffer), format, 3);
PrintToServer("[%s] %s", GAMEMODE_NAME, buffer); PrintToServer("[%s] %s", GAMEMODE_NAME, buffer);

View file

@ -10,6 +10,10 @@
#if !defined ENT_ENV_NAME #if !defined ENT_ENV_NAME
#define ENT_ENV_NAME "cenv" #define ENT_ENV_NAME "cenv"
#endif #endif
#if !defined _anymap_included
#include <anymap>
#endif
stock void DeleteCustomEnts() { stock void DeleteCustomEnts() {
EntFireTarget(ENT_PROP_NAME, "Kill"); EntFireTarget(ENT_PROP_NAME, "Kill");
@ -76,11 +80,11 @@ enum PortalType {
Portal_Relative, Portal_Relative,
Portal_Teleport Portal_Teleport
} }
enum struct EntData { enum struct PortalData {
PortalType portalType; PortalType portalType;
float portalOffsets[3]; float portalOffsets[3];
} }
EntData entData[2048]; static AnyMap portals;
stock int CreatePortal(PortalType type, const char model[64], const float pos[3], const float offset[3] = { 40.0, 40.0, 0.0 }, const float scale[3] = { 5.0, 5.0, 5.0 }) { stock int CreatePortal(PortalType type, const char model[64], const float pos[3], const float offset[3] = { 40.0, 40.0, 0.0 }, const float scale[3] = { 5.0, 5.0, 5.0 }) {
int entity = CreateEntityByName("trigger_multiple"); int entity = CreateEntityByName("trigger_multiple");
@ -107,17 +111,21 @@ stock int CreatePortal(PortalType type, const char model[64], const float pos[3]
#endif #endif
AcceptEntityInput(entity, "Enable"); AcceptEntityInput(entity, "Enable");
entData[entity].portalOffsets = NULL_VECTOR; PortalData data;
data.portalOffsets = NULL_VECTOR;
// Convert relative offset to one based off full scale: // Convert relative offset to one based off full scale:
entData[entity].portalType = type; data.portalType = type;
if(type == Portal_Relative) { if(type == Portal_Relative) {
if(offset[0] != 0.0) entData[entity].portalOffsets[0] = (scale[0] * 2) + offset[0]; if(offset[0] != 0.0) data.portalOffsets[0] = (scale[0] * 2) + offset[0];
if(offset[1] != 0.0) entData[entity].portalOffsets[1] = (scale[1] * 2) + offset[1]; if(offset[1] != 0.0) data.portalOffsets[1] = (scale[1] * 2) + offset[1];
if(offset[2] != 0.0) entData[entity].portalOffsets[2] = (scale[2] * 2) + offset[2]; if(offset[2] != 0.0) data.portalOffsets[2] = (scale[2] * 2) + offset[2];
} else { } else {
entData[entity].portalOffsets = offset; data.portalOffsets = offset;
} }
if(portals == null) portals = new AnyMap();
portals.SetArray(entity, data, sizeof(data));
return entity; return entity;
} }
@ -125,26 +133,33 @@ stock int CreatePortal(PortalType type, const char model[64], const float pos[3]
} }
void OnPortalTouch(const char[] output, int caller, int activator, float delay) { void OnPortalTouch(const char[] output, int caller, int activator, float delay) {
if(entData[caller].portalType == Portal_Relative) { PortalData data;
if(!portals.GetArray(caller, data, sizeof(data))) return;
if(data.portalType == Portal_Relative) {
float pos[3]; float pos[3];
GetClientAbsOrigin(activator, pos); GetClientAbsOrigin(activator, pos);
float ang[3]; float ang[3];
GetClientAbsAngles(activator, ang); GetClientAbsAngles(activator, ang);
if(ang[0] < 0) pos[0] -= entData[caller].portalOffsets[0]; if(ang[0] < 0) pos[0] -= data.portalOffsets[0];
else pos[0] += entData[caller].portalOffsets[0]; else pos[0] += data.portalOffsets[0];
if(ang[1] < 0) pos[1] -= entData[caller].portalOffsets[1]; if(ang[1] < 0) pos[1] -= data.portalOffsets[1];
else pos[1] += entData[caller].portalOffsets[1]; else pos[1] += data.portalOffsets[1];
if(ang[2] < 0) pos[2] -= entData[caller].portalOffsets[2]; if(ang[2] < 0) pos[2] -= data.portalOffsets[2];
else pos[2] += entData[caller].portalOffsets[2]; else pos[2] += data.portalOffsets[2];
TeleportEntity(activator, pos, NULL_VECTOR, NULL_VECTOR); TeleportEntity(activator, pos, NULL_VECTOR, NULL_VECTOR);
} else { } else {
TeleportEntity(activator, entData[caller].portalOffsets, NULL_VECTOR, NULL_VECTOR); TeleportEntity(activator, data.portalOffsets, NULL_VECTOR, NULL_VECTOR);
} }
#if defined PORTAL_ENTER_SOUND #if defined PORTAL_ENTER_SOUND
EmitSoundToClient(activator, PORTAL_ENTER_SOUND, activator); EmitSoundToClient(activator, PORTAL_ENTER_SOUND, activator);
#endif #endif
} }
stock void ClearPortalData() {
if(portals != null)
portals.Clear();
}
stock int StartPropCreate(const char[] entClass, const char[] model, const float pos[3], const float ang[3] = NULL_VECTOR, const float vel[3] = NULL_VECTOR) { stock int StartPropCreate(const char[] entClass, const char[] model, const float pos[3], const float ang[3] = NULL_VECTOR, const float vel[3] = NULL_VECTOR) {
int entity = CreateEntityByName(entClass); int entity = CreateEntityByName(entClass);
if(entity == -1) return -1; if(entity == -1) return -1;

View file

@ -62,11 +62,13 @@ char FORBIDDEN_CLASSNAMES[MAX_FORBIDDEN_CLASSNAMES][] = {
"prop_ragdoll" "prop_ragdoll"
}; };
#define MAX_FORBIDDEN_MODELS 1 #define MAX_FORBIDDEN_MODELS 2
char FORBIDDEN_MODELS[MAX_FORBIDDEN_MODELS][] = { char FORBIDDEN_MODELS[MAX_FORBIDDEN_MODELS][] = {
"models/props_vehicles/c130.mdl", "models/props_vehicles/c130.mdl",
"models/props_vehicles/helicopter_rescue.mdl"
}; };
#define MAX_REVERSE_CLASSNAMES 2 #define MAX_REVERSE_CLASSNAMES 2
// Classnames that should automatically trigger reverse infected // Classnames that should automatically trigger reverse infected
static char REVERSE_CLASSNAMES[MAX_REVERSE_CLASSNAMES][] = { static char REVERSE_CLASSNAMES[MAX_REVERSE_CLASSNAMES][] = {
@ -90,7 +92,7 @@ Action Command_DoAHat(int client, int args) {
if(adminId == INVALID_ADMIN_ID) { if(adminId == INVALID_ADMIN_ID) {
PrintToChat(client, "[Hats] Hats are for admins only"); PrintToChat(client, "[Hats] Hats are for admins only");
return Plugin_Handled; return Plugin_Handled;
} else if(!adminId.HasFlag(Admin_Cheats)) { } else if(!adminId.HasFlag(Admin_Custom2)) {
PrintToChat(client, "[Hats] You do not have permission"); PrintToChat(client, "[Hats] You do not have permission");
return Plugin_Handled; return Plugin_Handled;
} }
@ -750,7 +752,7 @@ void EquipHat(int client, int entity, const char[] classname = "", int flags = H
GetEntPropVector(modifyEntity, Prop_Send, "m_vecMins", mins); GetEntPropVector(modifyEntity, Prop_Send, "m_vecMins", mins);
PrintToServer("%s mins: %f height:%f", classname, mins[2], maxs[2] - mins[2]); PrintToServer("%s mins: %f height:%f", classname, mins[2], maxs[2] - mins[2]);
if(StrContains(classname, "weapon_molotov") > -1 || StrContains(classname, "weapon_pipe_bomb") > -1 || StrContains(classname, "weapon_vomitjar") > -1) { if(StrContains(classname, "weapon_molotov") > -1 || StrContains(classname, "weapon_pipe_bomb") > -1 || StrContains(classname, "weapon_vomitjar") > -1) {
hatData[client].offset[2] += 10.0 + 1.0; hatData[client].offset[2] += 10.0;
} else { } else {
hatData[client].offset[2] += 10.0 + mins[2]; hatData[client].offset[2] += 10.0 + mins[2];
} }

View file

@ -2,7 +2,7 @@ TopMenuObject g_propSpawnerCategory;
public void OnAdminMenuReady(Handle topMenuHandle) { public void OnAdminMenuReady(Handle topMenuHandle) {
TopMenu topMenu = TopMenu.FromHandle(topMenuHandle); TopMenu topMenu = TopMenu.FromHandle(topMenuHandle);
if(g_topMenu != topMenuHandle) { if(g_topMenu != topMenuHandle) {
g_propSpawnerCategory = topMenu.AddCategory("hats_editor", Category_Handler); g_propSpawnerCategory = topMenu.AddCategory("hats_editor", Category_Handler, "sm_prop");
if(g_propSpawnerCategory != INVALID_TOPMENUOBJECT) { if(g_propSpawnerCategory != INVALID_TOPMENUOBJECT) {
topMenu.AddItem("editor_spawn", AdminMenu_Spawn, g_propSpawnerCategory, "sm_prop"); topMenu.AddItem("editor_spawn", AdminMenu_Spawn, g_propSpawnerCategory, "sm_prop");
topMenu.AddItem("editor_edit", AdminMenu_Edit, g_propSpawnerCategory, "sm_prop"); topMenu.AddItem("editor_edit", AdminMenu_Edit, g_propSpawnerCategory, "sm_prop");
@ -20,7 +20,7 @@ void Category_Handler(TopMenu topmenu, TopMenuAction action, TopMenuObject topob
if(action == TopMenuAction_DisplayTitle) { if(action == TopMenuAction_DisplayTitle) {
Format(buffer, maxlength, "Select a task:"); Format(buffer, maxlength, "Select a task:");
} else if(action == TopMenuAction_DisplayOption) { } else if(action == TopMenuAction_DisplayOption) {
Format(buffer, maxlength, "Spawn Props (Beta)"); Format(buffer, maxlength, "Spawn Props");
} }
} }

View file

@ -77,10 +77,10 @@ public void OnPluginStart() {
RegConsoleCmd("sm_hat", Command_DoAHat, "Hats"); RegConsoleCmd("sm_hat", Command_DoAHat, "Hats");
RegAdminCmd("sm_hatf", Command_DoAHat, ADMFLAG_ROOT, "Hats"); RegAdminCmd("sm_hatf", Command_DoAHat, ADMFLAG_ROOT, "Hats");
RegAdminCmd("sm_mkwall", Command_MakeWall, ADMFLAG_CHEATS); RegAdminCmd("sm_mkwall", Command_MakeWall, ADMFLAG_CUSTOM2);
RegAdminCmd("sm_edit", Command_Editor, ADMFLAG_CHEATS); RegAdminCmd("sm_edit", Command_Editor, ADMFLAG_CUSTOM2);
RegAdminCmd("sm_wall", Command_Editor, ADMFLAG_CHEATS); RegAdminCmd("sm_wall", Command_Editor, ADMFLAG_CUSTOM2);
RegAdminCmd("sm_prop", Command_Props, ADMFLAG_CHEATS); RegAdminCmd("sm_prop", Command_Props, ADMFLAG_CUSTOM2);
RegConsoleCmd("sm_hatp", Command_DoAHatPreset); RegConsoleCmd("sm_hatp", Command_DoAHatPreset);
cvar_sm_hats_blacklist_enabled = CreateConVar("sm_hats_blacklist_enabled", "1", "Is the prop blacklist enabled", FCVAR_NONE, true, 0.0, true, 1.0); cvar_sm_hats_blacklist_enabled = CreateConVar("sm_hats_blacklist_enabled", "1", "Is the prop blacklist enabled", FCVAR_NONE, true, 0.0, true, 1.0);