Log in to reply

Script not functioning correctly

  • Script not functioning crrectly, basically certain keys do stuff,
    Num7: Activates player invincibility (this needs to be changed cuz its the home button)
    num 6: deactivates invincibility
    num 9: cash stuff

    None of these work for some reason and I can't find an issue, no issue occurs in the log

    using System;
    using System.Windows.Forms;
    using GTA;
    using GTA.Native;
    using GTA.Math;
    namespace grandUtils //Your Mod Name Here
        public class Main : Script
            public Main()
                Tick += onTick;
                KeyDown += onKeyDown;
            private void onTick(object sender, EventArgs e)
            private void onKeyDown(object sender, KeyEventArgs e)
                if(e.KeyCode == Keys.NumPad7)
                    UI.Notify("Invincibility: On");
                    Game.Player.IsInvincible = true;
                if(e.KeyCode == Keys.NumPad6)
                    UI.Notify("Invinciblity: Off");
                    Game.Player.IsInvincible = false;
                if(e.KeyCode == Keys.NumPad9)
                    UI.Notify("Activated Cash");
                    Game.Player.Money = 2000000000;
                if(e.KeyCode == Keys.NumPad0)
                    UI.ShowHelpMessage("Numpad 7: Invinc on, Numpad 6: Invinc off, Numpad 9: 2B dollars");

  • @LuckyMunch

    Did you compile this or just put it as a cs file.
    Did you add the proper reference to SHVDN.
    Strongly encourage you to use SHVDN 3 and forget about 2.
    With 3 use
    GTA.UI.Notification.Show and GTA.UI.Screen.ShowHelpText

  • I clicked build > build solutions
    I added SCHVDN2.dll reference, forms, and drawing
    What advantage does v3 have over v2?
    also is there a doc for this?

  • @LuckyMunch
    Was the build successful or did you have errors?

    Did you set the .NET Framework version to 4.8

    Where did you place the dll after your build? Did you move it to your GTA5 scripts folder? You can add that path to the post processing.

    Is your numlock on?

    Do you have the Scripthookvdotnet asi and dlls properly installed in the game folder?

    Scripthookvdotnet 2 is no longer supported for development so no reason to use other than for legacy.

  • @LuckyMunch check if you have ScriptHookV.asi , ScriptHookDoNet2 and 3 in your root folder place your mod in scripts folder

    I think player invincible should be in Ontick so each second or millisecond the script will run the player will stay invincible
    I switched from SHVDN2 to SHVDN3 thank to @JohnFromGWN .

    SHVDN3 is confortable, frequently updated

  • @MikeBoma said in Script not functioning correctly:

    I think player invincible should be in Ontick

    Not necessary Mike, once set at spawn or on keypress the player or NPC remains invincible. I spawn all my peds this way.

    Similarly I use a keypress to remove the invincibility.

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.