guiismiti
4th December 2014, 20:44
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.
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.
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.
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.