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

@ -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;
}
}