Log in to reply
 

Problem loading own script.



  • I just wanted to make my own script for gta v. I did everything the same like in the tuturial video but I get an errorf in script hook v dot net console.

    Script Hook Dot Net Log file:
    [16:34:45] [DEBUG] Loading API from .\ScriptHookVDotNet2.dll ...
    [16:34:45] [DEBUG] Loading API from .\ScriptHookVDotNet3.dll ...
    [16:34:45] [DEBUG] Loading scripts from D:\Rockstar Games\Grand Theft Auto V\scripts ...
    [16:34:45] [DEBUG] Loading assembly CarDealership.dll ...
    [16:34:45] [INFO] Found 1 script(s) in CarDealership.dll resolved to API 2.11.0.
    [16:34:45] [DEBUG] Loading assembly NativeUI.dll ...
    [16:34:45] [INFO] Found 1 script(s) in NativeUI.dll resolved to API 2.11.0.
    [16:34:45] [DEBUG] Loading assembly System.Windows.Forms.dll ...
    [16:34:45] [INFO] Found 0 script(s) in System.Windows.Forms.dll.
    [16:34:45] [DEBUG] Loading assembly CarDealership.dll ...
    [16:34:45] [ERROR] Unable to load CarDealership.dll: System.BadImageFormatException: Could not load file or assembly 'file:///D:\Rockstar Games\Grand Theft Auto V\scripts\ref\CarDealership.dll' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
    File name: 'file:///D:\Rockstar Games\Grand Theft Auto V\scripts\ref\CarDealership.dll' ---> System.BadImageFormatException: Cannot load a reference assembly for execution.
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
    at System.Reflection.Assembly.LoadFrom(String assemblyFile)
    at SHVDN.ScriptDomain.LoadScriptsFromAssembly(String filename)

    [16:34:45] [DEBUG] Instantiating script CarDealership.Main ...
    [16:34:45] [ERROR] Failed to instantiate script CarDealership.Main because constructor threw an exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
    File name: 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    at CarDealership.Main..ctor()

    === Pre-bind state information ===
    LOG: DisplayName = System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
    (Fully-specified)
    LOG: Appbase = file:///D:/Rockstar Games/Grand Theft Auto V/scripts
    LOG: Initial PrivatePath = NULL
    Calling assembly : CarDealership, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

    LOG: This bind starts in default load context.
    LOG: No application configuration file found.
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
    LOG: Post-policy reference: System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
    LOG: Attempting download of new URL file:///D:/Rockstar Games/Grand Theft Auto V/scripts/System.Runtime.DLL.
    LOG: Attempting download of new URL file:///D:/Rockstar Games/Grand Theft Auto V/scripts/System.Runtime/System.Runtime.DLL.
    LOG: Attempting download of new URL file:///D:/Rockstar Games/Grand Theft Auto V/scripts/System.Runtime.EXE.
    LOG: Attempting download of new URL file:///D:/Rockstar Games/Grand Theft Auto V/scripts/System.Runtime/System.Runtime.EXE.

    [16:34:45] [DEBUG] Instantiating script NativeUI.BigMessageThread ...
    [16:34:45] [INFO] Started script NativeUI.BigMessageThread.

    Script Hook V log file:
    // GTA V SCRIPT HOOK (build Jul 23 2021, v1.0.2372.0)
    // (C) Alexander Blade 2015-2021
    [16:14:24] INIT: Started
    [16:14:24] INIT: Success, game version is VER_1_0_2372_0_NOSTEAM
    [16:14:24] INIT: Registering script 'Menyoo.asi' (0x00007FFD2E3EB300)
    [16:14:24] INIT: Registering additional script thread 'Menyoo.asi' (0x00007FFD2E3FB850)
    [16:14:24] INIT: Registering script 'ScriptHookVDotNet.asi' (0x00007FFD69CC1480)
    [16:14:30] INIT: Pool 1 extended
    [16:14:30] INIT: Pool 2 extended
    [16:14:30] INIT: Pool 3 extended
    [16:14:30] INIT: Pool 4 extended
    [16:14:36] INIT: GtaThread collection size 189
    [16:14:36] INIT: wnd proc 0x00000000FFFF0391
    [16:14:36] INIT: IDXGISwapChain 0x00007FFD888CC438 (0x00007FFD888359E0)
    [16:14:36] INIT: IDXGISwapChain set
    [16:14:36] INIT: DX init started
    [16:14:36] INIT: DX feature level B000
    [16:14:36] INIT: DX init succeeded
    [16:16:02] CORE: Requesting thread creation
    [16:16:02] CORE: Creating threads
    [16:16:04] CORE: Started control thread, id 37 active 1
    [16:16:04] CORE: Started thread 'Menyoo.asi' (0x00007FFD2E3EB300), id 38 active 1
    [16:16:04] CORE: Started thread 'Menyoo.asi' (0x00007FFD2E3FB850), id 39 active 1
    [16:16:04] CORE: Started thread 'ScriptHookVDotNet.asi' (0x00007FFD69CC1480), id 40 active 1
    [16:16:04] CORE: Launching main() for 'Menyoo.asi' (0x00007FFD2E3EB300), id 38
    [16:16:04] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\needle_orange.png', id 0
    [16:16:04] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\night_needle_orange.png', id 1
    [16:16:04] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\needle_red.png', id 2
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\night_needle_red.png', id 3
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_cyan2.png', id 4
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_green2.png', id 5
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_yellow2.png', id 6
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_orange2.png', id 7
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_purple2.png', id 8
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_pink2.png', id 9
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_cyan.png', id 10
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_green.png', id 11
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_yellow.png', id 12
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_orange.png', id 13
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_purple.png', id 14
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Speedo\bg_pink.png', id 15
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Clock\Default_face.png', id 16
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Clock\Default_handh.png', id 17
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Clock\Default_handm.png', id 18
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Clock\Frameless_face.png', id 19
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Clock\Frameless_handh.png', id 20
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\Clock\Frameless_handm.png', id 21
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\teleportToWaypointBoxKeyboard.png', id 22
    [16:16:05] CORE: Creating texture 'D:\Rockstar Games\Grand Theft Auto V\menyooStuff\Graphics\teleportToWaypointBoxGamepad.png', id 23
    [16:16:05] CORE: Launching main() for 'Menyoo.asi' (0x00007FFD2E3FB850), id 39
    [16:16:05] CORE: Launching main() for 'ScriptHookVDotNet.asi' (0x00007FFD69CC1480), id 40
    [16:35:07] UNINIT: Unregistering script 'ScriptHookVDotNet.asi'
    [16:35:07] UNINIT: Unregistering script 'Menyoo.asi'



  • Let's take a step back?
    What ide or compiler are you using? Visual Studio and C#?
    Are you using dot netframework 4.8 or higher?
    Did you get any compiler errors or warnings or just at runtime?
    What assemblies are you referencing, scripthookvdotnet 3, windows, external libraries. Sounds like you're referencing something incompatible or missing.
    You don’t need to put a scripthook log, not relevant.
    And what tutorial are you referencing?

    If you want post your code or at least your references in pastebin.



  • Thanks for responding :).
    I’m using Visual Studio 2019 and C#. In my reference I use script hook v for net 2 and also System.Windows.Forms.doll but I don’t have assemblies tab in references manager so I downloaded it from internet and put it in the same directory as script and just referenced to it. I’m using dot net framework 5.0.



  • @Errorflin I'm sorry which assemblies did you download. Windows.Forms does not need to be downloaded.
    Make sure none of "Using" are greyed out or underlined in red.



  • I downloaded it because I don’t have assemblies tab in reference manager where it should be located



  • @Errorflin If you don't have them your OS is unlikely to be working or you didn't install VS properly.
    Add reference, Assemblies, type system.window in the searchbox and it absolutely has to appear. If it doesn't you have a major issues! :)

    alt text



  • I don’t even have the assemblies tab in the reference manager. Maybe reinstalling it will fix it. But this is why I have the errors?

    Also I installed vs2019 by and for the unity game engine so maybe this is why. I will reinstall it.



  • @Errorflin very strange, are you sure you selected the correct project template, c# dotnet framework 4.8 and not some other template?



  • Yeah template class library and I have do net 5.0



  • @Errorflin Try rolling back to 4.8, there might be incompatibilities.



  • Reinstalling vs2019 and using .NET 4.8 fixed it. Thanks.



  • @Errorflin said in Problem loading own script.:

    Reinstalling vs2019 and using .NET 4.8 fixed it. Thanks.

    Good


Log in to reply
 

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