Log in to reply
 

ScripthookV not detecting script



  • Title, ScripthookV(DOtNet) both load correctly, but my mod doesnt, I currently write in C#, compile to .dll and rename to .asi

    Any reasons/fixes woud be wonderful, TY!



  • @Arago_

    I could think of a hundred or so, but you haven't provided anything that could be helpful other than script not detected, which in itself is confusing. Post your code and describe your setup, IDE or standalone compiler, libraries and references.

    I think you mean SHVDN isn't detecting your script, because SH5 has other things to deal with.



  • Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using GTA;
    using GTA.Math;
    using System.Windows.Forms;
    using System.Drawing;

    namespace GTAmod__test
    {
    public class CarFly : Script
    {
    public CarFly()
    {
    this.Tick += onTick;
    this.KeyUp += onKeyUp;
    this.KeyDown -= onKeyDown;
    }

        private void onTick(object sender, EventArgs e)
        {
            World.CreateRandomVehicle(Game.Player.Character.Position);
        }
    
        private void onKeyUp(object sender, KeyEventArgs e)
        {
    
        }
    
        private void onKeyDown(object sender, KeyEventArgs e)
        {
            World.CreateRandomVehicle(Game.Player.Character.Position);
            if (e.KeyCode == Keys.NumPad1)
            {
                Vehicle[] vs = World.GetAllVehicles();
    
                foreach (Vehicle v in vs)
                {
                    if (v.Driver != Game.Player.Character)
                    {
                        v.ApplyForce(new Vector3(0, 20, 0));
                    }
                }
            }
        }
    }
    

    }

    Setup:
    VS 2022 with built in compiler, updated scripthook yesterday, GTA via steam

    Sorry i'm late, I need to wait 10 mins between posting



  • @Arago_

    1. Do you have SHVDN properly installed in your root folder?
    2. After compilation did you check to see if your dll is in the scripts folder? In other words is your post processing configured for that folder, or did you manually place the dll there, or did you forget and it's sitting in a VS folder?
    3. If you compiled as an asi, did you install it in the game folder, the root folder?
    4. Did you get a successful build message?
    5. Did you check the SHVDN log file?

    Just curious, do you really need all those references?



    1. Should be, see SS below
    2. I manualy place it in the Gta Folder\scripts
    3. Yes, see SS below
    4. Yes, nothing weird in there, see below:
      // GTA V SCRIPT HOOK (build Dec 18 2022, v1.0.2802.0)
      // (C) Alexander Blade 2015-2022
      [16:07:41] INIT: Started
      [16:07:41] INIT: Success, game version is VER_1_0_2802_0
      [16:07:41] INIT: Registering script 'NativeTrainer.asi' (0x00007FF84AF3A3C0)
      [16:07:41] INIT: Registering script 'ScriptHookVDotNet.asi' (0x00007FF84AEB1480)
      [16:08:03] INIT: Pool 1 extended
      [16:08:03] INIT: Pool 2 extended
      [16:08:03] INIT: Pool 3 extended
      [16:08:03] INIT: Pool 4 extended
      [16:08:08] INIT: GtaThread collection size 189
      [16:08:08] INIT: wnd proc 0x00000000FFFF074D
      [16:08:08] INIT: IDXGISwapChain 0x00007FF8746E2F20 (0x00007FF874673790)
      [16:08:08] INIT: IDXGISwapChain set
      [16:08:08] INIT: DX init started
      [16:08:08] INIT: DX feature level B000
      [16:08:08] INIT: DX init succeeded
      [16:09:45] CORE: Requesting thread creation
      [16:09:45] CORE: Creating threads
      [16:09:45] CORE: Started control thread, id 32 active 1
      [16:09:45] CORE: Started thread 'NativeTrainer.asi' (0x00007FF84AF3A3C0), id 33 active 1
      [16:09:45] CORE: Started thread 'ScriptHookVDotNet.asi' (0x00007FF84AEB1480), id 34 active 1
      [16:09:45] CORE: Launching main() for 'NativeTrainer.asi' (0x00007FF84AF3A3C0), id 33
      [16:09:45] CORE: Launching main() for 'ScriptHookVDotNet.asi' (0x00007FF84AEB1480), id 34

    images:
    https://ibb.co/bzj8Mkw
    https://ibb.co/4s9DxMt
    https://ibb.co/N9jFq6j



  • @Arago_

    Looks good, but the log you want is ScriptHookVDotNet.log, not the SH5 one. It will tell you if your script is loading.

    Dumb question, but you do have a proper .dll extension for your script, or .cs for SHVDN2, or .3.cs for SHVDN3.

    And now a really dumb question, you do have Num Lock on?

    From your screenshots, everything looks good.

    If the ScriptHookVDotNet.log shows loading is successful, then it is your code that has a logic error (still allowing it to compile), or possibly numpad1 is assigned to another script?

    P.S. Edit, if that's your complete code, I don't see why you need references below. I'm just a hack, not a professional programmer, but your code looks fine.

    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Drawing
    


  • [18:23:55] [DEBUG] Loading API from .\ScriptHookVDotNet2.dll ...
    [18:23:55] [DEBUG] Loading API from .\ScriptHookVDotNet3.dll ...
    [18:23:55] [DEBUG] Loading scripts from D:\SteamLibrary\steamapps\common\Grand Theft Auto V\scripts ...

    It doesnt seem to pick it up, also, im using an .asi file, is that correct?

    Tried both with numlock on and off



  • @Arago_

    I have never compiled an asi, so I can't comment other than that it is loaded by dinput8.dll.

    If your file is an asi, then it should be in the root folder, NOT the scripts folder.

    Strongly suggest you test with a .dll in your scripts folder, or move your asi to the proper folder (game folder).

    Don't know why you would want a asi for your particular script unless you want to make your code hard or impossible to decompile.



  • @Arago_

    P.S. With an asi, correctly compiled and installed in the game/root folder, it is asiloader.log that you need to check.



  • ohh, ok , ty, ill try with a .dll in \scripts



  • It loads the script now, TY, but somehow the script is not working, after som fiddeling around I think my functions are now being called, could you now why?

    @JohnFromGWN



  • somehow, I did -= instead of +=, its fixed now, TY



  • @Arago_ Good catch.


Log in to reply
 

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