gpt-4-0314· openai
Suzhen/CodeChat
fivem scripting lua how would i hide the minimap
- User
fivem scripting lua how would i hide the minimap
- Assistant
To hide the minimap in FiveM using Lua scripting, you can use the
SetRadarBigmapEnabledandDisplayRadarfunctions. Here's an example of how you can create a command to toggle the minimap:local isMinimapVisible = true -- Initial state -- This function toggles the minimap visibility function toggleMinimap() isMinimapVisible = not isMinimapVisible SetRadarBigmapEnabled(not isMinimapVisible, false) -- Disables or enables the expanded radar DisplayRadar(isMinimapVisible) -- Disables or enables the radar end -- This function gets called every frame Citizen.CreateThread(function() while true do Citizen.Wait(0) -- Checks if the key "B" has been just pressed (replace 29 with the desired key code) if IsControlJustPressed(0, 29) then toggleMinimap() end end end)This script will toggle the minimap on/off when the "B" key is pressed. You can replace the value
29with a different key code if you want to use another key. Here's a reference of key codes: https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/