Skip to content

Commit

Permalink
Merge pull request #13 from Mathu-lmn/master
Browse files Browse the repository at this point in the history
QoL fixes
  • Loading branch information
alberttheprince authored Jul 23, 2024
2 parents 51e1a59 + 8c21a92 commit 9d040ea
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 50 deletions.
12 changes: 0 additions & 12 deletions NativeUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1856,10 +1856,6 @@ end
Panels
--]]

UIMenuGridPanel = setmetatable({}, UIMenuGridPanel)
UIMenuGridPanel.__index = UIMenuGridPanel
UIMenuGridPanel.__call = function() return "UIMenuPanel", "UIMenuGridPanel" end

function UIMenuGridPanel.New(TopText, LeftText, RightText, BottomText)
_UIMenuGridPanel = {
Data = {
Expand Down Expand Up @@ -2006,10 +2002,6 @@ end
Panels
--]]

UIMenuColourPanel = setmetatable({}, UIMenuColourPanel)
UIMenuColourPanel.__index = UIMenuColourPanel
UIMenuColourPanel.__call = function() return "UIMenuPanel", "UIMenuColourPanel" end

function UIMenuColourPanel.New(Title, Colours)
_UIMenuColourPanel = {
Data = {
Expand Down Expand Up @@ -2240,10 +2232,6 @@ end
Panels
--]]

UIMenuPercentagePanel = setmetatable({}, UIMenuPercentagePanel)
UIMenuPercentagePanel.__index = UIMenuPercentagePanel
UIMenuPercentagePanel.__call = function() return "UIMenuPanel", "UIMenuPercentagePanel" end

function UIMenuPercentagePanel.New(MinText, MaxText)
_UIMenuPercentagePanel = {
Data = {
Expand Down
4 changes: 1 addition & 3 deletions client/AnimationListCustom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- Don't change 'CustomDP' it is local to this file!

-- Remove the } from the = {} then enter your own animation code ---
-- Don't forget to close the tables. See https://docs.rpemotes.com/for-developers/important-note/custom-emotes-and-props
-- Don't forget to close the tables.

local CustomDP = {}

Expand All @@ -27,8 +27,6 @@ function LoadAddonEmotes()
RP[arrayName][emoteName] = emoteData
end
end
-- Free memory
CustomDP[arrayName] = nil
end
-- Free memory
CustomDP = nil
Expand Down
2 changes: 1 addition & 1 deletion client/Binoculars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if Config.BinocularsEnabled then

TaskPlayAnim(PlayerPedId(), "amb@world_human_binoculars@male@idle_a", "idle_c", 5.0, 5.0, -1, 51, 0, 0, 0, 0)
PlayAmbientSpeech1(PlayerPedId(), "GENERIC_CURSE_MED", "SPEECH_PARAMS_FORCE")
SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey("WEAPON_UNARMED"), true)
SetCurrentPedWeapon(PlayerPedId(), GetHashKey("WEAPON_UNARMED"), true)

RemoveAnimDict("amb@world_human_binoculars@male@idle_a")
SetModelAsNoLongerNeeded("prop_binoc_01")
Expand Down
4 changes: 2 additions & 2 deletions client/Emote.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ local disableHandsupControls = {
[342] = true, -- INPUT_VEH_HYDRAULICS_CONTROL_UD
[343] = true, -- INPUT_VEH_HYDRAULICS_CONTROL_LR
[351] = true, -- INPUT_VEH_ROCKET_BOOST
[351] = true, -- INPUT_VEH_ROCKET_BOOST
[354] = true, -- INPUT_VEH_BIKE_WINGS
[357] = true, -- INPUT_VEH_TRANSFORM

Expand Down Expand Up @@ -515,7 +514,7 @@ AddStateBagChangeHandler('ptfx', nil, function(bagName, key, value, _unused, rep
end
end
PtfxThis(asset)
PlayerParticles[plyId] = StartNetworkedParticleFxLoopedOnEntityBone(name, entityTarget, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, boneIndex, scale + 0.0, 0, 0, 0, 1065353216, 1065353216, 1065353216, 0)
PlayerParticles[plyId] = StartNetworkedParticleFxLoopedOnEntityBone(name, entityTarget, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, boneIndex, scale + 0.0, 0, 0, 0)
if color then
if color[1] and type(color[1]) == 'table' then
local randomIndex = math.random(1, #color)
Expand Down Expand Up @@ -690,6 +689,7 @@ function CheckAnimalAndOnEmotePlay(EmoteName, name)
end
end

---@param ped_preview boolean | nil
function DestroyAllProps(ped_preview)
if ped_preview then
for _, v in pairs(PreviewPedProps) do
Expand Down
32 changes: 14 additions & 18 deletions client/EmoteMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,25 @@ end
lang = Config.MenuLanguage

function AddEmoteMenu(menu)
local submenu = _menuPool:AddSubMenu(menu, Translate('emotes'), "", "", Menuthing, Menuthing)
local submenu = _menuPool:AddSubMenu(menu, Translate('emotes'), "", true, true)
if Config.Search then
submenu:AddItem(NativeUI.CreateItem(Translate('searchemotes'), ""))
table.insert(EmoteTable, Translate('searchemotes'))
end
local dancemenu = _menuPool:AddSubMenu(submenu, Translate('danceemotes'), "", "", Menuthing, Menuthing)
local dancemenu = _menuPool:AddSubMenu(submenu, Translate('danceemotes'), "", true, true)
local animalmenu
if Config.AnimalEmotesEnabled then
animalmenu = _menuPool:AddSubMenu(submenu, Translate('animalemotes'), "", "", Menuthing, Menuthing)
animalmenu = _menuPool:AddSubMenu(submenu, Translate('animalemotes'), "", true, true)
table.insert(EmoteTable, Translate('animalemotes'))
end
local propmenu = _menuPool:AddSubMenu(submenu, Translate('propemotes'), "", "", Menuthing, Menuthing)
local propmenu = _menuPool:AddSubMenu(submenu, Translate('propemotes'), "", true, true)
table.insert(EmoteTable, Translate('danceemotes'))
table.insert(EmoteTable, Translate('danceemotes'))

if Config.SharedEmotesEnabled then
sharemenu = _menuPool:AddSubMenu(submenu, Translate('shareemotes'),
Translate('shareemotesinfo'), "", Menuthing, Menuthing)
shareddancemenu = _menuPool:AddSubMenu(sharemenu, Translate('sharedanceemotes'), "", "", Menuthing,
Menuthing)
Translate('shareemotesinfo'), true, true)
shareddancemenu = _menuPool:AddSubMenu(sharemenu, Translate('sharedanceemotes'), "", true, true)
table.insert(ShareTable, 'none')
table.insert(EmoteTable, Translate('shareemotes'))
end
Expand All @@ -95,7 +94,7 @@ function AddEmoteMenu(menu)
unbind2item = NativeUI.CreateItem(Translate('rfavorite'), Translate('rfavorite'))
unbinditem = NativeUI.CreateItem(Translate('prop2info'), "")
favmenu = _menuPool:AddSubMenu(submenu, Translate('favoriteemotes'),
Translate('favoriteinfo'), "", Menuthing, Menuthing)
Translate('favoriteinfo'), true, true)
favmenu:AddItem(unbinditem)
favmenu:AddItem(unbind2item)
-- Add two elements as offset
Expand Down Expand Up @@ -317,15 +316,15 @@ if Config.Search then
if #results > 0 then
InSearch = true

local searchMenu = _menuPool:AddSubMenu(lastMenu, string.format('%s'..Translate('searchmenudesc')..' ~r~%s~w~', #results, input), "", true, Menuthing, Menuthing)
local searchMenu = _menuPool:AddSubMenu(lastMenu, string.format('%s'..Translate('searchmenudesc')..' ~r~%s~w~', #results, input), "", true, true)
local sharedDanceMenu
if favEnabled then
local rFavorite = NativeUI.CreateItem(Translate('rfavorite'), Translate('rfavorite'))
searchMenu:AddItem(rFavorite)
end

if Config.SharedEmotesEnabled then
sharedDanceMenu = _menuPool:AddSubMenu(searchMenu, Translate('sharedanceemotes'), "", true, Menuthing, Menuthing)
sharedDanceMenu = _menuPool:AddSubMenu(searchMenu, Translate('sharedanceemotes'), "", true, true)
end

table.sort(results, function(a, b) return a.name < b.name end)
Expand Down Expand Up @@ -479,7 +478,7 @@ ShowPedPreview = function(menu)
end

function AddWalkMenu(menu)
local submenu = _menuPool:AddSubMenu(menu, Translate('walkingstyles'), "", "", Menuthing, Menuthing)
local submenu = _menuPool:AddSubMenu(menu, Translate('walkingstyles'), "", true, true)

walkreset = NativeUI.CreateItem(Translate('normalreset'), Translate('resetdef'))
submenu:AddItem(walkreset)
Expand Down Expand Up @@ -508,7 +507,7 @@ function AddWalkMenu(menu)
end

function AddFaceMenu(menu)
local submenu = _menuPool:AddSubMenu(menu, Translate('moods'), "", "", Menuthing, Menuthing)
local submenu = _menuPool:AddSubMenu(menu, Translate('moods'), "", true, true)

local facereset = NativeUI.CreateItem(Translate('normalreset'), Translate('resetdef'))
submenu:AddItem(facereset)
Expand Down Expand Up @@ -539,8 +538,7 @@ function AddFaceMenu(menu)
end

function AddInfoMenu(menu)
infomenu = _menuPool:AddSubMenu(menu, Translate('infoupdate'), "~h~~y~The RPEmotes Team & Collaborators~h~~y~", "",
Menuthing, Menuthing)
infomenu = _menuPool:AddSubMenu(menu, Translate('infoupdate'), "~h~~y~The RPEmotes Team & Collaborators~h~~y~", true, true)

for _,v in ipairs(Config.Credits) do
local item = NativeUI.CreateItem(v.title,v.subtitle or "")
Expand Down Expand Up @@ -602,15 +600,13 @@ function ProcessMenu()
isMenuProcessing = false
end

RegisterNetEvent("rp:Update")
AddEventHandler("rp:Update", function(state)
RegisterNetEvent("rp:Update", function(state)
UpdateAvailable = state
AddInfoMenu(mainMenu)
_menuPool:RefreshIndex()
end)

RegisterNetEvent("rp:RecieveMenu") -- For opening the emote menu from another resource.
AddEventHandler("rp:RecieveMenu", function()
RegisterNetEvent("rp:RecieveMenu", function()
OpenEmoteMenu()
end)

Expand Down
2 changes: 1 addition & 1 deletion client/NewsCam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if Config.NewscamEnabled then

TaskPlayAnim(PlayerPedId(), "missfinale_c2mcs_1", "fin_c2_mcs_1_camman", 5.0, 5.0, -1, 51, 0, 0, 0, 0)
PlayAmbientSpeech1(PlayerPedId(), "GENERIC_CURSE_MED", "SPEECH_PARAMS_FORCE")
SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey("WEAPON_UNARMED"), true)
SetCurrentPedWeapon(PlayerPedId(), GetHashKey("WEAPON_UNARMED"), true)

RemoveAnimDict("missfinale_c2mcs_1")
SetModelAsNoLongerNeeded("prop_v_cam_01")
Expand Down
14 changes: 5 additions & 9 deletions client/Syncing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ if Config.SharedEmotesEnabled then
end, false)
end

RegisterNetEvent("SyncPlayEmote")
AddEventHandler("SyncPlayEmote", function(emote, player)
RegisterNetEvent("SyncPlayEmote", function(emote, player)
EmoteCancel()
Wait(300)
targetPlayerId = player
Expand Down Expand Up @@ -78,8 +77,7 @@ AddEventHandler("SyncPlayEmote", function(emote, player)
end
end)

RegisterNetEvent("SyncPlayEmoteSource")
AddEventHandler("SyncPlayEmoteSource", function(emote, player)
RegisterNetEvent("SyncPlayEmoteSource", function(emote, player)
-- Thx to Poggu for this part!
local ply = PlayerPedId()
local plyServerId = GetPlayerFromServerId(player)
Expand Down Expand Up @@ -138,8 +136,7 @@ AddEventHandler("SyncPlayEmoteSource", function(emote, player)
end
end)

RegisterNetEvent("SyncCancelEmote")
AddEventHandler("SyncCancelEmote", function(player)
RegisterNetEvent("SyncCancelEmote", function(player)
if targetPlayerId and targetPlayerId == player then
targetPlayerId = nil
EmoteCancel()
Expand All @@ -153,8 +150,7 @@ function CancelSharedEmote(ply)
end
end

RegisterNetEvent("ClientEmoteRequestReceive")
AddEventHandler("ClientEmoteRequestReceive", function(emotename, etype, target)
RegisterNetEvent("ClientEmoteRequestReceive", function(emotename, etype, target)
isRequestAnim = true
requestedemote = emotename

Expand All @@ -171,7 +167,7 @@ AddEventHandler("ClientEmoteRequestReceive", function(emotename, etype, target)
while isRequestAnim do
Wait(5)
timer = timer - 5
if timer == 0 then
if timer <= 0 then
isRequestAnim = false
SimpleNotify(Translate('refuseemote'))
end
Expand Down
4 changes: 2 additions & 2 deletions client/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ function SimpleNotify(message)
end
end

function DebugPrint(args)
function DebugPrint(...)
if Config.DebugDisplay then
print(args)
print(...)
end
end

Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fx_version 'cerulean'
game 'gta5'
description 'rpemotes-reborn'
version '1.5.5'
version '1.5.6'

lua54 'yes'
use_experimental_fxv2_oal 'yes'
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.5
1.5.6

0 comments on commit 9d040ea

Please sign in to comment.