You just need to be a bit creative with how you print your text. Here's a simple example where you're just selecting through a bunch of strings.
function MissionSetup()
AreaTransitionXYZ(0,270,-110,6)
end
function MissionCleanup()
end
function main()
-- Setup variables:
local blip = BlipAddXYZ(270,-105,6,0,1,1)
local menu = {"menu item1","spudgun","dildo","RPG-7","Gary Smith","Pete","Damon","Sheldonator"}
local s = 1
-- Main loop:
while true do
if PedIsInAreaXYZ(gPlayer,270,-115,6,0.8) then -- if player is in blip
TextPrintString("Press \b to use menu",0,2) -- print prompt for blip
Wait(0) -- suspsend script for 1 frame so text can be printed and buttons can be processed
if IsButtonBeingPressed(9,0) then
-- Disable player control so he doesn't move:
PlayerSetControl(0)
-- Menu loop:
repeat
-- Show text:
local text = "MENU\n\n" -- the title and 2 linebreaks
for i = s - 2,s + 2 do -- for loop with i starting 2 before our current selection (s) and ending 2 after
if i == s then -- if i is our current selection, add a > to show that this menu option is currently selected
text = text..">"
end
if i >= 1 and i <= table.getn(menu) then -- if i is in between 1 and the size of our table, use i to get a menu option
text = text..menu[i]
end
text = text.."\n" -- add a linebreak, even if there was no text to show a linebreak still keeps everything positioned properly
end
TextPrintString(text,0,1) -- 0 time means 1 frame which is all we need
Wait(0) -- this suspends the script for one single frame, and during this frame the text above will be printed, and the game will process button preses which is important before our script processes the buttons
-- Process buttons:
if IsButtonBeingPressed(2,0) then
s = s - 1
if s < 1 then
s = table.getn(menu)
end
elseif IsButtonBeingPressed(3,0) then
s = s + 1
if s > table.getn(menu) then
s = 1
end
elseif IsButtonBeingPressed(7,0) then
TextPrintString("You selected "..menu[s],3,1)
Wait(3000)
end
until IsButtonBeingPressed(8,0) -- end the loop when jump is pressed
-- Regain control:
PlayerSetControl(1)
end
else
Wait(0) -- if the player wasn't in the blip, then we should still wait so that the game doesn't crash from the script never waiting
end
end
end