Log in to reply
 

Game crash when marking many peds as no needed



  • Hello everybody, I have encountered a problem why trying to create my first mod (more agressive wanted level). When I mark created peds as no longer needed (when player has wanted level 0) the game just crashes. Strange thing is that if I do not have much peds this function works properly. Hope you can help me. Was searching for hours information about such kind of problem but did not found. Problem aso is not linked with system file corruption e.t.c because i made full windows reinstall with latest drivers, microsoft visual redist c++ and other simular things. The system is clean.

    .NET runtime error in windows event viewer:

    Application: GTA5.exe
    Platform Version: v4.0.30319
    Description. The process was completed due to an unhandled exception.
    Exception Details: System.AccessViolationException
    at SHVDN.NativeFunc.NativeCall ()
    at SHVDN.NativeFunc.NativeTask.Run ()
    at SHVDN.ScriptDomain.DoTick ()
    at SHVDN.ScriptDomain.DoTick ()
    in <Module>.? A0xc1aa4bd5.ScriptHookVDotnet_ManagedTick ()



  • Maybe if you put that part of your code on pastebin it would be easier to help.


  • MODERATOR

    This person on GTAForums is having similar issues.

    Since this seems to go wrong inside SHVDN, try and call the natives yourself.



  • Tried to call native directly. It crashes the game with same error even when the amount of peds is not big. Maybe it is necessary to call it directly in another way? That person is also me,:relaxed: just created two topics to collect more possible solutions for the problem.

    Code of function:

    private void CleanPedTasks(ref Ped[] peds_to_clean_task, int size_of_peds_array)
    {
    for (int i = 0; i < size_of_peds_array; i++)
    {
    if ( Function.Call<bool>(Hash.DOES_ENTITY_EXIST, peds_to_clean_task[i]) & !Function.Call<bool>(Hash.IS_ENTITY_DEAD, peds_to_clean_task[i]))
    {
    //peds_to_clean_task[i].MarkAsNoLongerNeeded();
    Function.Call(Hash.SET_ENTITY_AS_NO_LONGER_NEEDED, peds_to_clean_task[i]);
    }
    }
    }


  • MODERATOR

    @Belial4444 One topic on this matter suffices. Please, don't open more for the same issue.


Log in to reply
 

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