Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/managed/API/Scripting/Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static Player[] FindPlayersByTarget(string target, bool matchbots)
Player? player = GetPlayer(i);
if (player == null) continue;

if (player.IsFakeClient() && !matchbots) continue;
if (!matchbots && player.IsFakeClient()) continue;

if(target == "@all")
{
Expand Down Expand Up @@ -273,7 +273,7 @@ public static Player[] FindPlayersByTarget(string target, bool matchbots)
}
public static Player? GetPlayer(int playerid)
{
return Internal_API.Invoker.CallNative<Player?>("_G", "GetPlayer", Internal_API.CallKind.Function, playerid);
return Internal_API.Invoker.CallNative<Player>("_G", "GetPlayer", Internal_API.CallKind.Function, playerid);
}
public static ulong GetTime()
{
Expand Down
12 changes: 11 additions & 1 deletion src/managed/Internal_API/CallContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,17 @@ internal unsafe object GetArgument(Type type, int index)
{
fixed (CallData* data = &m_cdata)
{
if (data->has_return == 0) return Activator.CreateInstance(type);
if (data->has_return == 0)
{
if (type == typeof(ClassData) || typeof(ClassData).IsAssignableFrom(type))
{
return null;
}
else
{
return Activator.CreateInstance(type);
}
}
byte* p = data->return_value;
return ReadValue(ref type, ref p);
}
Expand Down
Loading