Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

[C#] Quick MP vehicle despawn fix for v2802


LeeC22
 Share

Recommended Posts

Found the decompiled scripts so modified my old MP Vehicle Despawn Disabler script to work with the latest version of the game. Thanks to rootcause for uploading the decompiled scripts.

 

How to use:

1. Create a text file called MPDespawnDisabler.cs (make sure you don't have file extensions hidden or it could end up as .cs.txt)

Edit: This option is called "Hide extensions for known file types" and should be unchecked, i.e. no tick in the box. You can find the setting in "Folder and search options" in Windows Explorer.

2. Copy and paste the code below into that file

3. Save the file and then copy it into your scripts folder

 

Note: This script requires ScriptHookVDotNet to be installed in your game folder.

 

Just tested by spawning the r300 and it stayed in the game.

 

using System;
using GTA;

namespace MPDespawnDisable
{
    public class MPDespawnDisabler : Script
    {
        public MPDespawnDisabler()
        {
            Tick += onTick;
            Interval = 0;
        }

        private void onTick(object sender, EventArgs e)
        {
            if (Game.IsLoading) return;
    
            Game.Globals[4540726].SetInt(1); // 2802
        }
    }
}

 

Edit: Video added of two-car spawn and customisation.

 

 

Edited by LeeC22
  • Like 2
Link to comment
Share on other sites

tigertoddy2008
3 hours ago, LeeC22 said:

Found the decompiled scripts so modified my old MP Vehicle Despawn Disabler script to work with the latest version of the game. Thanks to rootcause for uploading the decompiled scripts.

 

How to use:

1. Create a text file called MPDespawnDisabler.cs (make sure you don't have file extensions hidden or it could end up as .cs.txt)

2. Copy and paste the code below into that file

3. Save the file and then copy it into your scripts folder

 

Just tested by spawning the r300 and it stayed in the game.

 

using System;
using GTA;

namespace MPDespawnDisable
{
    public class MPDespawnDisabler : Script
    {
        public MPDespawnDisabler()
        {
            Tick += onTick;
            Interval = 0;
        }

        private void onTick(object sender, EventArgs e)
        {
            if (Game.IsLoading) return;
    
            Game.Globals[4540726].SetInt(1); // 2802
        }
    }
}

 

 

I seem to be having the same issue as rampage - you can spawn, but auto auto upgrade hangs the game, and the second car you spawn hangs the game.

Link to comment
Share on other sites

10 hours ago, tigertoddy2008 said:

 

I seem to be having the same issue as rampage - you can spawn, but auto auto upgrade hangs the game, and the second car you spawn hangs the game.

You might have another mod conflicting then because I just spawned the r300 and the tulip2 at the same time and was able to drive and customise them both without a problem.

 

Given that some patterns seem to be broken in this new version, you might have a mod that does something with vehicles that has a pattern that sets an incorrect memory address. I noticed that NoBoundaryLimits has also stopped working in this version of the game with a "can't find pattern #1" error. Rockstar have clearly made some code changes that are affecting a few mods this time around.

 

Edit: NoBoundaryLimits error was caused by me using the wrong version of that mod.

Edited by LeeC22
Link to comment
Share on other sites

tigertoddy2008
5 hours ago, LeeC22 said:

You might have another mod conflicting then because I just spawned the r300 and the tulip2 at the same time and was able to drive and customise them both without a problem.

 

Given that some patterns seem to be broken in this new version, you might have a mod that does something with vehicles that has a pattern that sets an incorrect memory address. I noticed that NoBoundaryLimits has also stopped working in this version of the game with a "can't find pattern #1" error. Rockstar have clearly made some code changes that are affecting a few mods this time around.

Which menu are you using to spawn?  As I'll just use that.

Link to comment
Share on other sites

29 minutes ago, tigertoddy2008 said:

Which menu are you using to spawn?  As I'll just use that.

I am using Simple Trainer, it's the only trainer I have ever used.

Link to comment
Share on other sites

tried this out last night with simple trainer & addon car spawner and it did not work.

 

are you sure this work or is it conflicting files?

Link to comment
Share on other sites

35 minutes ago, Coolart1 said:

are you sure this work or is it conflicting files?

There's a video in the first post, if this didn't work then I wouldn't have been able to make that video. I also would not have posted it if it didn't work.

 

This is a list of the modded files I have in my main folder and the only trainer in there is Simple Trainer that currently doesn't prevent the cars from despawning. ACSPatch.asi just stops the wheels from going straight when you get out of the car.

 

ACSPatch.asi
dinput8.dll
HeapAdjuster.asi
HeapAdjuster.ini
J10RailroadEngineer.ini
NoBoundaryLimits.asi
NoBoundaryLimits.ini
OpenIV.asi
PackfileLimitAdjuster.asi
PackfileLimitAdjuster.ini
RespawnFix.asi
RespawnFix.ini
ScriptHookV.dll
ScriptHookVDotNet.asi
ScriptHookVDotNet.ini
ScriptHookVDotNet2.dll
ScriptHookVDotNet3.dll
TrainerV.asi
trainerv.ini

 

Edit: I uninstalled Simple Trainer and used my own quick-spawner to spawn the R300 just to make sure nothing else was preventing the car from despawning.

 

 

Edited by LeeC22
  • Like 2
Link to comment
Share on other sites

Hello @LeeC22

 

I don't currently have the game installed to test it, so it's faster if I ask here instead of testing it myself.
 

If I use your code and paste MPDespawnDisabler.cs into the scripts folder and it works fine for me, then:

 

1. Can I have MPDespawnDisabler.cs pasted in the scripts folder always permanently as long as this method works?

 

2. If Simple Trainer by Sjaak327 will be updated and its way to non-disappearing MP vehicles will be fixed

 

So can I still have MPDespawnDisabler.cs pasted in the scripts folder and having Simple Trainer by Sjaak327 with the new pattern for non-disappearing MP vehicles won't collide side by side running simultaneously?

Add-On Vehicle Spawner by IKT also includes a fix for non-disappearing cars as far as I know.

 

3. Ultimately my question is, can I use MPDespawnDisabler.cs with Simple Trainer by Sjaak327 and Add-On Vehicle Spawner by IKT at the same time and it will still work properly?

If there are three scripts that control it, which one then has the highest priority to do it as the main and best one?

 

The code of one and the second and the third script can be the same, similar or different.

 

How does the game choose which one to use and doesn't it interfere with its operation if there are several of them?

Link to comment
Share on other sites

2 hours ago, RemixPL1994 said:

3. Ultimately my question is, can I use MPDespawnDisabler.cs with Simple Trainer by Sjaak327 and Add-On Vehicle Spawner by IKT at the same time and it will still work properly?

Yes is the simple answer.

 

Because it just sets a Global value it won't cause a problem if multiple things do it because they're all setting it to the same value. Even if one of them was checking the value, it would only take a single update cycle to set the value to the correct value.

 

When either Simple Trainer or Addon Spawner gets updated though I would recommend removing this .cs script completely. This script only works on this version of the game because the value it uses changes for every version, which means it would be setting the wrong Global on an updated game... which could be bad. It's also taking up an SHVDN thread and that thread has potentially more value for a more important mod.

 

Ikt and Sjaak327's mods are also ASI mods, which means they will be working at a better level than this simple script. I am sure when they are updated they will find a working pattern making them more reliable. ASI mods also appear to start running at an earlier point in the loading cycle, which means this script would be redundant by default anyway.

  • Like 1
Link to comment
Share on other sites

10 hours ago, LeeC22 said:

There's a video in the first post, if this didn't work then I wouldn't have been able to make that video. I also would not have posted it if it didn't work.

 

This is a list of the modded files I have in my main folder and the only trainer in there is Simple Trainer that currently doesn't prevent the cars from despawning. ACSPatch.asi just stops the wheels from going straight when you get out of the car.

 

ACSPatch.asi
dinput8.dll
HeapAdjuster.asi
HeapAdjuster.ini
J10RailroadEngineer.ini
NoBoundaryLimits.asi
NoBoundaryLimits.ini
OpenIV.asi
PackfileLimitAdjuster.asi
PackfileLimitAdjuster.ini
RespawnFix.asi
RespawnFix.ini
ScriptHookV.dll
ScriptHookVDotNet.asi
ScriptHookVDotNet.ini
ScriptHookVDotNet2.dll
ScriptHookVDotNet3.dll
TrainerV.asi
trainerv.ini

 

编辑:我卸载了Simple Trainer,并使用我自己的快速生成器来生成R300,以确保没有其他东西阻止汽车生成。

 

 

Hello, I am very interested in the style of your input field. Could you tell me how to achieve it? Did you draw it yourself?
I only know one way to type it...

(SHVDN3) 

Game.GetUserInput();

Link to comment
Share on other sites

8 hours ago, Lbf666 said:

Hello, I am very interested in the style of your input field. Could you tell me how to achieve it? Did you draw it yourself?

It's a custom event-driven text input system I created myself. I press a key (or send a request from a mod) and that box appears, any text that is entered is sent to any mod that subscribes to that event. It's more like an enhanced Cheat code system rather than an input system. I created it as a debugging tool really.

 

You have to handle all the keypresses yourself to build and edit a string, and then display that string on-screen however you like. Then you just fire off the event with that string as the event argument.

Edited by LeeC22
Link to comment
Share on other sites

15 minutes ago, LeeC22 said:

这是我自己创建的自定义事件驱动文本输入系统。我按下一个键(或从模组发送请求)并出现该框,输入的任何文本都会发送到订阅该事件的任何模组。它更像是一个增强的作弊代码系统,而不是一个输入系统。我真的把它作为一个调试工具创建。

 

您必须自己处理所有按键才能构建和编辑字符串,然后根据需要在屏幕上显示该字符串。然后,您只需使用该字符串作为事件参数触发事件。

 

thanks for your explanation
It's very cool!

Link to comment
Share on other sites

On 12/21/2022 at 5:16 PM, LeeC22 said:

"ACSPatch.asi just stops the wheels from going straight when you get out of the car."

 

I know this is not related to the main topic here but I would like to ask something else.

 

I see you are also using ACSPatch.asi

 

Would it be possible to rewrite this .dll perhaps knowing what the code/principle of it looks like in .asi?

 

Seeing the code and learning how it works, would you be able to make it work in .dll as well?

 

By rewriting this to a .dll, if successful, this wheel fix could be combined with other vehicle related fixes/enhancements - which also work in .dll

Edited by RemixPL1994
Link to comment
Share on other sites

7 hours ago, RemixPL1994 said:

Would it be possible to rewrite this .dll perhaps knowing what the code/principle of it looks like in .asi?

 

Seeing the code and learning how it works, would you be able to make it work in .dll as well?

Simple answer... No.

Link to comment
Share on other sites

On 12/20/2022 at 6:17 PM, LeeC22 said:

Found the decompiled scripts so modified my old MP Vehicle Despawn Disabler script to work with the latest version of the game. Thanks to rootcause for uploading the decompiled scripts.

 

How to use:

1. Create a text file called MPDespawnDisabler.cs (make sure you don't have file extensions hidden or it could end up as .cs.txt)

Edit: This option is called "Hide extensions for known file types" and should be unchecked, i.e. no tick in the box. You can find the setting in "Folder and search options" in Windows Explorer.

2. Copy and paste the code below into that file

3. Save the file and then copy it into your scripts folder

 

Just tested by spawning the r300 and it stayed in the game.

 

using System;
using GTA;

namespace MPDespawnDisable
{
    public class MPDespawnDisabler : Script
    {
        public MPDespawnDisabler()
        {
            Tick += onTick;
            Interval = 0;
        }

        private void onTick(object sender, EventArgs e)
        {
            if (Game.IsLoading) return;
    
            Game.Globals[4540726].SetInt(1); // 2802
        }
    }
}

 

Edit: Video added of two-car spawn and customisation.

 

 

Just want to say thank you, or to whoever wrote this code, it 100% fixed this issue for me since this latest update. Keep up the great work.

  • Like 2
Link to comment
Share on other sites

3 hours ago, robboss said:

Just want to say thank you, or to whoever wrote this code, it 100% fixed this issue for me since this latest update. Keep up the great work.

Just checking the date on the original project and it's almost 4 years old to the day... 27/12/2018 to be precise. I think I only created it because sjaak327 had told me how to find the despawn value in the decompiled scripts and I just wanted to test if it worked in a C# script. Simple Trainer was always updated on the day of an update or very soon after so I never actually used this script after that initial test. This is the first time I can ever remember Simple Trainer being delayed so it brought this project back from the archives.

 

I can't get the script decompiler to work though so I have to rely on someone else finding the value this needs and luckily they turned up pretty quickly thanks to rootcause. I don't play the game or mod it now, but it just seemed like uploading this script might be useful for a few people. I noticed Ikt has updated Addon Spawner on 5Mods, so there's a better solution out there now. Nobody knows sjaak's situation and Simple Trainer just might not get updated ever again. Some modders, like myself, eventually get tired of the game and move on to something else.

  • Like 1
Link to comment
Share on other sites

tigertoddy2008

No longer works for me, I get kicked out of the vehicle again, using only trainerv - the one in the video.

Link to comment
Share on other sites

14 minutes ago, tigertoddy2008 said:

No longer works for me, I get kicked out of the vehicle again, using only trainerv - the one in the video.

Post the contents of your ScriptHookVDotNet2.log file or at least the top section down to where it says something like "[17:15:28] [DEBUG] Starting 23 script(s) ..."

 

Nothing has changed and the script still works for both myself and other people in this thread. Either the script isn't running on your machine or something else is conflicting and that log file will say if it is running or not. If it is running then the next simple step is to rename your scripts folder, create a new one and only put this script into it.

Edited by LeeC22
Link to comment
Share on other sites

tigertoddy2008
11 minutes ago, LeeC22 said:

Post the contents of your ScriptHookVDotNet2.log file or at least the top section down to where it says something like "[17:15:28] [DEBUG] Starting 23 script(s) ..."

 

Nothing has changed and the script still works for both myself and other people in this thread. Either the script isn't running on your machine or something else is conflicting and that log file will say if it is running or not. If it is running then the next simple step is to rename your scripts folder, create a new one and only put this script into it.

Oh, had no idea it needed dotnet.

Link to comment
Share on other sites

4 minutes ago, tigertoddy2008 said:

Oh, had no idea it needed dotnet.

Ah... didn't consider that you might not have that installed I must confess. If you ever see something with C# or SHVDN in the title, then it will require ScriptHookVDotNet. I should have stated that, it's been too long since I uploaded anything like this for other people and I just presume all users have SHVDN installed.

Edited by LeeC22
Link to comment
Share on other sites

tigertoddy2008
21 hours ago, LeeC22 said:

Ah... didn't consider that you might not have that installed I must confess. If you ever see something with C# or SHVDN in the title, then it will require ScriptHookVDotNet. I should have stated that, it's been too long since I uploaded anything like this for other people and I just presume all users have SHVDN installed.

Still getting crashes when trying to use auto upgrade, the trainer you use doesn't have this, does it?  Scripthook and shvdn log don't seem to reflect the crash, maybe you just can't use the auto upgrade function with these newest vehicles?

Link to comment
Share on other sites

5 hours ago, tigertoddy2008 said:

Still getting crashes when trying to use auto upgrade, the trainer you use doesn't have this, does it?  Scripthook and shvdn log don't seem to reflect the crash, maybe you just can't use the auto upgrade function with these newest vehicles?

I am not sure if SImple Trainer has that but what you are saying did make me think of something. I have a mod that records replays for vehicles and then lets you play them back. As part of that it has the ability to auto-apply some mods to the car when it plays it back, like spoilers and liveries. The only time I had a crash with this version, was when I was playing back 2 vehicles from this update, the 300R and the new Entity. When I tried it again after restarting the game it was fine but I wonder if there are some mod components that are behaving in a way the game doesn't like?

 

All speculation of course but it does make you wonder. Haven't played the game since so I haven't tried it again. If I remember I will try it again later and see what happens.

 

Edit: Okay I was curious. Loaded the game, loaded my 2 saved replays for the 300R and the Entity, hit Play and the game crashed. Reloaded the game, turned off the auto-tuning options (which I think only applies to spoilers anyway, long time since I looked at the code for that part of it) and it played fine twice. Turned on the auto-tuning options, hit play and it crashed. Could just be coincidence but maybe there is something going on with tuning parts.

 

No crash shown in the logs either.

Edited by LeeC22
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.