Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. MW3 Modding Support & Discussion
  3. Access Violation when handling entities

Access Violation when handling entities

Scheduled Pinned Locked Moved MW3 Modding Support & Discussion
4 Posts 2 Posters 147 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • naccibundefined Offline
    naccibundefined Offline
    naccib
    wrote on last edited by naccib
    #1
    def avFunction(player)
    {
        var obj = gsc.spawn("script_model", player.getOrigin());
    
        var interval = setInterval(fun[player, obj]()
        {
           var newPosition = player.getOrigin();
           newPosition[2] += 10;
    
           obj.setOrigin(newPosition);
           player.setOrigin(newPosition);
        }, 1);
    }
    

    On private match, this code will make the client crash with an access violation exception (0xC00005). It appears the AV occurs only when handling the obj entity. I'm not sure if the anticheat would allow me to use CheatEngine to investigate what is on the address associated with the exception, so I'm posting it here.

    Edit #1: creating obj as a global doesn't help. Also function that only read obj properties (i.e obj.getOrigin()) work, but functions that write to them yield an AV.

    Maybe Chai threads don't have write permission to some of the game entities?

    1 Reply Last reply
    0
    • S3VDITOundefined Offline
      S3VDITOundefined Offline
      S3VDITO
      wrote on last edited by S3VDITO
      #2

      May be a problem in setOrigin itself, because many gsc functions work inappropriately(giveWeapon, openMenu, BulletTrace and may be others)

      For example, I do not get errors when using iPrint functions(but setOrigin crush dedicate and private match(I don’t know, maybe it’s just me)):

      level.onNotify("connected", fun(args) {
      	var player = args[0];
      	// Press space :)
      	player.onNotify("jumped", fun[player](args){
      		avFunction(player);
      	});
      });
      
      def avFunction(player)
      {
          var obj = gsc.spawn("script_model", player.getOrigin());
      
          var interval = setInterval(fun[player, obj]()
          {
      		player.iPrintLnBold("This is test");
      		player.iPrintLn(obj.getOrigin());
          }, 1000);
      }
      

      alt text

      1 Reply Last reply
      1
      • naccibundefined Offline
        naccibundefined Offline
        naccib
        wrote on last edited by
        #3

        I think the underlying problem with BulletTrace and obj.setOrigin is different.

        When calling gsc.BulletTrace, I get an Chai function dispatch exception. From what I've observed, this also happens when you improperly call a function inside a struct. For example:

        class MyClass
        {
            var x;
          
            def SetX(value)
            {
                this.x = value;
            }
        
            def CalculateX()
            {
               var newX = 2.0;
               
               SetX(newX);
            }
        }
        

        Can't really test right now, but this gave me a function dispatch exception just like BulletTrace. Changing SetX(newX) to this.SetX(newX)fixed it. This may be because ChaiScript get's confused when handling complex function calls because most of it security comes from arity checking (i.e counting if you have the correct number of arguments). In more complex function calls calculating arity is tricky - but that's just a theory.

        On the other hand, obj.setOrigin yields a plain access violation, pointing to some ownership issue rather than a faulty function argument stack. Also, calling setOrigin on player works, so probably not the same issue as BulletTrace.

        S3VDITOundefined 1 Reply Last reply
        1
        • S3VDITOundefined Offline
          S3VDITOundefined Offline
          S3VDITO
          replied to naccib on last edited by
          #4

          naccib
          BulletTrace was an example, but thanks for this comment (I learned something new 🙂 ).
          There are a lot of such not working functions, i listed them above and i sure that there are many more

          1 Reply Last reply
          0

          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Donate