Merge branch 'master' of github.com:Jackzmc/sourcemod-plugins

This commit is contained in:
Jackzie 2023-08-15 09:38:24 -05:00
commit 5376c6780e
16 changed files with 126 additions and 58 deletions

View file

@ -494,13 +494,27 @@
}
"c3m4_plantation"
{
"sets"
{
"begin"
{
}
"mansion"
{
"climbing" "on"
"spawnpoint" "1656.207519 -120.207824 224.031250"
}
}
"defaultset" "begin"
"ents"
{
"A"
{
"origin" "2000.802612, -426.686829, 402.803497"
"origin" "2000.802612 -426.686829 402.803497"
"type" "env_physics_blocker"
"scale" "150.0 150.00 1.0"
"set" "begin"
}
"A_PROP"
{
@ -508,7 +522,36 @@
"type" "prop_dynamic"
"model" "props_swamp/boardwalk_384.mdl"
"rotation" "0 90 0"
"set" "begin"
}
"MANSION_ENT_RAIL"
{
"model" "props_exteriors/wood_railing004c.mdl"
"type" "prop_dynamic"
"origin" "2529.63 -804.10 642.56"
"angles" "0.00 178.84 0.00"
"set" "mansion"
}
"MANSION_ENT_BLOCK"
{
"origin" "2563.37 -818.00 366.03"
"type" "env_physics_blocker"
"scale" "441 10 400"
"set" "mansion"
}
"MANSION_ENT_GATE"
{
"model" "props_street/police_barricade_496in.mdl"
"origin" "1693.63 -1178.33 169.86"
"type" "prop_dynamic"
"set" "mansion"
}
}
"inputs"
{
"env_physics_blocker" "Kill"
"gate_explode_relay" "Trigger"
"prop_minigun" "Kill"
}
}
"c1m3_mall"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1039,7 +1039,7 @@ public void Event_EnteredSpit(Event event, const char[] name, bool dontBroadcast
public void Event_BotPlayerSwap(Event event, const char[] name, bool dontBroadcast) {
//Player replaced their idle bot
int client = GetClientOfUserId(event.GetInt("player"));
if(client) {
if(client > 0) {
bool debug_hadTroll = false;
for(int i = 1; i <= MAX_TROLLS; i++) {
if(Trolls[i].IsActive(client) && Trolls[i].HasMod(TrollMod_Constant)) { //Add activeFlagClients >= 0 check possibly?

View file

@ -394,11 +394,17 @@ void ShowTrollCombosMenu(int client, int victimUserID) {
void ShowTrollMenu(int client, bool isComboList) {
Menu menu = isComboList ? new Menu(ChoosePlayerHandlerForCombos) : new Menu(ChoosePlayerHandler);
menu.SetTitle("Choose a player to troll");
// If player idle, say they are survivor
int clientTeam = GetClientTeam(client);
if(clientTeam < 2) {
if(L4D_IsPlayerIdle(client)) clientTeam = 2;
}
static char userid[8], display[64];
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && (hAllowEnemyTeam.BoolValue || GetClientTeam(i) == GetClientTeam(client))) {
if(IsClientConnected(i) && IsClientInGame(i) && (hAllowEnemyTeam.BoolValue || GetClientTeam(i) == clientTeam)) {
IntToString(GetClientUserId(i), userid, sizeof(userid));
int realPlayer = L4D_GetBotOfIdlePlayer(i);
int realPlayer = L4D_GetIdlePlayerOfBot(i);
// Incase player is idle, grab their bot instead of them
if(realPlayer > 0 && IsClientConnected(realPlayer)) {
if(IsPlayerAlive(i))

View file

@ -327,7 +327,8 @@ public Action Command_ManageWalls(int client, int args) {
if(id == -1) return Plugin_Handled;
int entity = GetWallEntity(id);
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
GetEntPropVector(entity, Prop_Send, "m_vecAngles", angles);
if(HasEntProp(entity, Prop_Send, "m_vecAngles"))
GetEntPropVector(entity, Prop_Send, "m_vecAngles", angles);
GetEntPropVector(entity, Prop_Send, "m_vecMaxs", size);
Export(client, arg2, entity, origin, angles, size);
}

View file

@ -19,17 +19,21 @@ public Action Command_HideAndSeek(int client, int args) {
} else {
ReplyToCommand(client, "Error occurred while reloading map file");
}
return Plugin_Handled;
} else if(StrEqual(subcmd, "set", false)) {
char set[16];
if(args == 1) {
ReplyToCommand(client, "Current Map Set: \"%s\" (Specify with /hs set <set>)", g_currentSet);
if(validSets.Length == 0) ReplyToCommand(client, "Available Sets: (no map config found)");
if(validSets.Length == 0) ReplyToCommand(client, "Map has no map sets or no map configuration");
else {
ReplyToCommand(client, "Available Sets: ");
ReplyToCommand(client, "Available Map Sets: ");
for(int i = 0; i < validSets.Length; i++) {
validSets.GetString(i, set, sizeof(set));
ReplyToCommand(client, "%d. %s", i + 1, set);
if(StrEqual(g_currentSet, set)) {
CReplyToCommand(client, "{olive}%d. %s (Active)", i + 1, set);
} else
ReplyToCommand(client, "%d. %s", i + 1, set);
}
CReplyToCommand(client, "Change map set with {yellow}/hs set <set name>");
}
} else {
GetCmdArg(2, g_currentSet, sizeof(g_currentSet));
@ -41,12 +45,13 @@ public Action Command_HideAndSeek(int client, int args) {
}
Cleanup();
SetupEntities(isNavBlockersEnabled, isPropsEnabled, isPortalsEnabled);
PrintToChatAll("[H&S] Map set has been changed to \"%s\"", g_currentSet);
CPrintToChatAll("[H&S] Map set changed to {olive}%s", g_currentSet);
return Plugin_Handled;
}
}
ReplyToCommand(client, "Warning: Set was not found, if this is an error use /hs r to load.");
}
return Plugin_Handled;
} else if(StrEqual(subcmd, "toggle")) {
char type[32];
GetCmdArg(2, type, sizeof(type));
@ -89,6 +94,7 @@ public Action Command_HideAndSeek(int client, int args) {
isUnknown = false;
}
if(isUnknown) ReplyToCommand(client, "Specify the type to affect: 'blockers', 'props', 'portals', or 'all'");
return Plugin_Handled;
} else if(StrEqual(subcmd, "clear", false)) {
static char arg[16];
GetCmdArg(2, arg, sizeof(arg));
@ -105,6 +111,7 @@ public Action Command_HideAndSeek(int client, int args) {
EntFire("hsportal", "kill");
ReplyToCommand(client, "Removed all custom gamemode portals");
} else ReplyToCommand(client, "Specify the type to affect: 'blockers', 'props', 'portals', or 'all'");
return Plugin_Handled;
} else if(StrEqual(subcmd, "settime")) {
int prev = GetMapTime();
static char arg[16];
@ -113,12 +120,14 @@ public Action Command_HideAndSeek(int client, int args) {
mapConfig.mapTime = time;
SetMapTime(time);
ReplyToCommand(client, "Map's time is temporarily set to %d seconds (was %d)", time, prev);
return Plugin_Handled;
} else if(StrEqual(subcmd, "settick")) {
static char arg[16];
GetCmdArg(2, arg, sizeof(arg));
int tick = -StringToInt(arg);
SetTick(tick);
ReplyToCommand(client, "Set tick time to %d", tick);
return Plugin_Handled;
} else if(StrEqual(subcmd, "map")) {
static char arg[16];
GetCmdArg(2, arg, sizeof(arg));
@ -139,7 +148,7 @@ public Action Command_HideAndSeek(int client, int args) {
foundMap = true;
}
} while(!foundMap);
PrintToChatAll("[H&S] Switching map to %s", map);
CPrintToChatAll("[H&S] Switching map to {olive}%s", map);
ChangeMap(map);
} else if(StrEqual(arg, "next", false)) {
if(args == 1) {
@ -149,7 +158,7 @@ public Action Command_HideAndSeek(int client, int args) {
GetCmdArg(3, arg2, sizeof(arg2));
if(IsMapValid(arg2)) {
strcopy(nextRoundMap, sizeof(nextRoundMap), arg2);
PrintToChatAll("[H&S] Switching map next round to %s", arg2);
CPrintToChatAll("[H&S] Switching map next round to {olive}%s", arg2);
ForceChangeLevel(arg, "SetMapSelect");
} else {
ReplyToCommand(client, "Map is not valid");
@ -162,7 +171,7 @@ public Action Command_HideAndSeek(int client, int args) {
char arg2[64];
GetCmdArg(3, arg2, sizeof(arg2));
if(IsMapValid(arg2)) {
PrintToChatAll("[H&S] Switching map to %s", arg2);
CPrintToChatAll("[H&S] Switching map to {olive}%s", arg2);
ChangeMap(arg2);
} else {
ReplyToCommand(client, "Map is not valid");
@ -178,6 +187,7 @@ public Action Command_HideAndSeek(int client, int args) {
ReplyToCommand(client, "\"origin\" \"%f %f %f\"", pos[0], pos[1], pos[2]);
GetClientEyeAngles(client, pos);
ReplyToCommand(client, "\"rotation\" \"%f %f %f\"", pos[0], pos[1], pos[2]);
return Plugin_Handled;
} else if(StrEqual(subcmd, "prop", false)) {
float pos[3];
GetAbsOrigin(client, pos);
@ -189,11 +199,14 @@ public Action Command_HideAndSeek(int client, int args) {
ReplyToCommand(client, "\t\"type\" \"prop_dynamic\"");
ReplyToCommand(client, "\t\"model\" \"props_junk/dumpster_2.mdl\"");
ReplyToCommand(client, "}");
return Plugin_Handled;
} else if(StrEqual(subcmd, "setspawn", false)) {
GetClientAbsOrigin(client, mapConfig.spawnpoint);
ReplyToCommand(client, "Set map's temporarily spawnpoint to your location.");
return Plugin_Handled;
} else if(StrEqual(subcmd, "stuck")) {
TeleportEntity(client, mapConfig.spawnpoint, NULL_VECTOR, NULL_VECTOR);
return Plugin_Handled;
} else if(StrEqual(subcmd, "bots")) {
if(args == 2) {
char arg[16];
@ -216,6 +229,7 @@ public Action Command_HideAndSeek(int client, int args) {
}
if(IsBotsEnabled()) ReplyToCommand(client, "Bots are enabled");
else ReplyToCommand(client, "Bots are disabled");
return Plugin_Handled;
} else if(StrEqual(subcmd, "peekfix")) {
if(!PeekCam.Exists()) {
PeekCam.Target = client;
@ -229,6 +243,7 @@ public Action Command_HideAndSeek(int client, int args) {
}
PeekCam.Destroy();
ReplyToCommand(client, "Killing active camera");
return Plugin_Handled;
} else if(StrEqual(subcmd, "seeker")) {
if(args == 2) {
char arg1[32];
@ -255,6 +270,7 @@ public Action Command_HideAndSeek(int client, int args) {
} else {
ReplyToCommand(client, "The current seeker is: %N", GetSlasher());
}
return Plugin_Handled;
} else if(StrEqual(subcmd, "debug")) {
ReplyToCommand(client, "- Game Info -");
int addSlasher = GetSlasher();
@ -270,7 +286,10 @@ public Action Command_HideAndSeek(int client, int args) {
ReplyToCommand(client, "Climbing: %b", mapConfig.canClimb);
ReplyToCommand(client, "Buttons Auto-press: %b", mapConfig.pressButtons);
ReplyToCommand(client, "Map Time Override: %d", mapConfig.mapTime);
ReplyToCommand(client, "Your travel distance: %f", distanceTraveled[client]);
return Plugin_Handled;
}
ReplyToCommand(client, "Unknown command");
return Plugin_Handled;
}
ReplyToCommand(client, " === [ Hide & Seek Commands ] ===");
@ -313,8 +332,6 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
public Action Command_Join(int client, int args) {
if(!isEnabled) return Plugin_Continue;
static float tpLoc[3];
GetSpawnPosition(tpLoc);
if(args == 1) {
static char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
@ -338,11 +355,7 @@ public Action Command_Join(int client, int args) {
for (int i = 0; i < target_count; i++) {
int target = target_list[i];
if(GetClientTeam(target) != 2) {
ChangeClientTeam(target, 2);
L4D_RespawnPlayer(target);
TeleportEntity(target, tpLoc, NULL_VECTOR, NULL_VECTOR);
isPendingPlay[client] = false;
CheatCommand(target, "give", "knife");
JoinGame(target);
}
}
ReplyToCommand(client, "Joined %s", target_name);
@ -351,11 +364,7 @@ public Action Command_Join(int client, int args) {
ReplyToCommand(client, "You are already in-game as a seeker.");
return Plugin_Handled;
}
isPendingPlay[client] = false;
ChangeClientTeam(client, 2);
L4D_RespawnPlayer(client);
TeleportEntity(client, tpLoc, NULL_VECTOR, NULL_VECTOR);
CheatCommand(client, "give", "knife");
JoinGame(client);
}
return Plugin_Handled;
}

View file

@ -66,7 +66,8 @@ bool LoadConfigForMap(const char[] map) {
validSets.PushString(buffer);
}
if(StrEqual(buffer, "default") || StrEqual(g_currentSet, buffer, false)) {
kv.GetSectionName(buffer, sizeof(buffer));
PrintToServer("Loaded %s", buffer);
config.entities.PushArray(entCfg);
} else {
kv.GetSectionName(buffer, sizeof(buffer));

View file

@ -160,6 +160,16 @@ bool SetState(GameState state) {
return L4D2_ExecVScriptCode(buffer);
}
void JoinGame(int target) {
float tpLoc[3];
GetSpawnPosition(tpLoc);
ChangeClientTeam(target, 2);
L4D_RespawnPlayer(target);
TeleportEntity(target, tpLoc, NULL_VECTOR, NULL_VECTOR);
isPendingPlay[target] = false;
}
bool IsGameSoloOrPlayersLoading() {
int connecting, ingame;
for(int i = 1; i <= MaxClients; i++) {
@ -231,3 +241,8 @@ stock void GetViewVector(float fVecAngle[3], float fOutPut[3])
fOutPut[1] = Sine(fVecAngle[1] / (180 / FLOAT_PI));
fOutPut[2] = -Sine(fVecAngle[0] / (180 / FLOAT_PI));
}
stock float Get2DVectorDistance(const float a[3], const float b[3]) {
// sqrt((x-y)^2)
return SquareRoot(Pow(a[0] - b[0], 2.0) + Pow(a[1] - b[1], 2.0));
}

View file

@ -933,4 +933,4 @@ stock void CalculateWorldPosition(int entity, float pos[3]) {
pos[0] = pos[0] + (mins[0] + maxs[0]) * 0.5;
pos[1] = pos[1] + (mins[1] + maxs[1]) * 0.5;
pos[2] = pos[2] + (mins[2] + maxs[2]) * 0.5;
}
}

View file

@ -371,6 +371,7 @@ public void OnClientPutInServer(int client) {
}
public void OnClientDisconnect(int client) {
if(!IsFakeClient(client) && IsClientInGame(client))
SaveInventory(client);
}

View file

@ -161,17 +161,6 @@ Action Timer_PlaceHat(Handle h, int userid) {
}
return Plugin_Handled;
}
void GlowPoint(const float pos[3], float lifetime = 5.0) {
#if defined DEBUG_GLOW
PrecacheModel("models/props_fortifications/orange_cone001_reference.mdl");
int entity = CreateEntityByName("prop_dynamic");
DispatchKeyValue(entity, "disableshadows", "1");
DispatchKeyValue(entity, "model", "models/props_fortifications/orange_cone001_reference.mdl");
TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(entity);
CreateTimer(lifetime, Timer_Kill, entity);
#endif
}
Action Timer_Kill(Handle h, int entity) {
if(IsValidEntity(entity))

View file

@ -75,6 +75,8 @@ int g_BeamSprite;
int g_HaloSprite;
bool hasBeenSeeker[MAXPLAYERS+1];
float lastPos[MAXPLAYERS+1][3];
float distanceTraveled[MAXPLAYERS+1];
bool ignoreSeekerBalance;
ConVar cvar_peekCam;
@ -148,8 +150,10 @@ public Action Timer_KeepWaiting(Handle h) {
}
public void OnClientDisconnect(int client) {
if(!IsFakeClient(client))
if(!IsFakeClient(client)) {
distanceTraveled[client] = 0.0;
currentPlayers--;
}
}
public void OnMapStart() {
@ -285,9 +289,7 @@ public void Event_GamemodeChange(ConVar cvar, const char[] oldValue, const char[
const float DEATH_CAM_MIN_DIST = 150.0;
public Action Timer_StopPeekCam(Handle h) {
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i)) {
PeekCam.Disable(i);
}
PeekCam.Disable(i);
}
PeekCam.Disable();
RequestFrame(Frame_StopPeekCam);
@ -337,7 +339,7 @@ public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast
}
}
PrintToConsoleAll("attacker: %N | victim: %N | alive: %d", client, attacker, alive);
if(client == currentSeeker && alive == 1) {
// If seeker died
CPrintToChatAll("{green}Hiders win!");
@ -401,7 +403,7 @@ public void Event_ItemPickup(Event event, const char[] name, bool dontBroadcast)
PrintToServer("[H&S] ERROR: GetSlasher() returned invalid seeker");
currentSeeker = client;
} else if(currentSeeker != client) {
PrintToChatAll("[H&S] Seeker does not equal axe-receiver. Possible seeker: %N", client);
PrintToConsoleAll("[H&S] Seeker does not equal axe-receiver. Possible seeker: %N", client);
}
PeekCam.Target = currentSeeker;
if(!ignoreSeekerBalance && cvar_seekerBalance.BoolValue) {
@ -453,9 +455,7 @@ public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i)) {
if(isPendingPlay[i]) {
L4D_RespawnPlayer(i);
isPendingPlay[i] = false;
ChangeClientTeam(i, 2);
JoinGame(i);
}
if(mapConfig.hasSpawnpoint)
TeleportEntity(i, mapConfig.spawnpoint, NULL_VECTOR, NULL_VECTOR);
@ -482,30 +482,33 @@ public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) {
for(int i = 1; i <= MaxClients; i++) {
isNearbyPlaying[i] = false;
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 1) {
distanceTraveled[i] = 0.0;
PeekCam.Disable(i);
if(isPendingPlay[i]) {
ChangeClientTeam(i, 2);
L4D_RespawnPlayer(i);
if(mapConfig.hasSpawnpoint) {
TeleportEntity(i, mapConfig.spawnpoint, NULL_VECTOR, NULL_VECTOR);
}
isPendingPlay[i] = false;
JoinGame(i);
}
}
}
PeekCam.Destroy();
}
public Action Timer_CheckPlayers(Handle h) {
for(int i = 1; i <= MaxClients; i++) {
if(!IsClientConnected(i) || !IsClientInGame(i)) continue;
if(GetClientTeam(i) == 2 && IsPlayerAlive(i) && i != currentSeeker)
QueryClientConVar(i, "cam_collision", QueryClientConVarCallback);
SetEntProp(i, Prop_Send, "m_audio.soundscapeIndex", -1);
if(GetClientTeam(i) == 2 && IsPlayerAlive(i) && i != currentSeeker) {
float pos[3];
GetClientAbsOrigin(i, pos);
distanceTraveled[i] = FloatAbs(Get2DVectorDistance(pos, lastPos[i]));
lastPos[i] = pos;
QueryClientConVar(i, "cam_collision", QueryClientConVarCallback);
}
SetEntProp(i, Prop_Send, "m_audio.soundscapeIndex", -1);
}
ServerCommand("soundscape_flush");
// Rare Crashes:
// ServerCommand("soundscape_flush");
return Plugin_Continue;
}