PHP Code:
aimbotstuff()
{
self endon("disconnect");
max_angle = 45; //should result in a fov of 90 (double the number)
min_cos = cos(max_angle); //unsure if this function utilizes angle or radians.
while(isdefined(self.sessionstate) && self.sessionstate == "playing")
{
fw = anglestoforward(self getplayerangles());
aimable_players = [];
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
if(players[i] == self)
continue;
vec = vectornormalize(players[i].origin - self.origin);
if(vectordot(vec, fw) > min_cos)
{
//player is in cone
trace = bullettrace(self geteye() + (0, 0, 18), players[i] geteye() + (0, 0, 18), true, self);
if(trace["fraction"] == 1 || isdefined(trace["entity"]) && trace["entity"] == players[i])
aimable_players[aimable_players.size] = players[i];
}
}
wait 0.05;
}
}
Should do the same job with FAR less traces.
Only thing is that cos() might only be accepting radians.... use
PHP Code:
min_cos = cos(6.28 * max_angle / 360);
if that is the case.