Пример #1
0
        //20x40

        private async Task OnTick()
        {
            if (Game.IsControlJustPressed(0, (Control)166))
            {
                Gfx.ToggleLimbo();
            }
            ScreenWidth  = CitizenFX.Core.UI.Screen.Resolution.Width;
            ScreenHeight = CitizenFX.Core.UI.Screen.Resolution.Height;
            Gfx.DrawStatBar("TIME", "00:00", 0);
            var i = 1;

            foreach (Player p in new PlayerList())
            {
                Gfx.DrawStatBar($"~HUD_COLOUR_NET_PLAYER{i}~{p.Name}", $"(player)", i);
            }
            if (ReturnTwo(2) != 2)
            {
                await Delay(0);
            }
            if (Gfx.LimboActive)
            {
                //DisableAllControlActions(0);
                Game.DisableAllControlsThisFrame(0);
                Game.EnableControlThisFrame(0, Control.MpTextChatAll);
                Game.EnableControlThisFrame(0, Control.FrontendPause);
            }

            if (frontendActive)
            {
                if (Game.IsControlJustPressed(0, Control.FrontendAccept) || Game.IsControlJustPressed(0, Control.PhoneSelect))
                {
                    await Delay(100);

                    //var _return1 = BeginScaleformMovieMethodN("GET_COLUMN_SELECTION");
                    //var _return1 = BeginScaleformMovieMethodN("GET_COLUMN_SELECTION");
                    //var result1 = BeginScaleformMovieMethod(GetPauseMenuState(), "GET_COLUMN_SELECTION");
                    //PushScaleformMovieMethodParameterInt(0);
                    //Debug.Write(EndScaleformMovieMethodReturn().ToString() + "\n");
                    //var pop = PopScaleformMovieFunction();
                    //Debug.Write(GetScaleformMovieFunctionReturnBool(pop).ToString() + "\n");
                    //Debug.Write(GetScaleformMovieFunctionReturnInt(pop).ToString() + "\n");
                    //Debug.Write(pop.ToString() + "\n");
                    //Debug.Write(result1.ToString() + "\n");
                    Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");


                    //PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false);
                    PushScaleformMovieFunctionN("GET_COLUMN_SELECTION");
                    PushScaleformMovieMethodParameterInt(0);
                    var res   = EndScaleformMovieMethodReturn();
                    var timer = GetGameTimer();
                    while (!GetScaleformMovieFunctionReturnBool(res))
                    {
                        await Delay(0);

                        if (GetGameTimer() - timer > 1000)
                        {
                            Debug.WriteLine("Took too long");
                            break;
                        }
                    }
                    var resInt = GetScaleformMovieFunctionReturnInt(res);
                    Debug.Write($"{resInt}\n");
                    //else
                    //{
                    //    var resInt = GetScaleformMovieFunctionReturnInt(res);
                    //    Debug.Write($"No Return value: {resInt}\n");
                    //}
                }
            }
            if (Game.IsControlJustPressed(0, Control.FrontendSocialClubSecondary))
            {
                // If the menu is active, deactivate it.
                if (IsPauseMenuActive())
                {
                    SetPauseMenuActive(false);
                    SetFrontendActive(false);
                    frontendActive = false;
                }
                // Otherwise, activate it.
                else
                {
                    ///// RESET THE MENU IN CASE IT ALREADY EXISTS.
                    RestartFrontendMenu((uint)GetHashKey("FE_MENU_VERSION_CORONA"), -1);
                    //RestartFrontendMenu((uint)GetHashKey("FE_MENU_VERSION_CORONA"), -1);
                    //RestartFrontendMenu((uint)GetHashKey("FE_MENU_VERSION_CORONA_RACE"), -1);
                    AddFrontendMenuContext((uint)GetHashKey("FM_TUTORIAL"));
                    AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CORONA"));
                    AddFrontendMenuContext((uint)GetHashKey("CORONA_TOURNAMENT"));
                    AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CONTINUE"));

                    AddFrontendMenuContext(2010410515);
                    ObjectDecalToggle((uint)Int64.Parse("-228602367"));
                    //ObjectDecalToggle(1037243298);
                    //AddFrontendMenuContext(696397158);

                    ActivateFrontendMenu((uint)GetHashKey("FE_MENU_VERSION_CORONA"), false, -1);
                    //ActivateFrontendMenu((uint)GetHashKey("FE_MENU_VERSION_CORONA"), false, -1);
                    //ActivateFrontendMenu((uint)GetHashKey("FE_MENU_VERSION_CORONA_RACE"), false, -1);

                    // start a call
                    while (!IsPauseMenuActive() || IsPauseMenuRestarting())
                    {
                        await Delay(0);
                    }

                    AddFrontendMenuContext((uint)GetHashKey("FM_TUTORIAL"));
                    AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CORONA"));
                    AddFrontendMenuContext((uint)GetHashKey("CORONA_TOURNAMENT"));
                    AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CONTINUE"));

                    frontendActive = true;


                    ///// LOADING SCALEFORM AND ACTIVATING IT IN THE MENU?!
                    //BeginScaleformMovieMethodV("PAUSE_MENU_PAGES_CORONA_RACE");
                    //EndScaleformMovieMethod();


                    ///// PUSH THE DESCRIPTION AND TITLE UP, OTHERWISE IT'S BEHIND THE TOP HEADER BARS.
                    BeginScaleformMovieMethodV("SHIFT_CORONA_DESC"); // BeginScaleformMovieMethodV
                    PushScaleformMovieMethodParameterBool(true);     // push up.
                    PushScaleformMovieMethodParameterBool(false);    // show extra line
                    EndScaleformMovieMethod();


                    ///// SET THE MENU TITLE.
                    BeginScaleformMovieMethodN("SET_HEADER_TITLE"); // BeginScaleformMovieMethodV
                    BeginTextCommandScaleformString("STRING");
                    AddTextComponentSubstringPlayerName("Sumo");
                    EndTextCommandScaleformString();
                    PushScaleformMovieMethodParameterBool(false); // unknown, (confirmed bool), but is 0 (false) in decompiled scripts
                    ///// SET THE MENU DESCRIPTION.
                    BeginTextCommandScaleformString("STRING");
                    AddTextComponentSubstringPlayerName("LOBBY - Waiting for players");
                    EndTextCommandScaleformString();
                    ///// UNKNOWN.
                    PushScaleformMovieMethodParameterBool(true); // uknown, (confirmed bool), but is 1 (true) in decompiled scripts
                    ///// FINISH.
                    EndScaleformMovieMethod();                   // _POP_SCALEFORM_MOVIE_FUNCTION_VOID


                    /////// HEADER HUD COLOR (OPTIONAL)
                    //BeginScaleformMovieMethodV("SET_ALL_HIGHLIGHTS"); // BeginScaleformMovieMethodV
                    //PushScaleformMovieMethodParameterBool(true); // if false, will be black/white (high contrast mode)
                    //PushScaleformMovieMethodParameterInt(136); // HUD_COLOUR_PLATFORM_BLUE (136)
                    //EndScaleformMovieMethod();


                    await Delay(500);

                    ////////////////////////////////////////////////////////////////////////////////////////////
                    SetColumnSettingsRow(0, "Select a vehicle", "0", -1, true, HudColors.HudColor.HUD_COLOUR_ADVERSARY);
                    SetColumnSettingsRow(1, "Vote for a map", "0", -1, true, HudColors.HudColor.HUD_COLOUR_ADVERSARY);
                    SetColumnSettingsRow(2, "Quit to server list", "0", -1, true, HudColors.HudColor.HUD_COLOUR_ADVERSARY);
                    SetColumnSettingsRow(3, "Exit FiveM", "0", -1, true, HudColors.HudColor.HUD_COLOUR_ADVERSARY);

                    //BeginScaleformMovieMethodN("INIT_SCROLL_BAR");
                    //PushScaleformMovieMethodParameterBool(true);
                    //PushScaleformMovieMethodParameterInt(3);
                    //PushScaleformMovieMethodParameterInt(1);
                    //PushScaleformMovieMethodParameterInt(1);
                    //PushScaleformMovieMethodParameterInt(0);
                    //PushScaleformMovieMethodParameterInt(0);
                    //PopScaleformMovieFunctionVoid();

                    //BeginScaleformMovieMethodN("SET_SCROLL_BAR");
                    //PushScaleformMovieMethodParameterInt(2);
                    //PushScaleformMovieMethodParameterInt(5);
                    //PushScaleformMovieMethodParameterInt(1);
                    //PushScaleformMovieMethodParameterString("te");
                    //PopScaleformMovieFunctionVoid();
                    //for (var x = 0; x < 5; x++)
                    //{
                    //    ///// COLUMN 0 (LEFT) - ROW 0
                    //    PushScaleformMovieFunctionN("SET_DATA_SLOT");
                    //    PushScaleformMovieMethodParameterInt(0); // column
                    //    PushScaleformMovieMethodParameterInt(x); // index

                    //    // com.rockstargames.gtav.pauseMenu.pauseMenuItems.PauseMenuBaseItem::__set__data
                    //    PushScaleformMovieMethodParameterInt(0); // menu ID 0
                    //    PushScaleformMovieMethodParameterInt(0); // unique ID 0
                    //    PushScaleformMovieMethodParameterInt(0); // type 0 (TYPE_MAIN_CHAR_SELECTOR)
                    //    PushScaleformMovieMethodParameterInt(0); // initialIndex 1337 (rank)
                    //    PushScaleformMovieMethodParameterBool(true); // isSelectable true

                    //    ///// ITEM/ROW TITLE.
                    //    BeginTextCommandScaleformString("STRING");
                    //    AddTextComponentSubstringPlayerName("Setting " + x);
                    //    EndTextCommandScaleformString();

                    //    ///// UNSURE HOW THIS WORKS, BUT IF YOU UNCOMMENT THIS, IT'LL ADD AN ICON TO THE ROW.
                    //    ///// MAKING THE STRING "20" AND THE BOOL TRUE SEEMS TO DO SOMETHING WITH A ROCKSTAR LOGO INSTEAD.
                    //    BeginTextCommandScaleformString("STRING");
                    //    AddTextComponentSubstringPlayerName("");
                    //    EndTextCommandScaleformString();
                    //    PushScaleformMovieMethodParameterBool(false); // SOMETHING WITH ROCKSTAR/STAR LOGO SWITCHING.

                    //    ///// FINISH.
                    //    EndScaleformMovieMethod();
                    //}

                    PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                    PushScaleformMovieMethodParameterInt(0);
                    EndScaleformMovieMethod();

                    ////////////////////////////////////////////////////////////////////////////////////////////

                    #region Info Column Setup
                    ////////////////////////////////////////////////////////////////////////////////////////////
                    string[] leftText = new string[5] {
                        "Rating", "Created by", "Snail?", "Max players?", "Type"
                    };
                    string[] rightText = new string[5] {
                        "100.00%", "Vespura", "~g~YES", "32", "Sumo~b~"
                    };

                    /*
                     * for (var x = 0; x < 5; x++)
                     * {
                     *
                     #region Old messy code
                     *  ///// COLUMN 0 (LEFT) - ROW 0
                     *  PushScaleformMovieFunctionN("SET_DATA_SLOT");
                     *  PushScaleformMovieMethodParameterInt(1); // column
                     *  PushScaleformMovieMethodParameterInt(x); // index
                     *
                     *  PushScaleformMovieMethodParameterInt(0); // menu ID 0
                     *  PushScaleformMovieMethodParameterInt(0); // unique ID 0
                     *
                     *  //if (x == 4)
                     *  //{
                     *  //    PushScaleformMovieMethodParameterInt(2); // right icon type
                     *  //}
                     *  //else
                     *  //{
                     *  //    PushScaleformMovieMethodParameterInt(0); // right icon type
                     *  //}
                     *  PushScaleformMovieMethodParameterInt(2); // right icon type
                     *  // 0 & 1 = right text, no icon.
                     *  // 2 = icon (variation 1)
                     *  // 3 = crew label(?) (broken, always "undef" as crew text)
                     *  // 4 bordered rows, no icon.
                     *  // 5 no right text.
                     *  // >= 6 no icons, just left/right text.
                     *
                     *
                     *  PushScaleformMovieMethodParameterString("hello"); // right icon string or unused? 99% sure it's the latter.
                     *  PushScaleformMovieMethodParameterBool(false); // row isSelectable / false
                     *
                     *  PushScaleformMovieMethodParameterString(leftText[x]); // left text
                     *  PushScaleformMovieMethodParameterString(rightText[x]); // right text
                     *
                     *  if (x != 4)
                     *  {
                     *      PushScaleformMovieMethodParameterString("..+SUMO"); // (right icon variation) crew label text (if icon type is 3).
                     *                                                          // will switch to an int (see below) when icon type 2 is used.
                     *      PushScaleformMovieMethodParameterInt((int)HudColors.HudColor.HUD_COLOUR_BLUE); // color (hud color)
                     *      PushScaleformMovieMethodParameterBool(false); // checkmarked.
                     *  }
                     *  else
                     *  {
                     *      PushScaleformMovieMethodParameterString("0");
                     *      PushScaleformMovieMethodParameterInt((int)HudColors.HudColor.HUD_COLOUR_BLUE); // color (hud color)
                     *      PushScaleformMovieMethodParameterBool(false); // checkmarked.
                     *      // only uncomment this ↓ if the above string is commented out ↑
                     *      //PushScaleformMovieMethodParameterInt(0); // right icon variation?! (only used when int above (icon type) is 2.
                     *      // 0 = star / mission.
                     *      // 1 = skull / deathmatch / rampage.
                     *      // 2 = flag / race.
                     *      // 3 = shield / ?.
                     *      // 4 = multiple skulls / ?.
                     *      // >=5 = no icon.
                     *  }
                     *  //PushScaleformMovieMethodParameterString("voltic2"); // ?
                     *  //PushScaleformMovieMethodParameterString("candc_importexport"); // ?
                     *
                     *
                     *
                     *  ///// FINISH.
                     *  EndScaleformMovieMethod();
                     #endregion
                     * }
                     */
                    SetColumnInfoRow(0, "Rating", "100.00%", false);
                    SetColumnInfoRow(1, "Created By", "Vespura", false);
                    SetColumnInfoRow(2, "Snail", "~g~YES", false);
                    SetColumnInfoRow(3, "Max Players", "32", false);
                    SetColumnInfoRow(4, "Type", "Sumo", 0, HudColors.HudColor.HUD_COLOUR_BLUE, false);


                    //PushScaleformMovieFunctionN("BUILD_MENU_GFX_FILES");
                    ////PushScaleformMovieMethodParameterString("");
                    ////PushScaleformMovieMethodParameterString("");
                    //PushScaleformMovieMethodParameterInt(1);
                    //PushScaleformMovieMethodParameterString("candc_importexport/voltic2");
                    //PushScaleformMovieMethodParameterString("candc_importexport");
                    //EndScaleformMovieMethod();

                    // Show the column.
                    PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                    PushScaleformMovieMethodParameterInt(1);
                    EndScaleformMovieMethod();

                    ////////////////////////////////////////////////////////////////////////////////////////////
                    #endregion

                    #region Players column setup
                    ////////////////////////////////////////////////////////////////////////////////////////////
                    //                          PLAYERS ROWS SETUP (COLUMN 3) HERE                            //
                    ////////////////////////////////////////////////////////////////////////////////////////////
                    var rowindex = 0;
                    foreach (Player p in new PlayerList())
                    {
                        // Add the player.
                        SetColumnPlayerRow(rowindex + 0, p.Name, 420, (HudColors.HudColor)p.Handle + 28, false, 115, "SUMO", false, "LOADING", HudColors.HudColor.HUD_COLOUR_RED);
                        SetColumnPlayerRow(rowindex + 1, p.Name, 420, (HudColors.HudColor)p.Handle + 28, false, 116, "SUMO", true, "KICKED", HudColors.HudColor.HUD_COLOUR_ORANGE);
                        SetColumnPlayerRow(rowindex + 2, p.Name, 420, (HudColors.HudColor)p.Handle + 28, false, 117, "SUMO", false, "JOINED", HudColors.HudColor.HUD_COLOUR_GREEN);
                        SetColumnPlayerRow(rowindex + 3, p.Name, 420, (HudColors.HudColor)p.Handle + 28, false, 118, "SUMO", false, "SNAILSOME", HudColors.HudColor.HUD_COLOUR_ADVERSARY);
                        SetColumnPlayerRow(rowindex + 4, p.Name, 420, (HudColors.HudColor)p.Handle + 28, false, 119, "SUMO", false, "", HudColors.HudColor.HUD_COLOUR_ADVERSARY);
                        SetColumnPlayerRow(rowindex + 5, p.Name, 420, (HudColors.HudColor)p.Handle + 28, false, 120, "SUMO", false, "SPECTATOR", HudColors.HudColor.HUD_COLOUR_GREY);
                        rowindex++;
                        #region old messy code

                        /*
                         * ///// COLUMN 0 (LEFT) - ROW 0
                         * PushScaleformMovieFunctionN("SET_DATA_SLOT");
                         * PushScaleformMovieMethodParameterInt(3); // column
                         * PushScaleformMovieMethodParameterInt(rowindex); // index
                         *
                         * //// com.rockstargames.gtav.pauseMenu.pauseMenuItems.PauseMenuBaseItem::__set__data
                         * //PushScaleformMovieMethodParameterInt(0); // menu ID 0
                         * //PushScaleformMovieMethodParameterInt(0); // unique ID 0
                         * //PushScaleformMovieMethodParameterInt(0); // type 0 (TYPE_MAIN_CHAR_SELECTOR)
                         * //PushScaleformMovieMethodParameterInt(0); // initialIndex 1337 (rank)
                         * //PushScaleformMovieMethodParameterBool(true); // isSelectable true
                         *
                         * /////// ITEM/ROW TITLE.
                         * //BeginTextCommandScaleformString("STRING");
                         * //AddTextComponentSubstringPlayerName(GetPlayerName(PlayerId()) + " " + x);
                         * //EndTextCommandScaleformString();
                         *
                         * /////// UNSURE HOW THIS WORKS, BUT IF YOU UNCOMMENT THIS, IT'LL ADD AN ICON TO THE ROW.
                         * /////// MAKING THE STRING "20" AND THE BOOL TRUE SEEMS TO DO SOMETHING WITH A ROCKSTAR LOGO INSTEAD.
                         * //BeginTextCommandScaleformString("STRING");
                         * //AddTextComponentSubstringPlayerName("");
                         * //EndTextCommandScaleformString();
                         * //PushScaleformMovieMethodParameterBool(true); // SOMETHING WITH ROCKSTAR/STAR LOGO SWITCHING.
                         *
                         * /////// FINISH.
                         * //EndScaleformMovieMethod();
                         * // com.rockstargames.gtav.pauseMenu.pauseMenuItems.PauseMenuBaseItem::__set__data
                         * PushScaleformMovieMethodParameterInt(0); // menu ID 0
                         * PushScaleformMovieMethodParameterInt(0); // unique ID 0
                         * PushScaleformMovieMethodParameterInt(2); // type 2 (AS_ONLINE_IN_SESSION)
                         * PushScaleformMovieMethodParameterInt(120); // initialIndex 1337 (rank)
                         * PushScaleformMovieMethodParameterBool(false); // isSelectable true
                         *
                         * // data, see com.rockstargames.gtav.pauseMenu.pauseMenuItems.multiplayer.PauseMPMenuFriendsListItem
                         * BeginTextCommandScaleformString("STRING");
                         * AddTextComponentSubstringPlayerName(p.Name);
                         * EndTextCommandScaleformString();
                         *
                         * PushScaleformMovieMethodParameterInt(28 + p.Handle); // row color / 134
                         *
                         * PushScaleformMovieMethodParameterBool(false); // if true, removes color from left bar & reduces color opacity on row itself.
                         *                                              // False colors everything.
                         *
                         * PushScaleformMovieMethodParameterString("0"); // unused / 0
                         *
                         * PushScaleformMovieMethodParameterInt(65); // 66 EYE // 65 RANK_FREEMODE // 64 BOOT(KICK) // 63 GLOBE // <= 62 || >= 67 EMPTY
                         *
                         * PushScaleformMovieMethodParameterString("0"); // unused / 0
                         *
                         * if (NetworkIsHost())
                         * {
                         *  PushScaleformMovieMethodParameterString("..+SUMO"); // maybe show host?
                         * }
                         * else
                         * {
                         *  PushScaleformMovieMethodParameterString("..+SUMO"); // show something else here?
                         * }
                         *
                         *
                         * PushScaleformMovieMethodParameterBool(false); // '(boot) kick blinking'
                         *
                         * var state = "LOADING";
                         * if (state == "JOINED")
                         * {
                         *  BeginTextCommandScaleformString("STRING");
                         *  AddTextComponentSubstringPlayerName(state); // BADGE
                         *  EndTextCommandScaleformString();
                         *  PushScaleformMovieMethodParameterInt((int)HudColors.HudColor.HUD_COLOUR_HB_BLUE); // COLOR OF BADGE // HUD_COLORS // BLUE / JOINED
                         * }
                         * else if (state == "LOADING")
                         * {
                         *  BeginTextCommandScaleformString("STRING");
                         *  AddTextComponentSubstringPlayerName(state); // BADGE
                         *  EndTextCommandScaleformString();
                         *  PushScaleformMovieMethodParameterInt((int)HudColors.HudColor.HUD_COLOUR_RED); // COLOR OF BADGE // HUD_COLORS // RED / LOADING
                         * }
                         * else if (state == "READY")
                         * {
                         *  BeginTextCommandScaleformString("STRING");
                         *  AddTextComponentSubstringPlayerName(state); // BADGE
                         *  EndTextCommandScaleformString();
                         *  PushScaleformMovieMethodParameterInt((int)HudColors.HudColor.HUD_COLOUR_GREEN); // COLOR OF BADGE // HUD_COLORS // READY / GREEN
                         * }
                         *
                         * // statusStr
                         * // statusColID
                         *
                         * PopScaleformMovieFunctionVoid();
                         * rowindex++;
                         */
                        #endregion
                    }
                    // Show the column.
                    PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                    PushScaleformMovieMethodParameterInt(3);
                    EndScaleformMovieMethod();

                    ////////////////////////////////////////////////////////////////////////////////////////////
                    #endregion

                    #region Menu focus setup
                    ///// ACTIVATE THE FIRST COLUMN (FOCUS).
                    PushScaleformMovieFunctionN("SET_COLUMN_FOCUS");
                    PushScaleformMovieMethodParameterInt(0); // column index // _loc7_
                    PushScaleformMovieMethodParameterInt(1); // highlightIndex // _loc6_
                    PushScaleformMovieMethodParameterInt(1); // scriptSetUniqID // _loc4_
                    PushScaleformMovieMethodParameterInt(0); // scriptSetMenuState // _loc5_
                    EndScaleformMovieMethod();
                    #endregion

                    ////////////////////////////////////////////////////////////////////////////////////////////
                }
            }
        }
Пример #2
0
 public async void Intro()
 {
     await Gfx.ShowIntroScaleform();
 }