Jitnaught Posted December 11, 2014 Share Posted December 11, 2014 (edited) So I'm trying to call a native (in .NET) on a dead ped, and it gives me an error... Error during NetHook.Tick: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Scripting.NativeContext2.Invoke(SByte* name, NativeContext2* cxt) at GTA.Native.Function.BaseCall(String Name, Parameter[] Arguments) at GTA.Native.Function.Call(String Name, Parameter[] Arguments) at GTA.Native.Template.Invoke() at GTA.ScriptDomain.RemoteEvent(RemoteEventArgs ev) at GTA.ScriptDomain.ProcessRemoteEvents() at GTA.ScriptDomain.Tick() at GTA.NetHook.Tick() Is there any way to bypass this? Edited December 11, 2014 by LetsPlayOrDy Link to comment Share on other sites More sharing options...
NTAuthority Posted December 11, 2014 Share Posted December 11, 2014 get a new handle for the ped? Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
Jitnaught Posted December 11, 2014 Author Share Posted December 11, 2014 get a new handle for the ped? Hm? Link to comment Share on other sites More sharing options...
byteMe420 Posted December 11, 2014 Share Posted December 11, 2014 (edited) So I'm trying to call a native (in .NET) on a dead ped, and it gives me an error... Error during NetHook.Tick: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Scripting.NativeContext2.Invoke(SByte* name, NativeContext2* cxt) at GTA.Native.Function.BaseCall(String Name, Parameter[] Arguments) at GTA.Native.Function.Call(String Name, Parameter[] Arguments) at GTA.Native.Template.Invoke() at GTA.ScriptDomain.RemoteEvent(RemoteEventArgs ev) at GTA.ScriptDomain.ProcessRemoteEvents() at GTA.ScriptDomain.Tick() at GTA.NetHook.Tick() Is there any way to bypass this? make sure you are testing your script by itself... remove all other script mods... if a script is using natives wrong then memory can get messed up and u see this... basically the reasons can be many and this error doesnt tell u much other than you need to re load your game and have the memory start over also im convinced the scripthookdotnet is not perfect and eventually something breaks (perhaps not the fault of the shdn but the nature of the engine now having to deal with unexpected code) Remember you could be conflicting with R* scripts asyou can be messing up global objects... who knows i just know modding is not healthy for gta engine lol Edited December 11, 2014 by byteMe420 Link to comment Share on other sites More sharing options...
byteMe420 Posted December 11, 2014 Share Posted December 11, 2014 (edited) get a new handle for the ped? he just means the ped is considered dead and he is calling some native on it... perhaps the native conflicts when a ped is in a dead state he is using shdn and is passing a Ped object to the native which implicitly passes the handle to the native... Ped class handles the handle for you and Parameter class can pass a Ped object's handle property to natives... with shdn you dont need to think about handles, you just make instance of the ped class via looping existing peds (shdn method gets ped object array) or creating (shdn method) Edited December 11, 2014 by byteMe420 Link to comment Share on other sites More sharing options...
InfamousSabre Posted December 11, 2014 Share Posted December 11, 2014 I usually only get that error if I am either: a) Passing wrong parameters to the native b) calling the native in a perframedraw byteMe420 1 Link to comment Share on other sites More sharing options...
NTAuthority Posted December 12, 2014 Share Posted December 12, 2014 get a new handle for the ped? he just means the ped is considered dead and he is calling some native on it... perhaps the native conflicts when a ped is in a dead state he is using shdn and is passing a Ped object to the native which implicitly passes the handle to the native... Ped class handles the handle for you and Parameter class can pass a Ped object's handle property to natives... with shdn you dont need to think about handles, you just make instance of the ped class via looping existing peds (shdn method gets ped object array) or creating (shdn method) a ped object is associated a single handle, so one'd need to get a new handle for the ped i.e. a new ped object had the same issue on SA a few times, a ped I just killed would get a new handle so the rampage script I was working on then caused the ped to be listed as killed twice alternately if the .net hook allows getting the handle manually and creating a ped from a handle one might be able to guess a new handle based on the uniqifier/maybe there's a pool method to get the uniqifier for an index Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
byteMe420 Posted December 13, 2014 Share Posted December 13, 2014 oh ok i see what you mean, maybe the new handle for dead peds is the same in iv Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now