Back to Main Page


From time to time I might add a small script here that does something pointlesss or insignificant.

Take it, change it, use it as you wish, just credit the source if you're a decent enough person to actually credit your sources if you use it in a mod.

There won't be more of these pages, the content of this page will change.

 

Free Script - Something for nothing that probably does nothing


This is a simple mod that is designed to alert you to the fact that you have mods installed.

Why is this a thing? Well it's because I keep forgetting to disable the mods in the version of the game I use when I go online. I am old, I forget things and this is just a simple reminder. Much better than keep trying to go online and getting warned about using a modified version of the game. I don't know if that has a number of warnings before it just bans you, so this is just a failsafe.

Use or don't use, it's your choice.

using System;
using System.Drawing;

using GTA;
using Font = GTA.Font;

namespace ModWarning
{
    public class cModWarning : Script
    {
        private int LastGameTime;

        int WarningTimer;
        int FlashTimer;
        bool WaringTextShow = true;
        UIText WarningText;

        public cModWarning()
        {
            Tick += onTick;
            Interval = 0;
            Initialise();
        }

        private void Initialise()
        {
            WarningTimer = 10000; // runs for 10 seconds
            FlashTimer = 1500;
            WarningText = new UIText("~r~WARNING~n~~s~THERE ARE MODS INSTALLED!!~n~DO NOT GO ONLINE", new Point(UI.WIDTH / 2, (UI.HEIGHT / 2) - 50), 1f, Color.White, Font.Pricedown, true);
            WarningText.Outline = true;

            LastGameTime = Game.GameTime;
        }

        private void onTick(object sender, EventArgs e)
        {
            // Exits from the loop if the game is loading
            if (Game.IsLoading) return;

            int currentGameTime = Game.GameTime;
            int elapsedGameTime = currentGameTime - LastGameTime;
            LastGameTime = currentGameTime;

            // Keep doing this until the warning timer runs out
            if (WarningTimer > 0)
            {
                WarningTimer -= elapsedGameTime;
                FlashTimer -= elapsedGameTime;

                // If the flash timer runs out, toggle the warning text
                if (FlashTimer < 0)
                {
                    WaringTextShow = !WaringTextShow;

                    if (WaringTextShow)
                    {
                        WarningText.Caption = "~r~WARNING~n~~s~THERE ARE MODS INSTALLED!~n~DO NOT GO ONLINE!!";
                        FlashTimer = 1500;
                    }
                    else
                    {
                        WarningText.Caption = "      ~n~~s~THERE ARE MODS INSTALLED!~n~DO NOT GO ONLINE!!";
                        FlashTimer = 500;
                    }
                }

                WarningText.Draw();
            }
        }
    }
}