Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Commit

Permalink
ui improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ghermans committed Jan 1, 2019
1 parent b7a40dd commit 337b0f6
Show file tree
Hide file tree
Showing 17 changed files with 191 additions and 296 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.4.5
* Improved the menu theme.
* Resolved a issue where cop skins would not be displayed inside **the police locker room menu** when whitelisting is disabled.

## 1.4.4.4
* Removed support for `mysql-async` and replaced it with `ghmattimysql` for better performance.
* Removed support for additional resources (Vdk_inventory, JobSystem, es_weashop, garages, emergency).
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Cops_FiveM is a resource mainly for RP servers. It gives servers a cops system w
You can find a complete overview with all the features [here](docs/features.md).

## Changelog
You can find the changelog [here](CHANGELOG.md).
You can find the latest changes [here](CHANGELOG.md).

## Community Support
A Discord server is available: [![](https://discordapp.com/api/guilds/361144123681538060/widget.png)](https://discord.gg/qnAqCEd)
Expand Down Expand Up @@ -51,6 +51,3 @@ To see how to use them, just type the command you want without any parameter.
## Contribute
If you are a developer and would like to contribute any help is welcome!.
The contribution guide can be found [here](https://github.com/Kyominii/Cops_FiveM/blob/master/CONTRIBUTING.md).

## Supported Scripts
you can find some supported scripts [here](docs/scripts.md).
4 changes: 2 additions & 2 deletions police/__resource.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'
resource_version '1.4.4.4'
resource_versionNum '1444'
resource_version '1.4.5'
resource_versionNum '145'
resource_Isdev 'no'

dependency 'ghmattimysql'
Expand Down
22 changes: 15 additions & 7 deletions police/client/armory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ function load_armory()
end

buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("armory_basic_kit"), func = "giveBasicKit", params = ""}
buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("armory_add_bulletproof_vest_title"), func = "addBulletproofVest", params = ""}
buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("armory_remove_bulletproof_vest_title"), func = "removeBulletproofVest", params = ""}
if config.enableOutfits then
buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("armory_add_bulletproof_vest_title"), func = "addBulletproofVest", params = ""}
buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("armory_remove_bulletproof_vest_title"), func = "removeBulletproofVest", params = ""}
end
buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("armory_weapons_list"), func = "openWeaponListMenu", params = ""}

buttonsCategories[#buttonsCategories+1] = {name = "Close", func = "CloseArmory", params = ""}

for k,v in pairs(weapons) do
Expand All @@ -50,7 +53,7 @@ function createArmoryPed()

local armoryPed = CreatePed(26, model, 454.165, -979.999, 30.690, 92.298, false, false)
SetEntityInvincible(armoryPed, true)
TaskTurnPedToFaceEntity(armoryPed, PlayerId(), -1)
TaskTurnPedToFaceEntity(armoryPed, PlayerId(), -1)

return armoryPed
end
Expand Down Expand Up @@ -101,15 +104,18 @@ function GiveCustomWeapon(weaponData)
end

function CloseArmory()
CloseMenu()
if not IsAnySpeechPlaying(armoryPed) then
PlayAmbientSpeechWithVoice(armoryPed, "WEPSEXPERT_BYESHOPGEN", "WEPSEXP", "SPEECH_PARAMS_FORCE", 0)
end

Wait(850)
CloseMenu()
RenderScriptCams(false, 1, 1000, 1, 0, 0)
SetCamActive(ArmoryRoomCam, false)
DestroyCam(ArmoryRoomCam, true)

Citizen.Wait(500)
DoScreenFadeOut(500)
Citizen.Wait(600)
Wait(600)

if DoesEntityExist(armoryPed) then
DeleteEntity(armoryPed)
Expand All @@ -126,7 +132,8 @@ end
function openWeaponListMenu()
CloseMenu()
SendNUIMessage({
title = i18n.translate("armory_weapons_list"),
title = i18n.translate("armory_global_title"),
subtitle = i18n.translate("armory_weapons_list"),
buttons = buttonWeaponList,
action = "setAndOpen"
})
Expand All @@ -139,6 +146,7 @@ function OpenArmory()
if((anyMenuOpen.menuName ~= "armory" and anyMenuOpen.menuName ~= "armory-weapon_list") and not anyMenuOpen.isActive) then
SendNUIMessage({
title = i18n.translate("armory_global_title"),
subtitle = GetLabelText("PM_WEAPONS"),
buttons = buttonsCategories,
action = "setAndOpen"
})
Expand Down
102 changes: 56 additions & 46 deletions police/client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ AddEventHandler('police:receiveIsCop', function(svrank,svdept)
isCop = true
rank = 0
dept = 0
load_cloackroom()

load_armory()
load_garage()
load_menu()
end
else
isCop = true
Expand All @@ -76,10 +75,8 @@ AddEventHandler('police:receiveIsCop', function(svrank,svdept)
end
end

load_cloackroom()
load_armory()
load_garage()
load_menu()
end
end)

Expand Down Expand Up @@ -377,7 +374,9 @@ function isNearTakeService()
CloseMenu()
end
if(distance < 30) then
DrawMarker(1, pos.x, pos.y, pos.z-1, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 0, 155, 255, 200, 0, 0, 2, 0, 0, 0, 0)
if anyMenuOpen.menuName ~= "cloackroom" and not anyMenuOpen.isActive then
DrawMarker(1, pos.x, pos.y, pos.z-1, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 0, 155, 255, 200, 0, 0, 2, 0, 0, 0, 0)
end
end
if(distance < 2) then
return true
Expand All @@ -399,14 +398,17 @@ function isNearStationGarage()
if anyMenuOpen.menuName == "garage" and anyMenuOpen.isActive and distance > 5 then
CloseMenu()
end

if(distance < 30) then
DrawMarker(1, pos.x, pos.y, pos.z-1, 0, 0, 0, 0, 0, 0, 2.0, 2.0, 1.0, 0, 155, 255, 200, 0, 0, 2, 0, 0, 0, 0)
if anyMenuOpen.menuName ~= "garage" and not anyMenuOpen.isActive then
DrawMarker(1, pos.x, pos.y, pos.z-1, 0, 0, 0, 0, 0, 0, 2.0, 2.0, 1.0, 0, 155, 255, 200, 0, 0, 2, 0, 0, 0, 0)
end
end

if(distance < 2) then
return true
end
end

function isNearHelicopterStation()
local distance = 10000
local pos = {}
Expand Down Expand Up @@ -497,11 +499,29 @@ local alreadyDead = false
local playerStillDragged = false

Citizen.CreateThread(function()
DoScreenFadeIn(100)
local gxt = "fmmc"
local CurrentSlot = 0

while HasAdditionalTextLoaded(CurrentSlot) and not HasThisAdditionalTextLoaded(gxt, CurrentSlot) do
Wait(1)
CurrentSlot = CurrentSlot + 1
end

if not HasThisAdditionalTextLoaded(gxt, CurrentSlot) then
ClearAdditionalText(CurrentSlot, true)
RequestAdditionalText(gxt, CurrentSlot)
while not HasThisAdditionalTextLoaded(gxt, CurrentSlot) do
Wait(0)
end
end

TriggerServerEvent("police:checkIsCop")
--Embedded NeverWanted script // Non loop part
if(config.enableNeverWanted == true) then
SetPoliceIgnorePlayer(PlayerId(), true)
SetDispatchCopsForPlayer(PlayerId(), false)

Citizen.InvokeNative(0xDC0F817884CDD856, 1, false)
Citizen.InvokeNative(0xDC0F817884CDD856, 2, false)
Citizen.InvokeNative(0xDC0F817884CDD856, 3, false)
Expand All @@ -517,24 +537,18 @@ Citizen.CreateThread(function()
item.blip = AddBlipForCoord(item.x, item.y, item.z)
SetBlipSprite(item.blip, 60)
SetBlipAsShortRange(item.blip, true)

BeginTextCommandSetBlipName("STRING")
AddTextComponentString(i18n.translate("police_station"))
EndTextCommandSetBlipName(item.blip)
end
end

while true do
Citizen.Wait(5)

Citizen.Wait(5)
DisablePlayerVehicleRewards(PlayerId())

if(config.enableNeverWanted == true) then
SetPlayerWantedLevel(PlayerId(), 0, false)
SetPlayerWantedLevelNow(PlayerId(), false)
HideHudComponentThisFrame(1)

ClearAreaOfCops()
end
end

if(anyMenuOpen.isActive) then
DisableControlAction(1, 21)
Expand All @@ -560,6 +574,7 @@ Citizen.CreateThread(function()
action = "keyenter"
})

PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", true)
Citizen.Wait(500)
CloseMenu()
end
Expand Down Expand Up @@ -631,24 +646,19 @@ Citizen.CreateThread(function()
playerStillDragged = false
end
end

if (anyMenuOpen.menuName == "armory-weapon_list") then
HideHudAndRadarThisFrame()
end


if(isCop) then
if(isNearTakeService()) then
if not (anyMenuOpen.isActive) then
DisplayHelpText(i18n.translate("help_text_open_cloackroom"),0,1,0.5,0.8,0.6,255,255,255,255)
DisplayHelpText(i18n.translate("help_text_open_cloackroom") .. GetLabelText("collision_8vlv02g"),0,1,0.5,0.8,0.6,255,255,255,255)
if IsControlJustPressed(1,config.bindings.interact_position) then
load_cloackroom()
OpenCloackroom()
end
end
end

if(isInService) then

--Open Garage menu
if(isInService) then
if(isNearStationGarage()) then
if(policevehicle ~= nil) then
if not (anyMenuOpen.isActive) then
Expand All @@ -660,7 +670,6 @@ Citizen.CreateThread(function()

if IsControlJustPressed(1,config.bindings.interact_position) then
if(policevehicle ~= nil) then
--Destroy police vehicle
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(policevehicle))
policevehicle = nil
else
Expand All @@ -681,43 +690,44 @@ Citizen.CreateThread(function()

SetEntityCoords(PlayerPedId(), 452.119966796875, -980.061966796875, 30.690966796875)
armoryPed = createArmoryPed()

if DoesEntityExist(armoryPed) then
TaskTurnPedToFaceEntity(PlayerPedId(), armoryPed, -1)
end

Wait(900)
DoScreenFadeIn(500)
Wait(500)

if not DoesCamExist(ArmoryRoomCam) then
ArmoryRoomCam = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true)
AttachCamToEntity(ArmoryRoomCam, PlayerPedId(), 0.0, 0.0, 1.0, true)
PointCamAtEntity(ArmoryRoomCam, armoryPed, 0.0, -30.0, 1.0, true)

SetCamRot(ArmoryRoomCam, 0.0,0.0, GetEntityHeading(PlayerPedId()))
SetCamFov(ArmoryRoomCam, 70.0)
end

Wait(100)
DoScreenFadeIn(500)
Wait(300)
OpenArmory()
if not IsAmbientSpeechPlaying(armoryPed) then
PlayAmbientSpeechWithVoice(armoryPed, "WEPSEXPERT_GREETSHOPGEN", "WEPSEXP", "SPEECH_PARAMS_FORCE", 0)
end
end
end
end

-- Setup the Armory Room
if (anyMenuOpen.menuName == "armory") then
TaskTurnPedToFaceEntity(PlayerPedId(), armoryPed, -1)
if not DoesCamExist(ArmoryRoomCam) then
ArmoryRoomCam = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true)
else
DoesCamExist(ArmoryRoomCam)
HideHudAndRadarThisFrame()

AttachCamToEntity(ArmoryRoomCam, PlayerPedId(), 0.0, 0.0, 1.0, true)
PointCamAtEntity(ArmoryRoomCam, armoryPed, 0.0, -30.0, 1.0, true)

SetCamRot(ArmoryRoomCam, 0.0,0.0, GetEntityHeading(PlayerPedId()))
SetCamFov(ArmoryRoomCam, 70.0)
if (anyMenuOpen.menuName == "armory") then
if DoesCamExist(ArmoryRoomCam) then
RenderScriptCams(true, 1, 1800, 1, 0)
end
end
end


--Open/Close Menu police
if (IsControlJustPressed(1,config.bindings.use_police_menu)) then
load_menu()
TogglePoliceMenu()
end

--Control helicopter spawning
if isNearHelicopterStation() then
if(policeHeli ~= nil) then
DisplayHelpText(i18n.translate("help_text_put_heli_into_garage"),0,1,0.5,0.8,0.6,255,255,255,255)
Expand Down
17 changes: 12 additions & 5 deletions police/client/cloackroom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ function load_cloackroom()
end

for k, data in pairs(skins) do
if dept == k then
if config.useCopWhitelist then
if dept == k then
for k, v in pairs(data) do
buttons[#buttons+1] = {name = tostring(v.name), func = "clockIn", params = tostring(v.model)}
end
end
else
for k, v in pairs(data) do
buttons[#buttons+1] = {name = tostring(v.name), func = "clockIn", params = tostring(v.model)}
end
end
end
end

buttons[#buttons+1] = {name = i18n.translate("cloackroom_break_service_title"), func = "clockOut", params = ""}

if(config.enableOutfits == true) then
if(rank <= 0) then
buttons[#buttons+1] = {name = i18n.translate("cloackroom_add_yellow_vest_title"), func = "cloackroom_add_yellow_vest", params = ""}
Expand All @@ -52,7 +59,6 @@ function clockIn(model)
end
end


function clockOut()
ServiceOff()
removeUniforme()
Expand Down Expand Up @@ -143,9 +149,10 @@ function removeUniforme()
end

function OpenCloackroom()
if(anyMenuOpen.menuName ~= "cloackroom" and not anyMenuOpen.isActive) then
if anyMenuOpen.menuName ~= "cloackroom" and not anyMenuOpen.isActive then
SendNUIMessage({
title = i18n.translate("cloackroom_global_title"),
title = GetLabelText("collision_8vlv02g"),
subtitle = GetLabelText("INPUT_CHARACTER_WHEEL"),
buttons = buttons,
action = "setAndOpen"
})
Expand Down
10 changes: 8 additions & 2 deletions police/client/garage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ function load_garage()
for k in ipairs (buttons) do
buttons [k] = nil
end

for k, data in pairs(vehicles) do
if dept == k then
if config.useCopWhitelist then
if dept == k then
for k, v in pairs(data) do
buttons[#buttons+1] = {name = tostring(v.name), func = "SpawnerVeh", params = tostring(v.model)}
end
end
else
for k, v in pairs(data) do
buttons[#buttons+1] = {name = tostring(v.name), func = "SpawnerVeh", params = tostring(v.model)}
end
Expand Down Expand Up @@ -70,6 +75,7 @@ function OpenGarage()
CloseMenu()
SendNUIMessage({
title = i18n.translate("garage_global_title"),
subtitle = GetLabelText("VEX_NMB"),
buttons = buttons,
action = "setAndOpen"
})
Expand Down
Binary file removed police/client/html/BebasNeue.otf
Binary file not shown.
Loading

0 comments on commit 337b0f6

Please sign in to comment.