Log in to reply

help recompiling a mod

  • Hi!

    I decompiled an abandoned mod with dotpeek to try change some bugs... but after that, when I try to compile it again with visual studio I got a lot of errors.

    I already inserted the dotnet scripthook dll in references, but I get errors with gta namespaces...

    There's something else that I need to do? It's very difficult to find some information about this...

    Some help please?

  • The error output tells you what's wrong. With sufficient knowledge about programming you are able to fix it.
    If you get namespace errors you are very likely referring the wrong library or wrong library version. Shvdn has changed over time and maybe that mod (very old as you say) needs an outdated version of shvdn. In this case you need to adapt the code to the new shvdn structure, but as I said, you should know that already.

  • @Cyron43 said in help recompiling a mod:


    yes. I already did it, I used the shvdn 2.9.4, but i still getting the error, i changed only a single value in the mod, but I still getting the namespace error, I'm not an advanced developer, I just want to solve a little bug :(


    The decompiler will not get back the original code. Since you're probably using Visual Studio, try solving all the errors it displays.

  • @hardlevelbr If you are still stuck after doing as ikt suggests then please post the exact error message. Maybe we can help you then. Fixing the code of someone else needs a good amount of experience, especially when it's even decompiled. Jus' sayin'.

  • @hardlevelbr If you're getting namespace errors, are you sure you referenced the right dll?

  • @hardlevelbr BTW Shvdn 2 was released on Sep 6, 2015. If the release date of this mod is prior to this date it needs a reference to shvdn 1.x. A change in the major version number (the leftmost one) means there was a breaking change and that could explain the error but as I said, we need better information from your side.
    Please read http://semver.org/
    Of course having shvdn 1.x in the game folder would conflict with later versions of shvdn. In order to avoid this you need to reference shvdn 2.10.1 and fix all broken changes in the mod by adapting to new namespaces, member names, parameter sets, calls and so on.

  • hi, thanks for the help, I tryed everything again

    One thing I noticed is there's two scripthookdotnet in references in visual studio, but one is marked with some error that I can't figure out, and I already inserted the references, follow some screenshots, if someone could help me I apreciate...

    alt text

    alt text

    alt text

    alt text

  • @hardlevelbr Well first of all shvdn should only be referenced once! Remove that erroneous one from the reference list. It casn't be found anyway (that's why it has this yellow triangle with the exclamation mark).
    I can't read that error log because it's in spanish language but what I see is that even simple things like missing brackets and semicolons are listed. In other words, that code is a total crap! However those errors are displayed in the code window at design time and should be easy to find (look at the line numbers in the errors list). All this is basic programming knowledge. Are you sure you can handle the task ahead of you?

  • Actually it's portuguese, not spanish

    The line that is referencied says:

    		if (armed)
    			WeaponHash[] fieldHandle = new WeaponHash[] { typeof(<PrivateImplementationDetails>).GetField("E312AA7FD7C210B82F3885C918880FE68A6EC333").FieldHandle };
    			ped.get_Weapons().Give(fieldHandle[Main.rand.Next(0, (int)fieldHandle.Length)], 100, false, true);

    But I really can't figure out what is wrog, I did some search in google and find some info that says something about the version of C#, could be it?

  • hi thanks for all support, I made some progress, but now I have only one error, can you help me?

    alt text

    The error says for not use System.Runtime.Compiler.Services.Extension.Attribute and use "this" instead, but on line 5 there's nothing like this

  • @hardlevelbr I have never seen [assembly: Extension] inside the AssemblyInfo.cs. Just remove it and try to compile. What the error message is trying to tell you: Don't use the Extension attribute but the usual way of creating extension methods by utilizing the "this" keyword. Here is further reading for you: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods

  • I removed and it gave me 98 errors... i give up...

    thanks for the help and your time


    Question 0: Do you know how to program?

  • I know the basic of some languages, actually I'm a frontend web developer, I need this mod to make some videos, but the mod have a bug that make impossible to complete the missions, after the decompilation I could find where I need to change to make it work, it's just one value, but I can't recompile...

    It's strange, if the mod is already compiled, why I can't recompile in the same way? Could be some incompatibility with visual studio 2017?


    Don't "just" remove things. It's better to just take the fixed and decompiled source code and recompile it in a new clean SHVDN project.

    Also decompiling and recompiling doesn't work like that. The CLR's sure to have updates in between, but that's not the problem.

  • @ikt i'm not removing, only changing a value, it's a distance value, this mod have a bug that make impossible to complete the mission, it spawn a enemy far away but when you try to reach then, in same time is leaving the zone marked in map, when leave the zone the mission is aborted, i'm tryng to change the distance required for the mission fail, the default is 200, i'm changed to 20000, only this... the rest of the mod I didn't any change

  • @hardlevelbr Do you know C# and how to make SHVDN mods? If you answered no to either of those questions, learn how to.

  • @AHK1221 hi, I really don't, I haven't time to study this, all I want is a little correction in this mod, I don't want make mods...

  • @hardlevelbr You should realize that decompiling a mod creates a ton of errors, and if you don't have the knowledge to fix them, you wont be able to recompile.

  • @AHK1221 do you know how to mind? if I ask to you to change this value on this mod, do you do this to me?


    @hardlevelbr Since you only want to increase the distance (2 floats) to 20000, why don't you just edit the DLL with a Hex editor?
    This should work (assuming you are using the latest version of Gang Mod):
    Replace 4 bytes at offset 0x7230 and 0x73B1 with 00 40 9C 46.

  • @hardlevelbr I thought you were trying to change the behavior of the mod when this thread was just created, but you just want to change 2 values :stuck_out_tongue:
    Probably you can achieve the goal only with the method that Unknown Modder provided, yes.

  • @Unknown-Modder thanks very much, you are a genius, I really didn't thought about this...

    But... I tryed to open the gangmod.dll with a hex editor and cannot find this offsets =/

    edit: I could find the 7230, but didn't the 73b1




    This is it for me on 2.4.1.

Log in to reply

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