mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-08 08:56:34 -08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db63fdc00c | ||
|
|
57747f2e1c |
@@ -113,6 +113,13 @@
|
||||
"linux": "\\x48\\x85\\xFF\\x74\\x4B\\x55\\x48\\x89\\xE5\\x41\\x56"
|
||||
}
|
||||
},
|
||||
"CEntityInstance_AcceptInput": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x48\\x89\\x74\\x24\\x18\\x57\\x48\\x83\\xEC\\x40\\x49\\x8B\\xF0",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xFF\\x41\\x56\\x48\\x8D\\x7D\\xC0"
|
||||
}
|
||||
},
|
||||
"LegacyGameEventListener": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
|
||||
@@ -58,6 +58,24 @@ public partial class CEntityInstance : IEquatable<CEntityInstance>
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls a named input method on an entity.
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// entity.AcceptInput("Break");
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// </summary>
|
||||
/// <param name="inputName">Input action name</param>
|
||||
/// <param name="activator">Entity which initiated the action, <see langword="null"/> for no entity</param>
|
||||
/// <param name="caller">Entity that is sending the event, <see langword="null"/> for no entity</param>
|
||||
/// <param name="value">String variant value to send with the event</param>
|
||||
/// <param name="outputId">Unknown, defaults to 0</param>
|
||||
public void AcceptInput(string inputName, CEntityInstance? activator = null, CEntityInstance? caller = null, string value = "", int outputId = 0)
|
||||
{
|
||||
VirtualFunctions.AcceptInput(Handle, inputName, activator?.Handle ?? IntPtr.Zero, caller?.Handle ?? IntPtr.Zero, value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class CEntityIdentity
|
||||
|
||||
@@ -80,4 +80,7 @@ public static class VirtualFunctions
|
||||
public static MemoryFunctionVoid<IntPtr, IntPtr> RemovePlayerItemFunc =
|
||||
new(GameData.GetSignature("CBasePlayerPawn_RemovePlayerItem"));
|
||||
public static Action<IntPtr, IntPtr> RemovePlayerItemVirtual = RemovePlayerItemFunc.Invoke;
|
||||
|
||||
public static MemoryFunctionVoid<IntPtr, string, IntPtr, IntPtr, string, int> AcceptInputFunc = new(GameData.GetSignature("CEntityInstance_AcceptInput"));
|
||||
public static Action<IntPtr, string, IntPtr, IntPtr, string, int> AcceptInput = AcceptInputFunc.Invoke;
|
||||
}
|
||||
@@ -136,9 +136,9 @@ namespace CounterStrikeSharp.API
|
||||
{
|
||||
List<CCSPlayerController> players = new();
|
||||
|
||||
for (int i = 1; i <= Server.MaxPlayers; i++)
|
||||
for (int i = 0; i <= Server.MaxPlayers; i++)
|
||||
{
|
||||
var controller = GetPlayerFromIndex(i);
|
||||
var controller = GetPlayerFromSlot(i);
|
||||
|
||||
if (!controller.IsValid || controller.UserId == -1)
|
||||
continue;
|
||||
|
||||
@@ -501,6 +501,17 @@ namespace TestPlugin
|
||||
player.Respawn();
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_break", "Breaks the breakable entities")]
|
||||
public void OnBreakCommand(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
var entities = Utilities.FindAllEntitiesByDesignerName<CBreakable>("prop_dynamic")
|
||||
.Concat(Utilities.FindAllEntitiesByDesignerName<CBreakable>("func_breakable"));
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
entity.AcceptInput("Break");
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("cssharp_attribute", "This is a custom attribute event")]
|
||||
public void OnCommand(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user