Skip to content

Commit

Permalink
Merge pull request #108 from TomGrobbe/development
Browse files Browse the repository at this point in the history
## Client side updates
#### UC:
- Add version to server convar

#### Documentation & config:
- Some changes and improvements in the README.md and other .md files
- Improve default permissions.cfg file, group inheritance is now fixed in recent server builds, so the default permissions.cfg file has implemented the group inheritance again. I suggest you rewrite your permissions file (use the new default one as a template) if you want to keep it clean and use proper group inheritance.

#### PO:
- Add unlimited stamina permission (`vMenu.PlayerOptions.UnlimitedStamina`)

#### FC:
- Nerf player stats, they used to be way too OP (mainly weapon/shooting stats were insane)
- Fix #95 and slight performance improvements.
- (WIP: location and player blips, not yet fully implemented so will not work but preparation work has been done so it can be implemented soon)

#### UD:
- Refactor some default settings for new players. (won't affect your current saved settings)

#### MS:
- [along with FC] (WIP: location and player blips, not yet fully implemented so will not work but preparation work has been done so it can be implemented soon)

#### project files:
- Changed debugging to embedded for better stack traces.

#### CF:
- Merge pull request #103 (fix tyre smoke color bug)

#### VW:
- refactor all weapons & their names + components (& component names)
- add missing weapon components


## Server changes:
- Added unban command that can only be executed by the server console to unban a player.

To unban a player using the server console, type `vmenuserver unban "<playername>"` (replacing `<playername>` with the real player's name, NOT case sensitive, allows spaces in player names as long as you surround the name with `""`.
  • Loading branch information
TomGrobbe authored Jul 20, 2018
2 parents c83ef60 + 6897a94 commit fa41d84
Show file tree
Hide file tree
Showing 12 changed files with 1,211 additions and 642 deletions.
2 changes: 1 addition & 1 deletion vMenu/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ public async void SpawnVehicle(uint vehicleHash, bool spawnInside, bool replaceP
SetVehicleMod(vehicle.Handle, 24, 0, vehicleInfo.customWheels);
}
ToggleVehicleMod(vehicle.Handle, 18, vehicleInfo.turbo);
SetVehicleTyreSmokeColor(vehicle.Handle, vehicleInfo.colors["tyresmokeR"], vehicleInfo.colors["tyresmokeB"], vehicleInfo.colors["tyresmokeG"]);
SetVehicleTyreSmokeColor(vehicle.Handle, vehicleInfo.colors["tyresmokeR"], vehicleInfo.colors["tyresmokeG"], vehicleInfo.colors["tyresmokeB"]);
ToggleVehicleMod(vehicle.Handle, 20, vehicleInfo.tyreSmoke);
ToggleVehicleMod(vehicle.Handle, 22, vehicleInfo.xenonHeadlights);
SetVehicleLivery(vehicle.Handle, vehicleInfo.livery);
Expand Down
147 changes: 130 additions & 17 deletions vMenu/FunctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class FunctionsController : BaseScript
private uint crossing = 1;
private string crossingName = "";
private string suffix = "";
private bool wasMenuJustOpen = false;
private PlayerList blipsPlayerList = new PlayerList();

/// <summary>
/// Constructor.
Expand All @@ -62,6 +64,7 @@ public FunctionsController()
Tick += JoinQuitNotifications;
Tick += UpdateLocation;
Tick += ManageCamera;
//Tick += PlayerBlipsControl;
}

/// Task related
Expand All @@ -76,23 +79,27 @@ private async Task GeneralTasks()
if (cf != null)
{
// Check if the player has switched to a new vehicle.
var tmpVehicle = cf.GetVehicle();
if (DoesEntityExist(tmpVehicle) && tmpVehicle != LastVehicle)
if (IsPedInAnyVehicle(PlayerPedId(), true)) // added this for improved performance.
{
// Set the last vehicle to the new vehicle entity.
LastVehicle = tmpVehicle;
SwitchedVehicle = true;
var tmpVehicle = cf.GetVehicle();
if (DoesEntityExist(tmpVehicle) && tmpVehicle != LastVehicle)
{
// Set the last vehicle to the new vehicle entity.
LastVehicle = tmpVehicle;
SwitchedVehicle = true;
}
}

if (!MainMenu.DontOpenMenus && MainMenu.Mp.IsAnyMenuOpen())
{
lastOpenMenu = cf.GetOpenMenu();
}
// If any on-screen keyboard is visible, close any open menus and disable any menu from opening.
if (UpdateOnscreenKeyboard() == 0) // still editing aka the input box is visible.
if (UpdateOnscreenKeyboard() == 0 && (MainMenu.Mp.IsAnyMenuOpen() || wasMenuJustOpen)) // still editing aka the input box is visible.
{
MainMenu.DontOpenMenus = true;
MainMenu.DisableControls = true;
wasMenuJustOpen = true; // added for extra check to make sure only vMenu gets re-opened if vMenu was already open.
}
// Otherwise, check if the "DontOpenMenus" option is (still) true.
else
Expand All @@ -103,17 +110,20 @@ private async Task GeneralTasks()
MainMenu.DontOpenMenus = false;

// Check if the previous menu isn't null.
if (lastOpenMenu != null)
if (lastOpenMenu != null && wasMenuJustOpen)
{
// Re-open the last menu.
lastOpenMenu.Visible = true;
// Set the last menu to null.
lastOpenMenu = null;
wasMenuJustOpen = false; // reset the justOpen state.
}

// Wait 5 ticks before allowing the menu to be controlled, to prevent accidental interactions when the menu JUST re-appeared.
await Delay(5);
MainMenu.DisableControls = false;


}
}
}
Expand Down Expand Up @@ -141,9 +151,8 @@ private async Task PlayerOptions()
(!cf.IsAllowed(Permission.POInvisible)), false);

// Manage Stamina
if (MainMenu.PlayerOptionsMenu.PlayerStamina)
if (MainMenu.PlayerOptionsMenu.PlayerStamina && cf.IsAllowed(Permission.POUnlimitedStamina))
{
//ResetPlayerStamina(PlayerId());
StatSetInt((uint)GetHashKey("MP0_STAMINA"), 100, true);
}
else
Expand All @@ -152,10 +161,10 @@ private async Task PlayerOptions()
}
// Manage other stats.
StatSetInt((uint)GetHashKey("MP0_STRENGTH"), 100, true);
StatSetInt((uint)GetHashKey("MP0_LUNG_CAPACITY"), 100, true);
StatSetInt((uint)GetHashKey("MP0_LUNG_CAPACITY"), 80, true); // reduced because it was over powered
StatSetInt((uint)GetHashKey("MP0_WHEELIE_ABILITY"), 100, true);
StatSetInt((uint)GetHashKey("MP0_FLYING_ABILITY"), 100, true);
StatSetInt((uint)GetHashKey("MP0_SHOOTING_ABILITY"), 100, true);
StatSetInt((uint)GetHashKey("MP0_SHOOTING_ABILITY"), 50, true); // reduced because it was over powered
StatSetInt((uint)GetHashKey("MP0_STEALTH_ABILITY"), 100, true);

// Manage Super jump.
Expand Down Expand Up @@ -449,11 +458,6 @@ private async Task MiscSettings()
}
#endregion

#region Nightvision & Thermal vision
//SetNightvision(MainMenu.MiscSettingsMenu.NightVision);
//SetSeethrough(MainMenu.MiscSettingsMenu.ThermalVision);
#endregion

#region camera angle locking
if (MainMenu.MiscSettingsMenu.LockCameraY)
{
Expand Down Expand Up @@ -801,7 +805,7 @@ private async Task WeaponOptions()
Game.PlayerPed.Weapons.Current.InfiniteAmmo = MainMenu.WeaponOptionsMenu.UnlimitedAmmo && cf.IsAllowed(Permission.WPUnlimitedAmmo);
}


/// THIS SOLUTION IS BUGGED AND CAUSES CRASHES
//// workaround for mk2 weapons (the infinite ammo doesn't seem to work all the time for mk2 weapons)
//if (MainMenu.WeaponOptionsMenu.UnlimitedAmmo && cf.IsAllowed(Permission.WPUnlimitedAmmo) && Game.PlayerPed.Weapons.Current.IsMk2 &&
Expand Down Expand Up @@ -912,7 +916,116 @@ private async Task ManageCamera()
}
}
#endregion
/*
private async Task PlayerBlipsControl()
{
if (MainMenu.MiscSettingsMenu != null)
{
bool enabled = MainMenu.MiscSettingsMenu.ShowPlayerBlips && cf.IsAllowed(Permission.MSPlayerBlips);
blipsPlayerList = new PlayerList();
foreach (Player p in blipsPlayerList)
{
if (enabled)
{
if (p.Character.AttachedBlip == null || !p.Character.AttachedBlip.Exists())
{
Debug.WriteLine("New blip added.");
p.Character.AttachBlip();
}
p.Character.AttachedBlip.Color = BlipColor.White;
//Debug.Write(p.Character.AttachedBlip.Sprite.ToString());
ShowHeadingIndicatorOnBlip(p.Character.AttachedBlip.Handle, true);
p.Character.AttachedBlip.IsShortRange = true;
p.Character.AttachedBlip.Name = p.Name;
if (IsPedInAnyVehicle(p.Character.Handle, false))
{
Vehicle veh = new Vehicle(cf.GetVehicle(p.Handle, false));
if (veh.Model.IsBoat)
{
p.Character.AttachedBlip.Sprite = BlipSprite.Speedboat; // 427 = speed boat
}
else if (veh.Model.IsBicycle)
{
p.Character.AttachedBlip.Sprite = BlipSprite
}
else if (veh.Model.IsBike)
{
p.Character.AttachedBlip.Sprite = BlipSprite
}
else if (veh.Model.IsCar)
{
switch ((VehicleHash)veh.Model.Hash)
{
case VehicleHash.Apc:
break;
default:
break;
}
//if (veh.Model.Hash == VehicleHash.Apc)
//p.Character.AttachedBlip.Sprite = BlipSprite
}
else if (veh.Model.IsHelicopter)
{
p.Character.AttachedBlip.Sprite = BlipSprite.HelicopterAnimated;
}
else if (veh.Model.IsPlane)
{
p.Character.AttachedBlip.Sprite = BlipSprite
}
else if (veh.Model.IsQuadbike)
{
p.Character.AttachedBlip.Sprite = BlipSprite.
}
else
{
p.Character.AttachedBlip.Sprite = BlipSprite.Standard;
}
//if (p.Character.IsInBoat)
//{
// p.Character.AttachedBlip.Sprite = BlipSprite.Speedboat; // 427 = Speedboat
//}
//else if (p.Character.IsInPlane)
//{
//}
//else if (p.Character.IsInHeli)
//{
//}
//else if (p.Character.IsOnBike)
//{
//}
veh = null;
}
else
{
p.Character.AttachedBlip.Sprite = BlipSprite.Standard;
}
}
else
{
if (!(p.Character.AttachedBlip == null || !p.Character.AttachedBlip.Exists()))
{
p.Character.AttachedBlip.Delete();
}
}
await Delay(60); // wait 60 ticks before doing the next player.
}
await Delay(1000); // wait 1000 ticks before doing the next loop.
}
else
{
await Delay(1000);
}
}
*/

/// Not task related
#region Private ShowSpeed Functions
Expand Down
4 changes: 3 additions & 1 deletion vMenu/Permission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public enum Permission
POFunctions,
POFreeze,
POScenarios,
POUnlimitedStamina,

// Vehicle Options
VOMenu,
Expand Down Expand Up @@ -233,13 +234,14 @@ public enum Permission
MSDeathNotifs,
MSNightVision,
MSThermalVision,
MSLocationBlips,
MSPlayerBlips,

// Voice Chat
VCMenu,
VCAll,
VCEnable,
VCShowSpeaker,
VCStaffChannel,

};
}
Loading

0 comments on commit fa41d84

Please sign in to comment.