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

New changes #80

Merged
merged 14 commits into from
Apr 22, 2018
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ before_deploy:
- cp /home/travis/build/TomGrobbe/vMenu/README.md /home/travis/build/TomGrobbe/release/vMenu/builds/
- cp /home/travis/build/TomGrobbe/vMenu/LICENSE /home/travis/build/TomGrobbe/release/vMenu/builds/
- version=`curl -s https://vespura.com/vmenu/__resource.lua | grep "version " | tail -n 1 | cut -d ' ' -f 2 | cut -c 2- | rev | cut -c 3- | rev`
- cd /home/travis/build/TomGrobbe/release/vMenu/builds && wget https://vespura.com/vmenu/__resource.lua && zip -r vMenu-$version.zip *
- cd /home/travis/build/TomGrobbe/release/vMenu/builds && wget https://vespura.com/vmenu/__resource.lua && zip -r vMenu-$version.zip * -x src/\*
- cd /home/travis/build/TomGrobbe/vMenu/ && git config --local user.name "TomGrobbe"
- cd /home/travis/build/TomGrobbe/vMenu/ && git config --local user.email "31419184+TomGrobbe@users.noreply.github.com"
- cd /home/travis/build/TomGrobbe/vMenu/ && git tag $version
Expand Down
665 changes: 7 additions & 658 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion PERMISSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
|`vMenu.OnlinePlayers.Summon`|Allows you to summon/teleport another player to you. (Default: moderators only)|Denied|
|`vMenu.OnlinePlayers.Kill`|Allows you to kill another player by pressing a button. Dam, you're very cruel. (Default: moderators only)|Denied|
|`vMenu.OnlinePlayers.Kick`|Allows you to kick another player from the server. (Default: moderators only)|Denied|
|`vMenu.OnlinePlayers.TempBan`|Allows you to ban the player from the server for a custom amount of time, max 1 month. (Default: moderators only)|Denied\*|
|`vMenu.OnlinePlayers.TempBan`|Allows you to ban the player from the server for a custom amount of time, max temp-ban duration: 30 days. (Default: admins only)|Denied\*|
|`vMenu.OnlinePlayers.PermBan`|Allows you to ban the player from the server forever. (Default: admin only)|Denied\*\*\*\*|
|`vMenu.OnlinePlayers.Unban`|Allows you to access the "Banned Players" menu to view and unban banned players. (The menu is not actually located in the "Online Players menu", it's in the main menu instead. It is still part of "user management" and thus the permission node is related to "Online Players"). (Allowed by default for admins)|Denied|

## Player Options

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ This menu is created using [a modified version of NativeUI](https://github.com/T
Tom Grobbe - https://www.vespura.com/
Copyright © 2017-2018

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PROPER CREDIT IS **ALWAYS** REQUIRED WHEN RELEASING MODIFIED VERSIONS OF MY WORK.
THIS PROJECT USES A CUSTOM LICENSE. MAKE SURE TO READ IT BEFORE THINKING ABOUT DOING ANYTHING WITH VMENU.

YOU ARE ALLOWED TO USE VMENU ON AS MANY SERVERS AS YOU WANT.
_YOU ARE ALSO ALLOWED TO EDIT THIS RESOURCE TO ADD/CHANGE/REMOVE WHATEVER YOU WANT._
**YOU ARE HOWEVER _NOT_ ALLOWED TO RE-RELEASE (EDITED OR NON-EDITED) VERSIONS OF THIS RESOURCE WITHOUT WRITTEN PERMISSIONS BY MYSELF (TOM GROBBE / VESPURA). FOR ADDED FEATURES/CHANGES, FEEL FREE TO CREATE A FORK & CREATE A PULL REQUEST.**

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
83 changes: 83 additions & 0 deletions vMenu/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1981,5 +1981,88 @@ public async void SpawnCustomWeapon()
}
}
#endregion

#region Set Player Walking Style
public async void SetWalkingStyle(string walkingStyle)
{
if (IsPedModel(PlayerPedId(), (uint)GetHashKey("mp_f_freemode_01")) || IsPedModel(PlayerPedId(), (uint)GetHashKey("mp_m_freemode_01")))
{
bool isPedMale = IsPedModel(PlayerPedId(), (uint)GetHashKey("mp_m_freemode_01"));
ClearPedAlternateMovementAnim(PlayerPedId(), 0, 1f);
ClearPedAlternateMovementAnim(PlayerPedId(), 1, 1f);
ClearPedAlternateMovementAnim(PlayerPedId(), 2, 1f);
ClearPedAlternateWalkAnim(PlayerPedId(), 1f);
string animDict = null;
if (walkingStyle == "Injured")
{
animDict = isPedMale ? "move_m@injured" : "move_f@injured";
}
else if (walkingStyle == "Tough Guy")
{
animDict = isPedMale ? "move_m@tough_guy@" : "move_f@tough_guy@";
}
else if (walkingStyle == "Femme")
{
animDict = isPedMale ? "move_m@femme@" : "move_f@femme@";
}
else if (walkingStyle == "Gangster")
{
animDict = isPedMale ? "move_m@gangster@a" : "move_f@gangster@ng";
}
else if (walkingStyle == "Posh")
{
animDict = isPedMale ? "move_m@posh@" : "move_f@posh@";
}
else if (walkingStyle == "Sexy")
{
animDict = isPedMale ? null : "move_f@sexy@a";
}
else if (walkingStyle == "Business")
{
animDict = isPedMale ? null : "move_f@business@a";
}
else if (walkingStyle == "Drunk")
{
animDict = isPedMale ? "move_m@drunk@a" : "move_f@drunk@a";
}
else if (walkingStyle == "Hipster")
{
animDict = isPedMale ? "move_m@hipster@a" : null;
}
if (animDict != null)
{
if (!HasAnimDictLoaded(animDict))
{
RequestAnimDict(animDict);
while (!HasAnimDictLoaded(animDict))
{
await Delay(0);
}
}
SetPedAlternateMovementAnim(PlayerPedId(), 0, animDict, "idle", 1f, true);
SetPedAlternateMovementAnim(PlayerPedId(), 1, animDict, "walk", 1f, true);
SetPedAlternateMovementAnim(PlayerPedId(), 2, animDict, "run", 1f, true);
}
else if (walkingStyle != "Normal")
{
if (isPedMale)
{
Notify.Error(CommonErrors.WalkingStyleNotForMale);
}
else
{
Notify.Error(CommonErrors.WalkingStyleNotForFemale);
}
}
}
else
{
Notify.Error("This feature only supports the multiplayer freemode male/female ped models.");
}


}
#endregion

}
}
11 changes: 11 additions & 0 deletions vMenu/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,22 @@ public EventManager()
EventHandlers.Add("vMenu:SetupAddonCars", new Action<string, dynamic>(SetAddonModels));
EventHandlers.Add("vMenu:SetupAddonWeapons", new Action<string, dynamic>(SetAddonModels));
EventHandlers.Add("vMenu:GoodBye", new Action(GoodBye));
EventHandlers.Add("vMenu:SetBanList", new Action<string>(UpdateBanList));

Tick += WeatherSync;
Tick += TimeSync;
}

/// <summary>
/// Update ban list.
/// </summary>
/// <param name="list"></param>
private void UpdateBanList(string list)
{
if (MainMenu.BannedPlayersMenu != null)
MainMenu.BannedPlayersMenu.UpdateBanList(list);
}

/// <summary>
/// Used for cheating idiots.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions vMenu/FunctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public FunctionsController()
Tick += MiscSettings;
Tick += VoiceChat;
Tick += TimeOptions;
Tick += _WeatherOptions;
Tick += WeaponOptions;
}

Expand Down Expand Up @@ -343,6 +344,21 @@ private async Task VehicleOptions()
}
}
#endregion
#region Weather Options
private async Task _WeatherOptions()
{
await Delay(1000);
if (MainMenu.WeatherOptionsMenu != null && cf.IsAllowed(Permission.WOMenu))
{
if (MainMenu.WeatherOptionsMenu.GetMenu().Visible)
{
MainMenu.WeatherOptionsMenu.GetMenu().MenuItems.ForEach(mi => { mi.SetRightBadge(UIMenuItem.BadgeStyle.None); });
var item = WeatherOptions.weatherHashMenuIndex[GetNextWeatherTypeHashName().ToString()];
item.SetRightBadge(UIMenuItem.BadgeStyle.Tick);
}
}
}
#endregion
#region Misc Settings Menu Tasks
/// <summary>
/// Run all tasks that need to be handeled for the Misc Settings Menu.
Expand Down
25 changes: 24 additions & 1 deletion vMenu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class MainMenu : BaseScript

public static PlayerOptions PlayerOptionsMenu { get; private set; }
public static OnlinePlayers OnlinePlayersMenu { get; private set; }
public static BannedPlayers BannedPlayersMenu { get; private set; }
public static SavedVehicles SavedVehiclesMenu { get; private set; }
public static VehicleOptions VehicleOptionsMenu { get; private set; }
public static VehicleSpawner VehicleSpawnerMenu { get; private set; }
Expand Down Expand Up @@ -145,7 +146,10 @@ private async Task ProcessMainButtons()
// Select / Enter
if (Game.IsDisabledControlJustReleased(0, Control.FrontendAccept) || Game.IsControlJustReleased(0, Control.FrontendAccept))
{
currentMenu.SelectItem();
if (currentMenu.MenuItems.Count() > 0)
{
currentMenu.SelectItem();
}
}
// Cancel / Go Back
else if (Game.IsDisabledControlJustReleased(0, Control.PhoneCancel))
Expand Down Expand Up @@ -320,6 +324,7 @@ private async Task OnTick()

// Request the permissions data from the server.
TriggerServerEvent("vMenu:RequestPermissions", PlayerId());
TriggerServerEvent("vMenu:RequestBanList", PlayerId());

// Wait until the data is received and the player's name is loaded correctly.
while (!permissionsSetupDone || !optionsSetupDone
Expand Down Expand Up @@ -545,6 +550,24 @@ private void CreateSubmenus()
}
};
}
if (Cf.IsAllowed(Permission.OPUnban))
{
TriggerServerEvent("vMenu:RequestBanList", PlayerId());
BannedPlayersMenu = new BannedPlayers();
UIMenu menu = BannedPlayersMenu.GetMenu();
UIMenuItem button = new UIMenuItem("Banned Players", "View and manage all banned players in this menu.");
button.SetRightLabel("→→→");
AddMenu(menu, button);
Menu.OnItemSelect += (sender, item, index) =>
{
if (item == button)
{
TriggerServerEvent("vMenu:RequestBanList", PlayerId());
menu.RefreshIndex();
menu.UpdateScaleform();
}
};
}

// Add the player options menu.
if (Cf.IsAllowed(Permission.POMenu))
Expand Down
9 changes: 9 additions & 0 deletions vMenu/Notification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public enum CommonErrors
CouldNotLoad,
PlayerNotFound,
PedNotFound,
WalkingStyleNotForMale,
WalkingStyleNotForFemale,
};

/// <summary>
Expand Down Expand Up @@ -78,6 +80,13 @@ public static string Get(CommonErrors errorType, string placeholderValue = null)
case CommonErrors.PlayerNotFound:
outputMessage = $"The specified player could not be found.{placeholder}";
break;
case CommonErrors.WalkingStyleNotForMale:
outputMessage = $"This walking style is not available for male peds.{placeholder}";
break;
case CommonErrors.WalkingStyleNotForFemale:
outputMessage = $"This walking style is not available for female peds.{placeholder}";
break;

case CommonErrors.UnknownError:
default:
outputMessage = $"An unknown error occurred, sorry!{placeholder}";
Expand Down
1 change: 1 addition & 0 deletions vMenu/PermissionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public enum Permission
OPKick,
OPPermBan,
OPTempBan,
OPUnban,

// Player Options
POMenu,
Expand Down
2 changes: 1 addition & 1 deletion vMenu/UserDefaults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static bool VehicleNoSiren
public static bool VehicleNoBikeHelmet
{
get { return GetSettingsBool("vehicleNoBikeHelmet"); }
set { SetSavedSettingsBool("vehicleNoBikeHelemet", value); }
set { SetSavedSettingsBool("vehicleNoBikeHelmet", value); }
}
#endregion

Expand Down
Loading