53 lines
1.9 KiB
Lua
53 lines
1.9 KiB
Lua
-- Referenced from glitchdetector: https://github.com/glitchdetector/fivem-instructional-buttons
|
|
|
|
local function ButtonMessage(text)
|
|
BeginTextCommandScaleformString("STRING")
|
|
AddTextComponentScaleform(text)
|
|
EndTextCommandScaleformString()
|
|
end
|
|
|
|
local function Button(ControlButton)
|
|
N_0xe83a3e3557a56640(ControlButton)
|
|
end
|
|
|
|
function DrawInstructionalButtons(primaryKey, primaryText, secondaryKey, secondaryText)
|
|
local scaleform = RequestScaleformMovie("instructional_buttons")
|
|
while not HasScaleformMovieLoaded(scaleform) do
|
|
Wait(0)
|
|
end
|
|
|
|
-- draw it once to set up layout
|
|
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 0, 0)
|
|
|
|
PushScaleformMovieFunction(scaleform, "CLEAR_ALL")
|
|
PopScaleformMovieFunctionVoid()
|
|
|
|
PushScaleformMovieFunction(scaleform, "SET_CLEAR_SPACE")
|
|
PushScaleformMovieFunctionParameterInt(200)
|
|
PopScaleformMovieFunctionVoid()
|
|
|
|
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
|
|
PushScaleformMovieFunctionParameterInt(0)
|
|
Button(GetControlInstructionalButton(2, secondaryKey, true)) -- The button to display
|
|
ButtonMessage(secondaryText) -- the message to display next to it
|
|
PopScaleformMovieFunctionVoid()
|
|
|
|
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
|
|
PushScaleformMovieFunctionParameterInt(1)
|
|
Button(GetControlInstructionalButton(2, primaryKey, true))
|
|
ButtonMessage(primaryText)
|
|
PopScaleformMovieFunctionVoid()
|
|
|
|
PushScaleformMovieFunction(scaleform, "DRAW_INSTRUCTIONAL_BUTTONS")
|
|
PopScaleformMovieFunctionVoid()
|
|
|
|
PushScaleformMovieFunction(scaleform, "SET_BACKGROUND_COLOUR")
|
|
PushScaleformMovieFunctionParameterInt(0)
|
|
PushScaleformMovieFunctionParameterInt(0)
|
|
PushScaleformMovieFunctionParameterInt(0)
|
|
PushScaleformMovieFunctionParameterInt(80)
|
|
PopScaleformMovieFunctionVoid()
|
|
|
|
return scaleform
|
|
end
|