malyczolg
24th October 2013, 14:15
hello , i make zombie detector
why if I am further than the distance detector see me ?
detector()
{
self.detector = spawn("script_model",self.origin);
self.detector.angles = (self.angles);
self.detector setmodel("xmodel/prop_hydrant");
time = 45;
for(;;)
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
distance = distance(self.detector.origin, players[i].origin);
if(distance < 100 && players[i].sessionstate == "playing" && isAlive(players[i]) && players[i].pers["team"] == "axis" && players[i].detector == 0)
{
players[i].detector = 1;
iprintlnbold("detect : "+players[i].name);
//players[i] thread detector2();
}
else
{
players[i].detector = 0;
}
}
if(time<=0)
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
players[i].detector = 0;
}
self.detector delete();
break;
}
time -= 1;
wait 1;
}
}
why if I am further than the distance detector see me ?
detector()
{
self.detector = spawn("script_model",self.origin);
self.detector.angles = (self.angles);
self.detector setmodel("xmodel/prop_hydrant");
time = 45;
for(;;)
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
distance = distance(self.detector.origin, players[i].origin);
if(distance < 100 && players[i].sessionstate == "playing" && isAlive(players[i]) && players[i].pers["team"] == "axis" && players[i].detector == 0)
{
players[i].detector = 1;
iprintlnbold("detect : "+players[i].name);
//players[i] thread detector2();
}
else
{
players[i].detector = 0;
}
}
if(time<=0)
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
players[i].detector = 0;
}
self.detector delete();
break;
}
time -= 1;
wait 1;
}
}