Add sm_gotocouch & effect intensity

This commit is contained in:
2026-09-29 02:41:20 +01:00
parent 867b3bfbba
commit 598dc20ae3
3 changed files with 133 additions and 2 deletions
+32 -1
View File
@@ -23,6 +23,7 @@ public void OnPluginStart()
RegAdminCmd("sm_couch", Command_Couch, ADMFLAG_CHANGEMAP, "Opens the couch menu");
RegAdminCmd("sm_spawncouch", Command_SpawnCouch, ADMFLAG_CHANGEMAP, "Spawns the couch where you are aiming");
RegAdminCmd("sm_bringcouch", Command_BringCouch, ADMFLAG_CHANGEMAP, "Brings the couch to where you are aiming");
RegAdminCmd("sm_gotocouch", Command_GotoCouch, ADMFLAG_CHANGEMAP, "Teleports you to the couch");
RegAdminCmd("sm_removecouch", Command_RemoveCouch, ADMFLAG_CHANGEMAP, "Removes the couch");
RegAdminCmd("sm_couchpistolonly", Command_PistolOnly, ADMFLAG_CHANGEMAP, "sm_couchpistolonly [0|1] - only pistols and knives move the couch; no argument toggles");
}
@@ -75,6 +76,15 @@ public Action Command_BringCouch(int client, int args)
return Plugin_Handled;
}
public Action Command_GotoCouch(int client, int args)
{
if (!RequireInGame(client) || !RequireCore(client))
return Plugin_Handled;
DoGoto(client);
return Plugin_Handled;
}
// Needs no position, so it also works from the server console.
public Action Command_RemoveCouch(int client, int args)
{
@@ -128,7 +138,7 @@ void DoSpawn(int client)
return;
}
ShowActivity2(client, PREFIX, "\x01Spawned the \x04couch\x01.");
ShowActivity2(client, PREFIX, "\x01Spawned the \x04couch\x01, it will respawn here each round until removed.");
LogAction(client, -1, "\"%L\" spawned the couch.", client);
}
@@ -144,6 +154,24 @@ void DoBring(int client)
LogAction(client, -1, "\"%L\" brought the couch.", client);
}
void DoGoto(int client)
{
if (!IsPlayerAlive(client))
{
ReplyToCommand(client, "[SM] You must be alive to go to the couch.");
return;
}
if (!Couch_Goto(client))
{
ReplyToCommand(client, "[SM] There is no couch to go to. Use sm_spawncouch first.");
return;
}
ShowActivity2(client, PREFIX, "\x01Teleported to the \x04couch\x01.");
LogAction(client, -1, "\"%L\" teleported to the couch.", client);
}
void DoRemove(int client)
{
if (!Couch_Remove())
@@ -190,6 +218,7 @@ void ShowCouchMenu(int client)
// With a couch out, bring is the way to move it; without one there is nothing to bring.
menu.AddItem("spawn", "Spawn couch at crosshair", bHasCouch ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT);
menu.AddItem("bring", "Bring couch to crosshair", bHasCouch ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
menu.AddItem("goto", "Teleport to couch", bHasCouch ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
if (bHasCouch)
menu.AddItem("remove", "Remove couch");
@@ -230,6 +259,8 @@ public int MenuHandler_Couch(Menu menu, MenuAction action, int param1, int param
DoSpawn(client);
else if (StrEqual(sInfo, "bring"))
DoBring(client);
else if (StrEqual(sInfo, "goto"))
DoGoto(client);
else if (StrEqual(sInfo, "remove"))
DoRemove(client);
else if (StrEqual(sInfo, "effect"))