From 4a776071507eddb33d89f0ceccabf72877b4673e Mon Sep 17 00:00:00 2001 From: ghermans Date: Mon, 18 Mar 2019 23:12:39 +0100 Subject: [PATCH] 1.4.6 --- CHANGELOG.md | 6 ++ README.md | 14 +++- police/__resource.lua | 9 +-- police/client/armory.lua | 10 ++- police/client/client.lua | 128 ++++++++++++++++++++++--------- police/client/cloackroom.lua | 17 +++- police/client/garage.lua | 13 +++- police/client/html/css/style.css | 2 +- police/client/html/js/script.js | 6 +- police/client/menu.lua | 58 +++++++++----- police/config/config.lua | 27 ++++--- police/config/objects.lua | 10 ++- police/server/server.lua | 47 ++++++++---- 13 files changed, 237 insertions(+), 110 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cca740d..d5f0114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.4.6 +* Undercover cops are using their own skin instead of a random model, but still receive the basic kit loadout. +* Players who are cuffed can walk. +* Added more objects to be spawned. +* Fixed a bug where ghmattimysql was still being used when whitelist is disabled. + ## 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. diff --git a/README.md b/README.md index e365b7a..b53165a 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,21 @@ You can find the latest changes [here](CHANGELOG.md). A Discord server is available: [![](https://discordapp.com/api/guilds/361144123681538060/widget.png)](https://discord.gg/qnAqCEd) ## Requirements -- [Mysql](https://dev.mysql.com/downloads/mysql/) -- [ghmattimysql](https://github.com/GHMatti/ghmattimysql) +If you are using a database then you need to setup **ghmattimysql** you can start using Cops_FiveM. +Are you using **ZAP-Hosting** and don't know what your database name/username/password is then [watch this video](https://www.youtube.com/watch?v=4UcC9zNZkFc). + +- Download [ghmattimysql](https://github.com/GHMatti/ghmattimysql/releases/download/1.1.0/ghmattimysql.zip) +- Extract the zipfile and make sure that the folder is named **ghmattimysql**. +- Open ghmattimysql/config.json and edit the config lines with your db name/user/password/host. +- Copy the **ghmattimysql** folder to resources/. +- Open server.cfg and add **start ghmattimysql** ## Installation 1. Verify that you have installed the requirements from above. 2. Download the latest version from the [GitHub repository](https://github.com/FiveM-Scripts/Cops_FiveM/releases/latest). 3. Only copy the subdirectory *police* to the *resources* folder on your server. -4. Edit [config file](https://github.com/FiveM-Scripts/Cops_FiveM/blob/master/police/config/config.lua) to your preferences. -5. Add *start police* in your server.cfg (make sure you start this resource after all dependencies). +4. Edit [config file](https://github.com/FiveM-Scripts/Cops_FiveM/blob/master/police/config/config.lua) to your preferences +5. Add *start police* in server.cfg (make sure you start this resource after all dependencies). 6. The first time when you enter the game you will need to add yourself to the police database. you can do this in your server console enter `CopAddAdmin 1` or `CopAdd 1` press **enter** and you should receive a confirmation message. diff --git a/police/__resource.lua b/police/__resource.lua index 4afa13b..e798c83 100644 --- a/police/__resource.lua +++ b/police/__resource.lua @@ -1,9 +1,8 @@ -resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9' -resource_version '1.4.5' -resource_versionNum '145' +resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' +resource_version '1.4.6' +resource_versionNum '146' resource_Isdev 'no' - -dependency 'ghmattimysql' +resource_fname 'Cops FiveM' ui_page('client/html/index.html') diff --git a/police/client/armory.lua b/police/client/armory.lua index 0e5c8d8..113a93e 100644 --- a/police/client/armory.lua +++ b/police/client/armory.lua @@ -60,11 +60,14 @@ function createArmoryPed() end function giveBasicKit() - GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_STUNGUN"), -1, true, true) - GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_NIGHTSTICK"), -1, true, true) - GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_FLASHLIGHT"), 200, true, true) + GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_PISTOL"), -1, true, false) + GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_STUNGUN"), -1, true, false) + GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_NIGHTSTICK"), -1, true, false) + GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_FLASHLIGHT"), 200, true, false) + SetCurrentPedWeapon(PlayerPedId(), GetHashKey("WEAPON_UNARMED"), true) PlaySoundFrontend(-1, "PICK_UP", "HUD_FRONTEND_DEFAULT_SOUNDSET", true) + end function giveBasicPrisonKit() @@ -100,6 +103,7 @@ end function GiveCustomWeapon(weaponData) GiveWeaponToPed(PlayerPedId(), GetHashKey(weaponData), -1, false, true) + SetCurrentPedWeapon(PlayerPedId(), GetHashKey("WEAPON_UNARMED"), true) PlaySoundFrontend(-1, "PICK_UP", "HUD_FRONTEND_DEFAULT_SOUNDSET", true) end diff --git a/police/client/client.lua b/police/client/client.lua index 75a5b59..1784b69 100644 --- a/police/client/client.lua +++ b/police/client/client.lua @@ -17,6 +17,7 @@ along with Cops_FiveM in the file "LICENSE". If not, see 3 then CloseMenu() end + if(distance < 30) then 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 end @@ -409,6 +438,7 @@ function isNearStationGarage() return true end end + function isNearHelicopterStation() local distance = 10000 local pos = {} @@ -514,42 +544,40 @@ Citizen.CreateThread(function() while not HasThisAdditionalTextLoaded(gxt, CurrentSlot) do Wait(0) end + end + + RequestAnimDict('mp_arresting') + while not HasAnimDictLoaded('mp_arresting') do + Citizen.Wait(50) end + if not IsIplActive("FIBlobby") then + RequestIpl("FIBlobbyfake") + 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) - Citizen.InvokeNative(0xDC0F817884CDD856, 5, false) - Citizen.InvokeNative(0xDC0F817884CDD856, 8, false) - Citizen.InvokeNative(0xDC0F817884CDD856, 9, false) - Citizen.InvokeNative(0xDC0F817884CDD856, 10, false) - Citizen.InvokeNative(0xDC0F817884CDD856, 11, false) + if config.enableNeverWanted then + SetMaxWantedLevel(0) + SetWantedLevelMultiplier(0.0) + else + SetMaxWantedLevel(5) + SetWantedLevelMultiplier(1.0) end if config.stationBlipsEnabled then for _, item in pairs(clockInStation) do item.blip = AddBlipForCoord(item.x, item.y, item.z) SetBlipSprite(item.blip, 60) + SetBlipScale(item.blip, 0.8) SetBlipAsShortRange(item.blip, true) end end - + while true do Citizen.Wait(5) DisablePlayerVehicleRewards(PlayerId()) - if(config.enableNeverWanted == true) then - SetPlayerWantedLevel(PlayerId(), 0, false) - SetPlayerWantedLevelNow(PlayerId(), false) - HideHudComponentThisFrame(1) - end - if(anyMenuOpen.isActive) then DisableControlAction(1, 21) DisableControlAction(1, 140) @@ -619,19 +647,39 @@ Citizen.CreateThread(function() end if (handCuffed == true) then - RequestAnimDict('mp_arresting') - while not HasAnimDictLoaded('mp_arresting') do - Citizen.Wait(0) - end local myPed = PlayerPedId() local animation = 'idle' - local flags = 16 + local flags = 50 while(IsPedBeingStunned(myPed, 0)) do ClearPedTasksImmediately(myPed) end - TaskPlayAnim(myPed, 'mp_arresting', animation, 8.0, -8, -1, flags, 0, 0, 0, 0) + + if not cuffing then + DisableControlAction(1, 12, true) + DisableControlAction(1, 13, true) + DisableControlAction(1, 14, true) + + DisableControlAction(1, 15, true) + DisableControlAction(1, 16, true) + DisableControlAction(1, 17, true) + + SetCurrentPedWeapon(myPed, GetHashKey("WEAPON_UNARMED"), true) + TaskPlayAnim(myPed, "mp_arresting", animation, 8.0, -8.0, -1, flags, 0, 0, 0, 0 ) + + Wait(4000) + cuffing = true + end + else + EnableControlAction(1, 12, false) + EnableControlAction(1, 13, false) + EnableControlAction(1, 14, false) + + EnableControlAction(1, 15, false) + EnableControlAction(1, 16, false) + EnableControlAction(1, 17, false) + cuffing = false end --Piece of code from Drag command (by Frazzle, Valk, Michael_Sanelli, NYKILLA1127 : https://forum.fivem.net/t/release-drag-command/22174) @@ -646,6 +694,12 @@ Citizen.CreateThread(function() playerStillDragged = false end end + + if config.enableNeverWanted then + if IsPlayerWantedLevelGreater(PlayerId(), 0) then + ClearPlayerWantedLevel(PlayerId()) + end + end if(isCop) then if(isNearTakeService()) then @@ -689,14 +743,9 @@ Citizen.CreateThread(function() Wait(600) SetEntityCoords(PlayerPedId(), 452.119966796875, -980.061966796875, 30.690966796875) + Wait(800) armoryPed = createArmoryPed() - if DoesEntityExist(armoryPed) then - TaskTurnPedToFaceEntity(PlayerPedId(), armoryPed, -1) - end - - Wait(500) - if not DoesCamExist(ArmoryRoomCam) then ArmoryRoomCam = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true) AttachCamToEntity(ArmoryRoomCam, PlayerPedId(), 0.0, 0.0, 1.0, true) @@ -708,6 +757,11 @@ Citizen.CreateThread(function() Wait(100) DoScreenFadeIn(500) + + if DoesEntityExist(armoryPed) then + TaskTurnPedToFaceEntity(PlayerPedId(), armoryPed, -1) + end + Wait(300) OpenArmory() if not IsAmbientSpeechPlaying(armoryPed) then @@ -772,7 +826,7 @@ Citizen.CreateThread(function() if drag then local ped = GetPlayerPed(GetPlayerFromServerId(playerPedDragged)) plyPos = GetEntityCoords(ped, true) - SetEntityCoords(ped, plyPos.x, plyPos.y, plyPos.z) + SetEntityCoords(ped, plyPos.x, plyPos.y, plyPos.z) end Citizen.Wait(1000) end @@ -786,7 +840,7 @@ Citizen.CreateThread(function() x,y,z = table.unpack(GetEntityCoords(PlayerPedId(), true)) if DoesObjectOfTypeExistAtCoords(x, y, z, 0.9, GetHashKey("P_ld_stinger_s"), true) then - for i= 0, 7 do + for i= 0, 7 do SetVehicleTyreBurst(currentVeh, i, true, 1148846080) end diff --git a/police/client/cloackroom.lua b/police/client/cloackroom.lua index b31fc53..bf32dd9 100644 --- a/police/client/cloackroom.lua +++ b/police/client/cloackroom.lua @@ -86,6 +86,11 @@ function cloackroom_rem_yellow_vest() end function SetCopModel(model) + SetMaxWantedLevel(0) + SetWantedLevelMultiplier(0.0) + SetRelationshipBetweenGroups(0, GetHashKey("police"), GetHashKey("PLAYER")) + SetRelationshipBetweenGroups(0, GetHashKey("PLAYER"), GetHashKey("police")) + modelHash = GetHashKey(model) RequestModel(modelHash) @@ -126,9 +131,10 @@ function SetCopModel(model) SetPlayerModel(PlayerId(), modelHash) SetPedComponentVariation(PlayerPedId(), 10, 7, config.rank.outfit_badge[rank], 2) else - SetPlayerModel(PlayerId(), modelHash) + -- SetPlayerModel(PlayerId(), modelHash) end + giveBasicKit() SetModelAsNoLongerNeeded(modelHash) end @@ -145,6 +151,12 @@ function removeUniforme() SetPlayerModel(PlayerId(), model) SetModelAsNoLongerNeeded(model) + + SetMaxWantedLevel(5) + SetWantedLevelMultiplier(1.0) + + SetRelationshipBetweenGroups(3, GetHashKey("police"), GetHashKey("PLAYER")) + SetRelationshipBetweenGroups(3, GetHashKey("PLAYER"), GetHashKey("police")) end end @@ -159,5 +171,8 @@ function OpenCloackroom() anyMenuOpen.menuName = "cloackroom" anyMenuOpen.isActive = true + if config.enableVersionNotifier then + TriggerServerEvent('police:UpdateNotifier') + end end end diff --git a/police/client/garage.lua b/police/client/garage.lua index 6ef6716..fd7c6d5 100644 --- a/police/client/garage.lua +++ b/police/client/garage.lua @@ -20,6 +20,7 @@ function load_garage() for k in ipairs (buttons) do buttons [k] = nil end + for k, data in pairs(vehicles) do if config.useCopWhitelist then if dept == k then @@ -28,8 +29,10 @@ function load_garage() end end else - for k, v in pairs(data) do - buttons[#buttons+1] = {name = tostring(v.name), func = "SpawnerVeh", params = tostring(v.model)} + if dept == 1 then + for k, v in pairs(data) do + buttons[#buttons+1] = {name = tostring(v.name), func = "SpawnerVeh", params = tostring(v.model)} + end end end end @@ -53,12 +56,13 @@ function SpawnerVeh(hash) local playerHeading = GetEntityHeading(playerPed) policevehicle = CreateVehicle(car, playerCoords, 90.0, true, false) + SetVehicleEngineOn(policevehicle, true, true, true) SetVehicleMod(policevehicle, 11, 2) SetVehicleMod(policevehicle, 12, 2) SetVehicleMod(policevehicle, 13, 2) SetEntityHeading(policevehicle, (playerHeading+160)%360) - SetVehicleEnginePowerMultiplier(policevehicle, 35.0) + SetVehicleEnginePowerMultiplier(policevehicle, 25.0) SetVehicleOnGroundProperly(policevehicle) SetVehicleHasBeenOwnedByPlayer(policevehicle,true) @@ -67,8 +71,9 @@ function SpawnerVeh(hash) local netid = NetworkGetNetworkIdFromEntity(policevehicle) SetNetworkIdCanMigrate(netid, true) NetworkRegisterEntityAsNetworked(VehToNet(policevehicle)) + TaskWarpPedIntoVehicle(playerPed, policevehicle, -1) - SetEntityInvincible(policevehicle, false) + SetEntityInvincible(policevehicle, false) end function OpenGarage() diff --git a/police/client/html/css/style.css b/police/client/html/css/style.css index 3e49fc1..5324168 100644 --- a/police/client/html/css/style.css +++ b/police/client/html/css/style.css @@ -66,7 +66,7 @@ body { margin-bottom: 0; } -ul li:nth-of-type(1n+9) { +ul li:nth-of-type(1n+10) { display: none; } diff --git a/police/client/html/js/script.js b/police/client/html/js/script.js index e0fdc4e..4a274b4 100644 --- a/police/client/html/js/script.js +++ b/police/client/html/js/script.js @@ -15,7 +15,7 @@ $(document).ready(function(){ } var count = $("ul").children().length; - if (count > 8) { + if (count > 10) { $(".scroll").show(); } else { $(".scroll").hide(); @@ -43,7 +43,7 @@ $(document).ready(function(){ if(active.prev().length == 0) { active.siblings().last().addClass("active"); $(".item").hide(); - $(".item").slice(-8).show(); + $(".item").slice(-10).show(); } else { active.prev().addClass("active"); } @@ -62,7 +62,7 @@ $(document).ready(function(){ if(active.next().length == 0) { active.siblings().first().addClass("active"); $(".item").hide(); - $(".item").slice(0,8).show(); + $(".item").slice(0, 10).show(); } else { active.next().addClass("active"); } diff --git a/police/client/menu.lua b/police/client/menu.lua index 1071a4a..357b66e 100644 --- a/police/client/menu.lua +++ b/police/client/menu.lua @@ -47,10 +47,10 @@ function load_menu() end --Categories - buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("menu_animations_title"), func = "OpenAnimMenu", params = ""} - buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("menu_citizens_title"), func = "OpenCitizenMenu", params = ""} - buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("menu_vehicles_title"), func = "OpenVehMenu", params = ""} - buttonsCategories[#buttonsCategories+1] = {name = i18n.translate("menu_props_title"), func = "OpenPropsMenu", params = ""} + buttonsCategories[#buttonsCategories+1] = {name = GetLabelText("CRW_ANIMATION"), func = "OpenAnimMenu", params = ""} + buttonsCategories[#buttonsCategories+1] = {name = GetLabelText("collision_c29ovv"), func = "OpenCitizenMenu", params = ""} + buttonsCategories[#buttonsCategories+1] = {name = GetLabelText("PIM_TVEHI"), func = "OpenVehMenu", params = ""} + buttonsCategories[#buttonsCategories+1] = {name = GetLabelText("collision_9o6rwvf"), func = "OpenPropsMenu", params = ""} --Animations buttonsAnimation[#buttonsAnimation+1] = {name = i18n.translate("menu_anim_do_traffic_title"), func = 'DoTraffic', params = ""} @@ -79,7 +79,9 @@ function load_menu() buttonsFine[#buttonsFine+1] = {name = "$10000", func = 'Fines', params = 10000} buttonsFine[#buttonsFine+1] = {name = i18n.translate("menu_custom_amount_fine_title"), func = 'Fines', params = -1} + -- vehicles buttonsVehicle[#buttonsVehicle+1] = {name = i18n.translate("menu_crochet_veh_title"), func = 'Crochet', params = ""} + buttonsVehicle[#buttonsVehicle+1] = {name = GetLabelText("FMMC_REMVEH"), func = 'DropVehicle', params = ""} buttonsVehicle[#buttonsVehicle+1] = {name = "Spike Stripes", func = 'SpawnSpikesStripe', params = ""} --Props @@ -87,8 +89,8 @@ function load_menu() buttonsProps[#buttonsProps+1] = {name = v.name, func = "SpawnProps", params = tostring(v.hash)} end - buttonsProps[#buttonsProps+1] = {name = i18n.translate("menu_remove_last_props_title"), func = "RemoveLastProps", params = ""} - buttonsProps[#buttonsProps+1] = {name = i18n.translate("menu_remove_all_props_title"), func = "RemoveAllProps", params = ""} + buttonsProps[#buttonsProps+1] = {name = GetLabelText("collision_7x5xu9w"), func = "RemoveLastProps", params = ""} + buttonsProps[#buttonsProps+1] = {name = GetLabelText("FMMC_REMOBJ"), func = "RemoveAllProps", params = ""} end function DoTraffic() @@ -138,7 +140,7 @@ function CheckInventory() if(distance ~= -1 and distance < 3) then TriggerServerEvent("police:targetCheckInventory", GetPlayerServerId(t)) else - TriggerEvent('chatMessage', i18n.translate("title_notification"), {255, 0, 0}, i18n.translate("no_player_near_ped")) + drawNotification(i18n.translate("no_player_near_ped")) end end @@ -147,7 +149,7 @@ function RemoveWeapons() if(distance ~= -1 and distance < 3) then TriggerServerEvent("police:removeWeapons", GetPlayerServerId(t)) else - TriggerEvent('chatMessage', i18n.translate("title_notification"), {255, 0, 0}, i18n.translate("no_player_near_ped")) + drawNotification(i18n.translate("no_player_near_ped")) end end @@ -156,7 +158,7 @@ function ToggleCuff() if(distance ~= -1 and distance < 3) then TriggerServerEvent("police:cuffGranted", GetPlayerServerId(t)) else - TriggerEvent('chatMessage', i18n.translate("title_notification"), {255, 0, 0}, i18n.translate("no_player_near_ped")) + drawNotification(i18n.translate("no_player_near_ped")) end end @@ -166,7 +168,7 @@ function PutInVehicle() local v = GetVehiclePedIsIn(PlayerPedId(), true) TriggerServerEvent("police:forceEnterAsk", GetPlayerServerId(t), v) else - TriggerEvent('chatMessage', i18n.translate("title_notification"), {255, 0, 0}, i18n.translate("no_player_near_ped")) + drawNotification(i18n.translate("no_player_near_ped")) end end @@ -175,7 +177,7 @@ function UnseatVehicle() if(distance ~= -1 and distance < 3) then TriggerServerEvent("police:confirmUnseat", GetPlayerServerId(t)) else - TriggerEvent('chatMessage', i18n.translate("title_notification"), {255, 0, 0}, i18n.translate("no_player_near_ped")) + drawNotification(i18n.translate("no_player_near_ped")) end end @@ -185,7 +187,7 @@ function DragPlayer() TriggerServerEvent("police:dragRequest", GetPlayerServerId(t)) TriggerEvent("police:notify", "CHAR_ANDREAS", 1, i18n.translate("title_notification"), false, i18n.translate("drag_sender_notification_part_1") .. GetPlayerName(serverTargetPlayer) .. i18n.translate("drag_sender_notification_part_2")) else - TriggerEvent('chatMessage', i18n.translate("title_notification"), {255, 0, 0}, i18n.translate("no_player_near_ped")) + drawNotification(i18n.translate("no_player_near_ped")) end end @@ -213,7 +215,7 @@ function Fines(amount) TriggerServerEvent("police:finesGranted", GetPlayerServerId(t), tonumber(amount)) end else - TriggerEvent('chatMessage', i18n.translate("title_notification"), {255, 0, 0}, i18n.translate("no_player_near_ped")) + drawNotification(i18n.translate("no_player_near_ped")) end end @@ -224,12 +226,13 @@ function Crochet() local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0) local _, _, _, _, vehicleHandle = GetRaycastResult(rayHandle) - if(DoesEntityExist(vehicleHandle)) then + if DoesEntityExist(vehicleHandle) and IsEntityAVehicle(vehicleHandle) then local prevObj = GetClosestObjectOfType(pos.x, pos.y, pos.z, 10.0, GetHashKey("prop_weld_torch"), false, true, true) if(IsEntityAnObject(prevObj)) then SetEntityAsMissionEntity(prevObj) DeleteObject(prevObj) end + TaskStartScenarioInPlace(PlayerPedId(), "WORLD_HUMAN_WELDING", 0, true) Citizen.Wait(20000) SetVehicleDoorsLocked(vehicleHandle, 1) @@ -241,6 +244,21 @@ function Crochet() end) end +function DropVehicle() + Citizen.CreateThread(function() + local pos = GetEntityCoords(PlayerPedId()) + local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0) + + local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0) + local _, _, _, _, vehicleHandle = GetRaycastResult(rayHandle) + if DoesEntityExist(vehicleHandle) and IsEntityAVehicle(vehicleHandle) then + DeleteEntity(vehicleHandle) + else + drawNotification(i18n.translate("no_veh_near_ped")) + end + end) +end + function SpawnSpikesStripe() if IsPedInAnyPoliceVehicle(PlayerPedId()) then local modelHash = GetHashKey("P_ld_stinger_s") @@ -362,7 +380,7 @@ function OpenAnimMenu() CloseMenu() SendNUIMessage({ title = i18n.translate("menu_global_title"), - subtitle = i18n.translate("menu_animations_title"), + subtitle = GetLabelText("CRW_ANIMATION"), buttons = buttonsAnimation, action = "setAndOpen" }) @@ -375,7 +393,7 @@ function OpenCitizenMenu() CloseMenu() SendNUIMessage({ title = i18n.translate("menu_global_title"), - subtitle = i18n.translate("menu_citizens_title"), + subtitle = GetLabelText("collision_c29ovv"), buttons = buttonsCitizen, action = "setAndOpen" }) @@ -388,7 +406,7 @@ function OpenVehMenu() CloseMenu() SendNUIMessage({ title = i18n.translate("menu_global_title"), - subtitle = i18n.translate("menu_vehicles_title"), + subtitle = GetLabelText("PIM_TVEHI"), buttons = buttonsVehicle, action = "setAndOpen" }) @@ -401,7 +419,7 @@ function OpenMenuFine() CloseMenu() SendNUIMessage({ title = i18n.translate("menu_global_title"), - subtitle = i18n.translate("menu_fines_title"), + subtitle = GetLabelText("PM_MP_OPTIONS"), buttons = buttonsFine, action = "setAndOpen" }) @@ -414,7 +432,7 @@ function OpenPropsMenu() CloseMenu() SendNUIMessage({ title = i18n.translate("menu_global_title"), - subtitle = i18n.translate("menu_props_title"), + subtitle = GetLabelText("collision_9o6rwvf"), buttons = buttonsProps, action = "setAndOpen" }) @@ -430,7 +448,7 @@ Citizen.CreateThread(function() local ox, oy, oz = table.unpack(GetEntityCoords(NetToObj(props), true)) local cVeh = GetClosestVehicle(ox, oy, oz, 20.0, 0, 70) if(IsEntityAVehicle(cVeh)) then - if IsEntityAtEntity(cVeh, NetToObj(props), 20.0, 20.0, 2.0, 0, 1, 0) then + if IsEntityAtEntity(cVeh, NetToObj(props), 3.0, 5.0, 2.0, 0, 1, 0) then local cDriver = GetPedInVehicleSeat(cVeh, -1) TaskVehicleTempAction(cDriver, cVeh, 6, 1000) diff --git a/police/config/config.lua b/police/config/config.lua index 02ee689..ccd6d0f 100644 --- a/police/config/config.lua +++ b/police/config/config.lua @@ -17,14 +17,7 @@ config = { --Available languages : 'en', 'fr', 'de' lang = 'en', - - - --Use by job system - job = { - officer_on_duty_job_id = 2, - officer_not_on_duty_job_id = 7, - }, - + bindings = { interact_position = 51, -- E use_police_menu = 166, -- F5 @@ -194,14 +187,18 @@ clockInStation = { {x=850.156677246094, y=-1283.92004394531, z=28.0047378540039}, -- La Mesa {x=457.956909179688, y=-992.72314453125, z=30.6895866394043}, -- Mission Row {x=1856.91320800781, y=3689.50073242188, z=34.2670783996582}, -- Sandy Shore - {x=-450.063201904297, y=6016.5751953125, z=31.7163734436035} -- Paleto Bay + {x=-450.063201904297, y=6016.5751953125, z=31.7163734436035}, -- Paleto Bay + {x=-1093.0604248046875, y=-808.6140747070312, z=19.28019142150879}, -- Vespucci + {x=360.3169860839844, y=-1583.9188232421875, z=29.291934967041016} -- Davis Sheriff station } garageStation = { {x=-470.85266113281, y=6022.9296875, z=31.340530395508}, -- La Mesa {x=1873.3372802734, y=3687.3508300781, z=33.616954803467}, -- Mission Row {x=452.115966796875, y=-1018.10681152344, z=28.4786586761475}, -- Sandy Shore - {x=855.24249267578, y=-1279.9300537109, z=26.513223648071 } --Paleto Bay + {x=855.24249267578, y=-1279.9300537109, z=26.513223648071 }, --Paleto Bay + {x=-1070.1719970703125, y=-854.4666137695312, z=4.8671650886535645 }, -- Vespucci + {x=383.7397766113281, y=-1624.2393798828125, z=29.291946411132812} -- Davis Sheriff station } heliStation = { @@ -209,10 +206,12 @@ heliStation = { } armoryStation = { - {x=452.119966796875, y=-980.061966796875, z=30.690966796875}, - {x=853.157, y=-1267.74, z= 26.6729}, - {x=1849.63, y=3689.48, z=34.2671}, - {x=-448.219, y= 6008.98, z=31.7164} + {x=452.119966796875, y=-980.061966796875, z=30.690966796875}, -- La Mesa + {x=853.157, y=-1267.74, z= 26.6729}, -- Mission Row + {x=1849.63, y=3689.48, z=34.2671}, -- Sandy Shore + {x=-448.219, y= 6008.98, z=31.7164}, -- Paleto Bay + -- still need to add vespucci + {x=352.9969177246094, y=-1592.7291259765625, z=29.291934967041016} -- Davis Sheriff station } i18n.setLang(tostring(config.lang)) diff --git a/police/config/objects.lua b/police/config/objects.lua index f7b9bf0..2d46812 100644 --- a/police/config/objects.lua +++ b/police/config/objects.lua @@ -1,6 +1,10 @@ -- Configure the objects that cops can spawn on the map SpawnObjects = { - {name=i18n.translate("menu_spawn_props_title"), hash="prop_mp_cone_02"}, - {name=i18n.translate("menu_spawn_barrier_title"), hash="prop_barrier_work05"}, - {name=i18n.translate("menu_spawn_work_ahead_barrier_title"), hash="prop_barrier_work04a"} + {name=GetLabelText("FMMC_PR_23"), hash="prop_mp_barrier_01b"}, + {name=GetLabelText("FMMC_PR_BARQADB"), hash="prop_barrier_work05"}, + {name=GetLabelText("FMMC_DPR_LTRFCN"), hash="prop_air_conelight"}, + {name=GetLabelText("FMMC_PR_PBARR"), hash="prop_barrier_work06a"}, + {name=GetLabelText("FMMC_PR_CABTBTH"), hash="prop_tollbooth_1"}, + {name=GetLabelText("FMMC_DPR_TRFCNE"), hash="prop_mp_cone_01"}, + {name=GetLabelText("FMMC_DPR_TRFPLE"), hash="prop_mp_cone_04"} } \ No newline at end of file diff --git a/police/server/server.lua b/police/server/server.lua index f1d74b5..4d3248b 100644 --- a/police/server/server.lua +++ b/police/server/server.lua @@ -14,11 +14,13 @@ You should have received a copy of the GNU Affero General Public License along with Cops_FiveM in the file "LICENSE". If not, see . ]] -local setupTable = "CREATE TABLE IF NOT EXISTS `police` (`identifier` varchar(255) COLLATE utf8_unicode_ci NOT NULL,`dept` int(11) NOT NULL DEFAULT '0',`rank` int(11) NOT NULL DEFAULT '0')" -exports.ghmattimysql:execute(setupTable, {}, function() - IsDatabaseVerified = true -end) +if config.useCopWhitelist then + local setupTable = "CREATE TABLE IF NOT EXISTS `police` (`identifier` varchar(255) COLLATE utf8_unicode_ci NOT NULL,`dept` int(11) NOT NULL DEFAULT '0',`rank` int(11) NOT NULL DEFAULT '0')" + exports.ghmattimysql:execute(setupTable, {}, function() + IsDatabaseVerified = true + end) +end if GetResourceMetadata(GetCurrentResourceName(), 'resource_Isdev', 0) == "yes" then RconPrint("/!\\ You are running a dev version of Cops FiveM !\n") @@ -85,17 +87,21 @@ AddEventHandler('police:checkIsCop', function() local identifier = getPlayerID(source) local src = source - exports.ghmattimysql:scalar("SELECT `identifier` FROM police WHERE identifier = @identifier", { ['identifier'] = identifier}, function(result) - if not result then - TriggerClientEvent('police:receiveIsCop', src, -1) - else - exports.ghmattimysql:execute("SELECT * FROM police WHERE identifier = @identifier", { ['identifier'] = identifier}, function(data) - if data then - TriggerClientEvent('police:receiveIsCop', src, data[1].rank, data[1].dept) - end - end) - end - end) + if config.useCopWhitelist then + exports.ghmattimysql:scalar("SELECT `identifier` FROM police WHERE identifier = @identifier", { ['identifier'] = identifier}, function(result) + if not result then + TriggerClientEvent('police:receiveIsCop', src, -1) + else + exports.ghmattimysql:execute("SELECT * FROM police WHERE identifier = @identifier", { ['identifier'] = identifier}, function(data) + if data then + TriggerClientEvent('police:receiveIsCop', src, data[1].rank, data[1].dept) + end + end) + end + end) + else + TriggerClientEvent('police:receiveIsCop', src, 0, 1) + end end) RegisterServerEvent('police:takeService') @@ -182,6 +188,17 @@ AddEventHandler('CheckPoliceVeh', function(vehicle) TriggerClientEvent('policeveh:spawnVehicle', source, vehicle) end) +RegisterServerEvent('police:UpdateNotifier') +AddEventHandler('police:UpdateNotifier', function() + local src = source + PerformHttpRequest("https://raw.githubusercontent.com/FiveM-Scripts/Cops_FiveM/master/police/__resource.lua", function(errorCode, result, headers) + local version = GetResourceMetadata(GetCurrentResourceName(), 'resource_version', 0) + if string.find(tostring(result), version) == nil then + TriggerClientEvent('police:Update', src, true) + end + end, "GET", "", "") +end) + RegisterCommand("CopAddAdmin", function(source,args,raw) if #args ~= 1 then RconPrint("Usage: CopAddAdmin [ingame-id]\n")