Skip to content

Commit

Permalink
Added drawing of Network Owner to developer tools
Browse files Browse the repository at this point in the history
Added "Show Network Owners" to Developer Tools submenu. Draws server ID and player name of network owner on  closest entities like handles and models.
  • Loading branch information
Explooosion-code committed Aug 30, 2020
1 parent 400ebc6 commit af3048f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
41 changes: 41 additions & 0 deletions vMenu/FunctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,19 @@ private async Task ModelDrawDimensions()
DrawTextOnScreen($"Hash {hashes}", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
}
if (MainMenu.MiscSettingsMenu.ShowEntityNetOwners && v.IsOnScreen)
{
int netOwnerLocalId = NetworkGetEntityOwner(v.Handle);

if (netOwnerLocalId != 0)
{
int playerServerId = GetPlayerServerId(netOwnerLocalId);
string playerName = GetPlayerName(netOwnerLocalId);
SetDrawOrigin(v.Position.X, v.Position.Y, v.Position.Z + 0.3f, 0);
DrawTextOnScreen($"Owner ID {playerServerId} ({playerName})", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
}
}
}
}

Expand Down Expand Up @@ -2711,6 +2724,20 @@ private async Task ModelDrawDimensions()
DrawTextOnScreen($"Hash {hashes}", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
}

if (MainMenu.MiscSettingsMenu.ShowEntityNetOwners && p.IsOnScreen)
{
int netOwnerLocalId = NetworkGetEntityOwner(p.Handle);

if (netOwnerLocalId != 0)
{
int playerServerId = GetPlayerServerId(netOwnerLocalId);
string playerName = GetPlayerName(netOwnerLocalId);
SetDrawOrigin(p.Position.X, p.Position.Y, p.Position.Z + 0.3f, 0);
DrawTextOnScreen($"Owner ID {playerServerId} ({playerName})", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
}
}
}
}

Expand Down Expand Up @@ -2743,6 +2770,20 @@ private async Task ModelDrawDimensions()
DrawTextOnScreen($"Hash {hashes}", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
}

if (MainMenu.MiscSettingsMenu.ShowEntityNetOwners && p.IsOnScreen)
{
int netOwnerLocalId = NetworkGetEntityOwner(p.Handle);

if (netOwnerLocalId != 0)
{
int playerServerId = GetPlayerServerId(netOwnerLocalId);
string playerName = GetPlayerName(netOwnerLocalId);
SetDrawOrigin(p.Position.X, p.Position.Y, p.Position.Z + 0.3f, 0);
DrawTextOnScreen($"Owner ID {playerServerId} ({playerName})", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
}
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions vMenu/menus/MiscSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class MiscSettings
public bool ShowPropModelDimensions { get; private set; } = false;
public bool ShowEntityHandles { get; private set; } = false;
public bool ShowEntityModels { get; private set; } = false;
public bool ShowEntityNetOwners { get; private set; } = false;
public bool MiscRespawnDefaultCharacter { get; private set; } = UserDefaults.MiscRespawnDefaultCharacter;
public bool RestorePlayerAppearance { get; private set; } = UserDefaults.MiscRestorePlayerAppearance;
public bool RestorePlayerWeapons { get; private set; } = UserDefaults.MiscRestorePlayerWeapons;
Expand Down Expand Up @@ -126,6 +127,7 @@ private void CreateMenu()
MenuCheckboxItem pedModelDimensions = new MenuCheckboxItem("Show Ped Dimensions", "Draws the model outlines for every ped that's currently close to you.", ShowPedModelDimensions);
MenuCheckboxItem showEntityHandles = new MenuCheckboxItem("Show Entity Handles", "Draws the the entity handles for all close entities (you must enable the outline functions above for this to work).", ShowEntityHandles);
MenuCheckboxItem showEntityModels = new MenuCheckboxItem("Show Entity Models", "Draws the the entity models for all close entities (you must enable the outline functions above for this to work).", ShowEntityModels);
MenuCheckboxItem showEntityNetOwners = new MenuCheckboxItem("Show Network Owners", "Draws the the entity net owner for all close entities (you must enable the outline functions above for this to work).", ShowEntityNetOwners);
MenuSliderItem dimensionsDistanceSlider = new MenuSliderItem("Show Dimensions Radius", "Show entity model/handle/dimension draw range.", 0, 20, 20, false);

MenuItem clearArea = new MenuItem("Clear Area", "Clears the area around your player (100 meters). Damage, dirt, peds, props, vehicles, etc. Everything gets cleaned up, fixed and reset to the default world state.");
Expand Down Expand Up @@ -403,6 +405,7 @@ private void CreateMenu()
developerToolsMenu.AddMenuItem(pedModelDimensions);
developerToolsMenu.AddMenuItem(showEntityHandles);
developerToolsMenu.AddMenuItem(showEntityModels);
developerToolsMenu.AddMenuItem(showEntityNetOwners);
developerToolsMenu.AddMenuItem(dimensionsDistanceSlider);
}

Expand Down Expand Up @@ -479,6 +482,10 @@ private void CreateMenu()
{
ShowEntityModels = _checked;
}
else if (item == showEntityNetOwners)
{
ShowEntityNetOwners = _checked;
}
else if (item == enableTimeCycle)
{
TimecycleEnabled = _checked;
Expand Down

0 comments on commit af3048f

Please sign in to comment.