diff --git a/data/hideandseek.cfg b/data/hideandseek.cfg index ab06360..698862d 100644 --- a/data/hideandseek.cfg +++ b/data/hideandseek.cfg @@ -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" diff --git a/plugins/activitymonitor.smx b/plugins/activitymonitor.smx index 33dbb8f..3a7cb1b 100644 Binary files a/plugins/activitymonitor.smx and b/plugins/activitymonitor.smx differ diff --git a/plugins/adminpanel.smx b/plugins/adminpanel.smx index c37b2f9..0b6386d 100644 Binary files a/plugins/adminpanel.smx and b/plugins/adminpanel.smx differ diff --git a/plugins/l4d2_extraplayeritems.smx b/plugins/l4d2_extraplayeritems.smx index e80259b..91d5fa6 100644 Binary files a/plugins/l4d2_extraplayeritems.smx and b/plugins/l4d2_extraplayeritems.smx differ diff --git a/plugins/l4d2_feedthetrolls.smx b/plugins/l4d2_feedthetrolls.smx index 9a9ee8e..097eee0 100644 Binary files a/plugins/l4d2_feedthetrolls.smx and b/plugins/l4d2_feedthetrolls.smx differ diff --git a/plugins/l4d2_hats.smx b/plugins/l4d2_hats.smx index 560707a..9283fd2 100644 Binary files a/plugins/l4d2_hats.smx and b/plugins/l4d2_hats.smx differ diff --git a/scripting/include/feedthetrolls/events.inc b/scripting/include/feedthetrolls/events.inc index 469a090..64911b6 100644 --- a/scripting/include/feedthetrolls/events.inc +++ b/scripting/include/feedthetrolls/events.inc @@ -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? diff --git a/scripting/include/feedthetrolls/menus.inc b/scripting/include/feedthetrolls/menus.inc index 8044b49..5a34c4d 100644 --- a/scripting/include/feedthetrolls/menus.inc +++ b/scripting/include/feedthetrolls/menus.inc @@ -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)) diff --git a/scripting/include/hats/walls.sp b/scripting/include/hats/walls.sp index dde0956..d6523f3 100644 --- a/scripting/include/hats/walls.sp +++ b/scripting/include/hats/walls.sp @@ -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); } diff --git a/scripting/include/hideandseek/hscmds.inc b/scripting/include/hideandseek/hscmds.inc index 1153bc5..4906c45 100644 --- a/scripting/include/hideandseek/hscmds.inc +++ b/scripting/include/hideandseek/hscmds.inc @@ -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 )", 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 "); } } 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; } diff --git a/scripting/include/hideandseek/hscore.inc b/scripting/include/hideandseek/hscore.inc index 4045d48..c4f903a 100644 --- a/scripting/include/hideandseek/hscore.inc +++ b/scripting/include/hideandseek/hscore.inc @@ -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)); diff --git a/scripting/include/hideandseek/hsgame.inc b/scripting/include/hideandseek/hsgame.inc index d909987..e1553dc 100644 --- a/scripting/include/hideandseek/hsgame.inc +++ b/scripting/include/hideandseek/hsgame.inc @@ -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)); +} \ No newline at end of file diff --git a/scripting/include/jutils.inc b/scripting/include/jutils.inc index fe3d5f2..2946869 100644 --- a/scripting/include/jutils.inc +++ b/scripting/include/jutils.inc @@ -934,4 +934,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; -} +} \ No newline at end of file diff --git a/scripting/l4d2_extraplayeritems.sp b/scripting/l4d2_extraplayeritems.sp index 42bb26a..f07be44 100644 --- a/scripting/l4d2_extraplayeritems.sp +++ b/scripting/l4d2_extraplayeritems.sp @@ -371,6 +371,7 @@ public void OnClientPutInServer(int client) { } public void OnClientDisconnect(int client) { + if(!IsFakeClient(client) && IsClientInGame(client)) SaveInventory(client); } diff --git a/scripting/l4d2_hats.sp b/scripting/l4d2_hats.sp index a21ca5e..acabe67 100644 --- a/scripting/l4d2_hats.sp +++ b/scripting/l4d2_hats.sp @@ -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)) diff --git a/scripting/l4d2_hideandseek.sp b/scripting/l4d2_hideandseek.sp index f26395b..12ae527 100644 --- a/scripting/l4d2_hideandseek.sp +++ b/scripting/l4d2_hideandseek.sp @@ -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; }