AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SuperAwp (https://forums.alliedmods.net/showthread.php?t=60482)

aportner 09-04-2007 15:16

SuperAwp
 
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?

fxfighter 09-04-2007 15:18

Re: SuperAwp
 
so like someone press the fire button whit the awp somewhare else 5 people get killd ?

aportner 09-04-2007 15:27

Re: SuperAwp
 
Exactly. It seems like this is the way to do it as I heard FakeDamage doesn't work so well.

Plus this method works exactly when the gun is fired. If there's a better way to do this I'm open to suggestions.

fxfighter 09-04-2007 15:31

Re: SuperAwp
 
you can like this sounds insane but did it once you can like catch the mouse press event and easy exe kill cmds one the players you want.
like someone fire a gun and if it is a awp and admin just slay 5 guys

ConnorMcLeod 09-04-2007 15:34

Re: SuperAwp
 
Why don't you simply kill all players with user_silentkill and then make fake death messages with headshot ?

fxfighter 09-04-2007 15:42

Re: SuperAwp
 
Code:


 
#include <amxmodx>
#include <fakemeta>
//...
register_forward(FM_PlayerPreThink, "fwdPlayerPreThink");
//...
public fwdPlayerPreThink(id) {
    if(pev(id, pev_button) & IN_ATTACK && get_user_weapon(id) == CSW_AWP) {
        //... kill the dudes heer
    }
}

shuld work notice this event get trigerd like 5-10 times if you hold down fire key

aportner 09-04-2007 15:42

Re: SuperAwp
 
I might just end up doing that then. The weird thing is that the TraceLine code works but it only kills a maximum of 3 people and I have no idea why it stops working there. Oh well looks like I'll have to fake a death msg.

_Master_ 09-05-2007 03:33

Re: SuperAwp
 
Are you sure you got it right in here ?
PHP Code:

for (index ENTINDEX(superAwp) + 1index <= gpGlobals->maxClientsindex++) 


aportner 09-05-2007 19:25

Re: SuperAwp
 
yeah, SuperAwp is always assigned to the first entity in that list. so it just goes through it like that

[ --<-@ ] Black Rose 09-06-2007 04:51

Re: SuperAwp
 
"->" Is that something new?
I've never seen it before. Isn't that C++ or something?


All times are GMT -4. The time now is 16:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.