So I'm coding some stuff for the new moNstrous movie and I'm trying to figure out how to kill all 5 people on the opposite team with one awp shot from anywhere on the map. (I.E. the 5 people can be anywhere on the map, not lined up, etc.) I've got it to work with 3 and I'm trying to figure out how to get it to work with everyone. I know this is in c++ but the principles are the same. Right now I'm hooking TraceLine. SuperAwp is the target being shot and SuperAwper is the person with the awp. This code goes in the hooked version of TraceLine:
Code:
if (superAwper != NULL && superAwp != NULL && pentToSkip == superAwper && UTIL_IsAlive(superAwper)) {
// check to see if we killed the target
if (superAwp->free || !UTIL_IsAlive(superAwp)) {
// Find a new target
for (index = ENTINDEX(superAwp) + 1; index <= gpGlobals->maxClients; index++) {
pPlayer = INDEXENT(index);
// See if there's a player who isn't dead on the other team
if (superAwp != pPlayer && pPlayer && !pPlayer->free && UTIL_IsAlive(pPlayer) && getTeam(pPlayer) != getTeam(superAwper)) {
superAwp = pPlayer;
found = true;
break;
}
}
// Check to see if there are no targets
if (!found) {
superAwp = NULL;
RETURN_META(MRES_IGNORED);
}
}
// Call traceline, can probably be removed
TRACE_LINE(v1, v2, fNoMonsters, pentToSkip, ptr);
ptr->pHit = superAwp; // Force a hit on the target
ptr->iHitgroup = 1; // In the head
ptr->vecEndPos = superAwp->v.origin; // Make blood come out of the guy
ptr->flPlaneDist = 1; // Not sure if this is right
RETURN_META(MRES_SUPERCEDE);
}
I can kill 3 people with 1 awp shot anywhere on the map but it seems CS stops there. Any ideas?