Results 1 to 4 of 4

Thread: Destroy model when player killed/discnonnects

  1. #1
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts

    Destroy model when player killed/discnonnects

    Hi again,

    This is the main bug in the gunship script I'm editing right now.
    The model is spawned, but if the player changes team / disconnects, the model doesn't get deleted.

    The code here is not complete, but I just need to know why this doesn't work.

    Code:
    	level._ac_model=spawn("script_model",self.origin+(2000,0,0));
    	level._ac_model linkTo(self._ac);
    	level._ac_model setmodel("xmodel/vehicle_condor");
    	level._ac_model.gunner = self;
    
    	level thread ac_monitor(self);
    
    ac_monitor(gunner)
    {
    	while((isDefined(level._ac_model.gunner))&&(gunner.pers["usinggunship"] == 1))
    	{
    		wait 0.3;
    		iprintlnbold("in loop");
    	}
    
    	if(isDefined(level._ac_model))
    	{
    		level._ac_model destroy();
    		iprintlnbold("destroyed by monitor");
    	}
    }
    The result is, I can read the "in loop" text while using the gunship, and, after I leave it (using /kill or changing team to spec), I read "destroyed by monitor", but the gunship does not get destroyed.
    set logfile 2

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    delete() instead of destroy() for models
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. The Following User Says Thank You to IzNoGoD For This Useful Post:

    guiismiti (5th December 2014)

  4. #3
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Yea, that worked.... funny thing is that the original script uses destroy() after the ac_move() is completed.

    Btw izno, I asked you once, not sure if you read it, do you know who wrote this code?

    http://pastebin.com/mvqeVmQc

    It's the gunship code I'm using, and I'd like to credit whoever created it. It's really different from the eXtreme mod code.
    set logfile 2

  5. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    I honestly have no clue who wrote it, but judging by the codestyle, I'd have to say that it was written by two or more people, one of which uses proper indentation and spacing, and one who does no such thing.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •