iFruit Cell Script

using GTA;
using System;
using iFruitAddon2;
using GTA.Math;



namespace CellPhoneExample
{
    public partial class Basics : Script
    {
        private CustomiFruit phone = new CustomiFruit();               
        public Ped PP = Game.Player.Character;
                
        public Basics()
        {
        
            iFruitContact iFruitContact1 = new iFruitContact("Spawn Tracey");
            iFruitContact1.Answered += new ContactAnsweredEvent(SpawnTracey);
            iFruitContact1.DialTimeout = 300;
            iFruitContact1.Active = true;
            iFruitContact1.Icon = ContactIcon.Tracey;
            phone.Contacts.Add(iFruitContact1);

            iFruitContact iFruitContact2 = new iFruitContact("Spawn Adder");
            iFruitContact2.Answered += new ContactAnsweredEvent(SpawnAdder);
            iFruitContact2.DialTimeout = 600;
            iFruitContact2.Active = true;
            iFruitContact2.Icon = ContactIcon.Property_CarModShop;
            phone.Contacts.Add(iFruitContact2);

            // order they will appear in the phone is same as order above                 
            Tick += Basics_Tick;
        }

        private void SpawnAdder(iFruitContact sender)
        {
            phone.Close();           
            Vehicle Vehicle2 = World.CreateVehicle(VehicleHash.Adder, Game.Player.Character.GetOffsetPosition(new Vector3(0, 3, 0)));           
           
        }

        private void SpawnTracey(iFruitContact sender)
        {
            phone.Close();
            Ped CurrentPed = World.CreatePed(PedHash.TracyDisanto, Game.Player.Character.Position.Around(2f));
        }


        private void Basics_Tick(object sender, EventArgs e)
        {
            phone.Update();
        }

    }
}
                

Display Message with Scaled Fonts

using GTA;
using GTA.Native;


public class MyMod : Script
{
    float TextScale; //multiplier of font size
    float TextX; // Horizontal pos on screen, 0 left to 1 right
    float TextY; // Vertical pos from top, 0 top to 1 bottom      

    public MyMod()
    {
        Tick += OnTick;
    }

    private void OnTick(object sender, System.EventArgs e)
    {
     ShowScaledMsg();
    }
		
    private void ShowScaledMsg()
    {     
        TextScale = .6f; //used as a multiplier of font size
        TextX = .5f; // Horizontal pos on the screen, 0 left to 1 right
        TextY = .5f; // Vertical position from top, 0 top to 1 bottom

        string MsgDetails = "~b~This is your scaled font message.\nThis is the simple method for beginners.";
                
        Function.Call(Hash.SET_TEXT_SCALE, TextScale, TextScale); //both values for x, start and end points
        Function.Call(Hash.SET_TEXT_FONT, 4); // see description below
        Function.Call(Hash.SET_TEXT_PROPORTIONAL, 1);
        Function.Call(Hash.SET_TEXT_WRAP, 0.0f, 1.0f);
        Function.Call(Hash.SET_TEXT_COLOUR, 255, 255, 255, 255);
        Function.Call(Hash.BEGIN_TEXT_COMMAND_DISPLAY_TEXT, "STRING");
        Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, MsgDetails);
        Function.Call(Hash.END_TEXT_COMMAND_DISPLAY_TEXT, TextX, TextY);
    }

}
                

MP3 Audio with NAudio Libraries

using GTA;
using System;
using NAudio.Wave;
using System.Windows.Forms;

namespace VoiceNameSpace
{
    public class Basic : Script
    {
        private AudioFileReader audioFile;
        private WaveOutEvent outputDevice;

        public Basic()
        {
            
            KeyDown += OnKeyDown;
            
        }

        public void PlayPedTheme(object sender, EventArgs e)
        {
            outputDevice = new WaveOutEvent();
            outputDevice.Init(audioFile);
            outputDevice.Play();
        }

        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.T)
            {
                //substitute path to your mp3 below
				audioFile = new AudioFileReader("./scripts/TotalControl/Lara.mp3");
                PlayPedTheme(sender, e);
            }
        }
    }
}

Speech with Native Dialog

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using GTA;
using GTA.Native;

// Only works with wommen (you can modify), can be addon or ambient peds. You need to get close to them.

namespace Speech
{
    public class Main : Script
    {
        private static readonly Random _randomGenerator = new Random();

        public static Ped _closestPedToPlayer { get; set; }

        public Main()
        {
            base.KeyDown += OnKeyDown;  
        }

        public static int GenerateRandomNumberInRange(int min, int max)
        {
            return _randomGenerator.Next(min, max);
        }

        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.L)
            {
                Ped[] nearbyPeds = World.GetNearbyPeds(Game.Player.Character, 10f);

                if (nearbyPeds.Length > 0)
                {
                    _closestPedToPlayer = nearbyPeds[0];

                    if (_closestPedToPlayer.Exists() && _closestPedToPlayer != Game.Player.Character && _closestPedToPlayer.IsAlive &&
                        Function.Call(Hash.GET_PED_TYPE, _closestPedToPlayer) == 5) // 5 represents female civil pedestrians
                    {
                        List availableVoiceNames = new List
                        {
                            "S_F_Y_BAYWATCH_01_WHITE_FULL_01",
                            "s_f_y_hooker_01_white_full_01",
                            "s_f_y_hooker_01_white_full_02"
                        };

                        Function.Call(Hash.SET_AMBIENT_VOICE_NAME, _closestPedToPlayer, availableVoiceNames[GenerateRandomNumberInRange(0, availableVoiceNames.Count)]);

                        string[] availableSpeechOptions =
                        {
                            "GENERIC_HOWS_IT_GOING",
                            "CHAT_ACROSS_STREET_RESP",
                            "GENERIC_SHOCKED_MED",
                            "GENERIC_CURSE_MED",
                            "GENERIC_WHATEVER",
                            "GENERIC_THANKS",
                            "HOOKER_CHAT_SOLO",
                            "AGREE_ACROSS_STREET"
                        };

                        string selectedSpeechOption = availableSpeechOptions[_randomGenerator.Next(0, availableSpeechOptions.Length)];

                        Function.Call(Hash.PLAY_PED_AMBIENT_SPEECH_NATIVE, _closestPedToPlayer, selectedSpeechOption, "SPEECH_PARAMS_FORCE");
                    }
                }
            }
        }
    } 
}.

Speech Synthesis

using GTA;
using System.Speech.Synthesis;
using System.Windows.Forms;

namespace YourNameSpace
{
    public class SpeechSynthesis : Script
    {
        public SpeechSynthesis()
        {
            KeyDown += OnKeyDown;
        }

        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.L)
            {
                // if possible, change the Default Voice in Windows to one that sounds less robotic
                // will crash if your Windows Default doesn't match one below, which is female in this case

                SpeechSynthesizer synth = new SpeechSynthesizer();
                synth.Volume = 100;
                synth.SetOutputToDefaultAudioDevice();
                synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.NotSet);

                string SpeechString =
                    "Hello User. You can use this for Help, as an example. From a menu or a keybind. " +
                    "You could explain how to use your script, which keybinds etc., " +
                    "This is a quick and dirty solution. A better solution is to use mp3 files, " +                    
                    "although they need to be added to your mod and placed in a folder.";

                synth.SpeakAsync(SpeechString);
            }
        }
    }
}

Voice Speech Recognition

using GTA;
using GTA.Native;
using System;
using System.Speech.Recognition;
using System.Speech.Recognition.SrgsGrammar;
using System.Windows.Forms;

namespace VoiceNameSpace
{
    public class VoiceCommandController : Script
    {
        private static Ped playerPed = Game.Player.Character;
        private static bool isVoiceRecognitionEnabled = true;
    //  private static bool isVoiceListenerActive; //for further customization
     // private static bool areVoiceCommandsEnabled = true;  //for further customization
        public Ped PP = Game.Player.Character;

        private SpeechRecognitionEngine speechRecognizer;
        private SrgsDocument speechGrammar;
        private SrgsRule commandRule;
        private SrgsOneOf commandList;

        private short currentCommandIndex = -1;

        public VoiceCommandController()
        {
            InitializeVoiceRecognition();
            Tick += OnTick;
            KeyDown += OnKeyDown;
            GTA.UI.Screen.ShowSubtitle("~g~Press the T key to enable voice recogntion\n\n\n\n\n", 5000);
        }

        private void InitializeVoiceRecognition()
        {
            speechRecognizer = new SpeechRecognitionEngine();
            speechRecognizer.SetInputToDefaultAudioDevice();

            commandRule = new SrgsRule("command");
            commandList = new SrgsOneOf("Airport", "Spawn Franklin", "Spawn Boxville");
            commandRule.Add(commandList);

            speechGrammar = new SrgsDocument();
            speechGrammar.Rules.Add(commandRule);
            speechGrammar.Root = commandRule;

            speechRecognizer.LoadGrammar(new Grammar(speechGrammar));
            speechRecognizer.RecognizeAsync();

            speechRecognizer.RecognizeCompleted += OnRecognizeCompleted;
            speechRecognizer.SpeechRecognized += OnSpeechRecognized;
        }

        private void OnRecognizeCompleted(object sender, RecognizeCompletedEventArgs e)
        {
            if (isVoiceRecognitionEnabled)
            {
                speechRecognizer.RecognizeAsync();
            }
        }

        private void OnSpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            if (isVoiceRecognitionEnabled)
            {
                switch (e.Result.Text)
                {
                    case "Airport":
                        currentCommandIndex = 0;
                        break;
                    case "Spawn Franklin":
                        currentCommandIndex = 1;
                        break;
                    case "Spawn Boxville":
                        currentCommandIndex = 2;
                        break;
                }
            }
        }

        private void OnTick(object sender, EventArgs e)
        {
            if (isVoiceRecognitionEnabled)
            {
                HandleVoiceCommands();
            }
        }

        private void HandleVoiceCommands()
        {
            switch (currentCommandIndex)
            {
                case 0:
                    Function.Call(Hash.SET_ENTITY_COORDS_NO_OFFSET, Game.Player.Character, -1022.7, -2702.2, 13.8, 0, 0, 1);
                    break;
                case 1:
                   Ped MyPed = World.CreatePed("player_one", PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);
                    break;
                case 2:
                    Vehicle adderVehicle = World.CreateVehicle(VehicleHash.Boxville, playerPed.Position + playerPed.ForwardVector * 2.0f, playerPed.Heading + 90);
                    break;
            }

            // Reset command index after processing
            currentCommandIndex = -1;
        }

        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.T)
            {
                GTA.UI.Screen.ShowSubtitle("~g~You have enabled voice recogntion\n~b~Voice Commands are:\nAirport\nSpawn Franklin\nSpawn Boxville\n\n\n", 5000);
                isVoiceRecognitionEnabled = true;
            }
        }
    }
}

Instructional Buttons

using System;
using System.Windows.Forms; // For Keys
using GTA;
using GTA.Math;
using GTA.Native;

namespace InstructButtons
{
    internal class Main : Script
    {
        private static Scaleform scaleform;
        private static bool isHudVisible = false; // Control variable for HUD visibility
        private static Ped PP = Game.Player.Character;
        private static PedGroup PlayerGroup;

        public Main()
        {
            Tick += OnTick;
            KeyDown += OnKeyDown;
           
        }

        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.H)
            {
                InitializeScaleform(); // Leave this here, tick behaviour causes issues requiring restart
                ToggleHudVisibility(); // Toggle HUD visibility

            }
        }

        private void OnTick(object sender, EventArgs e)
        {
            if (isHudVisible)
            {
                RenderHud(); // Render the HUD if visible
                HandleControls(); // Check for control inputs
            }
        }

        private static void InitializeScaleform()
        {
            scaleform = new Scaleform("instructional_buttons");
            scaleform.CallFunction("CLEAR_ALL");
            scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);

            // Define control instructions with associated descriptions
            SetControlInstruction(GTA.Control.VehicleHeadlight, "HUD", 6);
            SetControlInstruction(GTA.Control.VehicleFlyUnderCarriage, "Teleport", 5);
            SetControlInstruction(GTA.Control.ReplayShowhotkey, "Spawn Franklin", 4);
            SetControlInstruction(GTA.Control.Jump, "Spawn Adder", 3);
            SetControlInstruction(GTA.Control.AccurateAim, "Option 1", 2);
            SetControlInstruction(GTA.Control.AccurateAim, "Option 2", 1);
        }

        private static void SetControlInstruction(GTA.Control control, string description, int slot)
        {
            string buttonText = Function.Call(Hash.GET_CONTROL_INSTRUCTIONAL_BUTTONS_STRING, 2, control, 0);
            scaleform.CallFunction("SET_DATA_SLOT", slot, buttonText, description);
        }

        private void ToggleHudVisibility()
        {
            isHudVisible = !isHudVisible; // Toggle HUD visibility
        }

        private void RenderHud()
        {
            scaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            scaleform.Render2D();
        }

        private void HandleControls()
        {
            if (Game.IsControlJustPressed(GTA.Control.Jump))
            {
                SpawnVehicle();
            }
            else if (Game.IsControlJustPressed(GTA.Control.ReplayShowhotkey))
            {
                SpawnFranklin();
            }
            else if (Game.IsControlJustPressed(GTA.Control.VehicleFlyUnderCarriage))
            {
                GoTo_Airport();
            }
           

        }

        private static void SpawnVehicle()
        {
            Vector3 spawnPosition = PP.Position + new Vector3(0, 4, 0);
            World.CreateVehicle("ADDER", spawnPosition);
            isHudVisible = false; // Hide HUD after vehicle spawn
        }

        private static void SpawnFranklin()
        {
            Vector3 spawnPosition = PP.Position + PP.ForwardVector * 5f;
            Ped Franklin = World.CreatePed(PedHash.Franklin, spawnPosition, PP.Heading + 90);
            PlayerGroup = PP.PedGroup;
            Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Franklin, PlayerGroup);
            Franklin.IsPersistent = true; // leave both lines for consistency
            Function.Call(Hash.SET_PED_NEVER_LEAVES_GROUP, Franklin, true);
            isHudVisible = false; // Hide HUD after spawning Franklin
        }

        private void GoTo_Airport()
        {
            Function.Call(Hash.SET_ENTITY_COORDS_NO_OFFSET, Game.Player.Character, -1336.23, -3044.23, 13.94, 0, 0, 1);
        }


    }
}

Coming Soon 8

Content for Script 8 goes here.

Coming Soon 9

Content for Script 9 goes here.

Coming Soon 10

Content for Script 10 goes here.

Coming Soon 11

Content for Script 11 goes here.

Coming Soon 12

Content for Script 12 goes here.