Log in to reply
 

ScriptHookDoNet 2 and 3



  • Here is my question
    Is there a way to work on booth reference?
    I mostly use SHDN 2 and recently I try the SHDN 3 there're some stuff special from the 2
    Example: in SHDN2 you can't task ped to land a plane but in SHDN3 there is that task !
    So, It's no possible to use both ?



  • @MikeBoma

    There's no reason to keep using SHDN2. No obvious ones.

    As the number indicates, SHDN3 essentially replaced SHDN2. It is the newest version and the only one that is currently updated and supported.

    You can migrate your existing SHDN2 scripts to 3 or keep them as is, your choice. Once you understand the changes, you'll never look back.

    And no, you can't use both in the same .cs.

    To answer your question for yourself, go into VS and add both SHDN versions as references and watch what happens.

    Note: You can do anything in SHDN2 that you can in SHDN3 if you remember that they both use the native functions.

    For example the task to land a plane was not magically created in SHDN3. In SHDN2 you just use the native function, without the SHDN3 wrapper.

    void TASK_PLANE_LAND(Ped pilot, Vehicle plane, float runwayStartX, float runwayStartY, float runwayStartZ, float runwayEndX, float runwayEndY, float runwayEndZ) // 0xBF19721FA34D32C0 0x5F7E23EA b323



  • @JohnFromGWN really i'll update my current work to SHVDN3 ,but firstly I'll do a backup SHDN3 as more stuff then SHVDN2
    Because using both will create error


  • MODERATOR

    @MikeBoma said in ScriptHookDoNet 2 and 3:

    Here is my question
    Is there a way to work on booth reference?
    I mostly use SHDN 2 and recently I try the SHDN 3 there're some stuff special from the 2
    Example: in SHDN2 you can't task ped to land a plane but in SHDN3 there is that task !
    So, It's no possible to use both ?

    It's quite possible to keep both versions in your GTA V root directory: they don't interfere with each other. I keep v2 around, simply for older tools/scripts that haven't transitioned yet.



  • @meimeiriver said in ScriptHookDoNet 2 and 3:

    It's quite possible to keep both versions in your GTA V root directory: they don't interfere with each other.

    You can keep them both of course, but you can't reference both in the same script.


  • MODERATOR

    @JohnFromGWN said in ScriptHookDoNet 2 and 3:

    @meimeiriver said in ScriptHookDoNet 2 and 3:

    It's quite possible to keep both versions in your GTA V root directory: they don't interfere with each other.

    You can keep them both of course, but you can't reference both in the same script.

    Of course not. :) Your script will run with what it's compiled against (or be auto-sensed, as it were, in case of a .cs). Best for the OP to simply learn v3, and get it over it.



  • @MikeBoma

    If you tried to reference both in the same script and tried to compile in VS, you would get an error message like this:

    error CS0433: The type 'Ped' exists in both 'ScriptHookVDotNet2, Version=2.10.14.0, Culture=neutral, PublicKeyToken=null' and 'ScriptHookVDotNet3, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null'
    


  • @JohnFromGWN
    Yes , remove the SHVDN2 and move to SHVDN3 so I had to fix all 568 error of my entire work 😅. I'm building a big mod take me over 1year I want everything to be perfect then feedback will help me to improve. It's a police mod.



  • @MikeBoma One thing to watch out for are SHVDN 3 version updates. They are intended to be backwards compatible but one actually broke a very simple weapons script I had in one of my LemonUI menus. Sure enough the changelog mentioned changes to the weapons but nothing specific enough to explain why I got the issue, and no workaround.



  • I updated my ScriptHookV.asi, ScriptHookVDoNet 2.dll and 3.dll when I run my script after build the Ontick even doesn't
    Any way to fix that?



  • @MikeBoma Nothing is broken, it's your code.
    I've seen tick implemented 100 different ways so I can only share the way it works for me.
    Since you're interested in LemonUI, this is straight from my own working menus.
    Ofc the code inside the Tick has to be compatible with SHVDN3, but that's where VS will flag errors.

    namespace LemonUI.Menu1
    {
        public partial class Basics : Script
        {     
            public Basics()
            {
                Tick += Basics_Tick;          
            }
    
            private void Basics_Tick(object sender, EventArgs e)
            {
            }
                 
        }  
    } 
    

Log in to reply
 

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