[BUG] Entity fields spam

Topic created · 8 Posts · 177 Views
  • When you make calls to entity fields in a short period of time it crashes.

    chai code to reproduce:
    (go to Search & Destroy and spam the plant bomb button for example, the same happen onPlayerDamage that gets called a lot of times per second while shooting)

    def onPlayerConnected(args)
    {
        var player = args[0];
        player.onNotify("use_hold", fun[player](args)
        {
            player.iprintln("planting...");
            var origin = player.get("origin"); // make a field call and spam de F button
        });
    }
    
    level.onNotify("connected", onPlayerConnected);
    

    if you can take a look at field implementation stability
    Sin título.jpg

  • @xensik said in [BUG] Entity fields spam:

    use_hold

    It's simple, Notify ("use_hold") in GSC scripts is inside the loop, it is not surprising that it will spam... [That not bug, may be]

    OnPlayerDamage it probably handles not only player damage..., but what about using OnNotify to handle damage?

  • ??????? im talking about calling entity fields in a short period of time. dont have nothing to be with use_hold or playerDamage, u can crash then in other many ways, this was just an example.

  • I probably did not understand the question. Sorry, but this is strange that the server shuts down when multiple get/set to fields.
    then it turns out that this is a bug/error

  • @xensik said in [BUG] Entity fields spam:

    player

    wouldnt you use player.getOrigin() ?

  • yes, but using the field shouldnt crash

  • I'm investigating this. I can't really tell if we did something wrong, or if it's chaiscript being gay.

  • there is still a problem with reading Fields (it can return 0 / write an error to the console / return the normal value), there is also a problem with set Field (on screen shows the console with the angle)

    I just wanted to write a simple MapEdit =(

    // it's just an attempt to rewrite code with MW2
    def createRamp(top, bottom) {
    	var distance = gsc.distance(top, bottom);
    	var blocks = (int)(distance / 30) + 1;
    	
    	var A = [(top[0] - bottom[0]) / blocks, (top[1] - bottom[1]) / blocks, (top[2] - bottom[2]) / blocks];
    	var temp = gsc.vectorToAngles([top[0] - bottom[0], top[1] - bottom[1], top[2] - bottom[2]]);
    	var BA = [temp[2], temp[1] + 90, temp[0]];
    	
    	for (var b = 0; b <= blocks; ++b) {
    		print(BA);
    		var crate = gsc.spawn("script_model", [bottom[0] + A[0] * b, bottom[1] + A[1] * b, bottom[2] + A[2] * b]);
    		crate.set("angles", BA);
    		//crate.set("angles", BA);
    		crate.setModel("com_plasticcase_trap_friendly");
    	}
    }
    

    image.png

Log in to reply