Scaleform cursor selection help fivem c#

I am trying to get working this function: GetScaleformMovieCursorSelection

I have tried the following scaleformIds: MP_RESULTS_PANEL, COLOUR_SWITCHER_02, MP_NEXT_JOB_SELECTION No luck working for me

I am aware I need to enable the following controls: 239, 240, 237, 238

I’ve been searching on internet for a way to get GetScaleformMovieCursorSelection working, however may failed attempts. My guess is that I’m using wrong scaleformId/missing code/wrong padIndex.

If someone could help me get this working for c# that would be awesome!

Here is the code I want to get working:

 public Main()
 {
     initScaleform();
     Tick += tickTask;
 }

 private async Task tickTask()
 {
     scaleFormTest();

     await Task.FromResult(0);
 }

 Scaleform scaleform = new Scaleform("SC_LEADERBOARD");
 bool hasScaleForm = false;
 private void initScaleform()
 {
     scaleform = new Scaleform("SC_LEADERBOARD");
     int padIndex = 1;//0 is correct padIndex?
     EnableControlAction(padIndex, 239, true);
     EnableControlAction(padIndex, 240, true);
     EnableControlAction(padIndex, 237, true);
     EnableControlAction(padIndex, 238, true);
 }

 private void scaleFormTest()
 {
     if (!hasScaleForm)
     {
         hasScaleForm = HasScaleformMovieLoaded(scaleform.Handle);
     }
     else
     {
         int eventType = 0;
         int itemId = 0;
         int context = 0;

         OutputArgument _eventType = new OutputArgument();
         OutputArgument _context = new OutputArgument();
         OutputArgument _itemId = new OutputArgument();
         OutputArgument _itemId2 = new OutputArgument();

         bool success = Function.Call<bool>(Hash._GET_SCALEFORM_MOVIE_CURSOR_SELECTION, scaleform.Handle, _eventType, _context, _itemId);

         if (success)
         {
             eventType = _eventType.GetResult<int>();
             itemId = _itemId.GetResult<int>();
             context = _context.GetResult<int>();
         }
         string result = "check " + success + " eventType " + eventType + " itemid " + itemId + " context " + context;
       
         drawText(result, 0, 0.5f, 1, 2, Color.FromArgb(255, 255, 255, 255));
         //Debug.WriteLine(result);
     }
 }
 public void drawText(string text, float x, float y, float scale, int font, Color col)
 {
     SetTextFont(font);
     SetTextScale(scale, scale);
     SetTextColour(col.R, col.G, col.B, col.A);
     SetTextDropShadow();
     SetTextWrap(0.0f, 1.0f);

     SetTextEntry("STRING");

     AddTextComponentString(text);
     EndTextComponent();
     DrawText(x, y);
 }

Hey, first of all, the control pad index is defined as Control Type in the docs: Controls - Cfx.re Docs 0 for normal controls, 2 for controls related to frontend / pausemenu. Usually 0 works for everything, but if it’s not working for you and you are using ActivateFrontendMenu - FiveM Natives @ Cfx.re Docs, you might also want to try padIndex = 2.

Also, is scaleFormTest() running every frame? I see that you are checking if the scaleform handle is loaded. I have no clue how C# works, so I assume you know that scaleform.Handle is the correct var that new Scaleform("SC_LEADERBOARD"); outputs for the … scaleform handle.

If you only run scaleFormTest() once, immediately after initScaleform(), chances are that you didn’t give time for the scaleform to load, so your cursor code never actually runs.

Last thing, does success return anything? Also you might want to add the forth param in _GET_SCALEFORM_MOVIE_CURSOR_SELECTION even tho the docs says it’s unused. Just to be safe.

So, I have tried 0 - 2 controlTypes and checking HasScaleformMovieLoaded is only run every frame until it becomes loaded as theres a check in there called hasScaleForm. scaleFormTest() runs every frame but only the check for HasScaleformMovieLoaded will only run once if true. The GET_SCALEFORM_MOVIE_CURSOR_SELECTION returns false everytime I try. I can see false in with the rest of the results for the function. Do you know of anything else I could try or link some helpful information about this?