Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing of NetOwners to developer menu #231

Merged
merged 1 commit into from
Oct 25, 2020
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
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