AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Urgent: Vehichle kills (https://forums.alliedmods.net/showthread.php?t=6006)

SirTiger 09-19-2004 11:12

Urgent: Vehichle kills
 
Dear guys,
I need to find a way to catch kills done by vehichle brushes.
Friendly Fire is off but its a total hell with all the vehichle maps we got on the server. I can probably do the implementation myself,
I just need to find out how to catch a kill done by a vehichle. (Marked as worldspawn unfortunately)

Thanks.

Votorx 09-20-2004 07:23

You can try registering deathmsg, and if the killer is unknown (if its not suicide or done buy an actual person) you can persume that it was done by a vehicle...or...a trigger_hurt somewhere on your map...

SirTiger 09-20-2004 13:07

But jumping of a cliff would giving the same result right?
So people might abuse it if I would do it that way.

Trp. Jed 09-20-2004 15:54

Could you not combine it with pfn_touch to find the toucher and touchee and combined with a death figure out what caused it?

Votorx 09-20-2004 16:54

Yeah, you can combine what I said with pfn_touch and it should work.

johnjg75 09-21-2004 12:33

but how would u find out it was a vehicle? func_vehicle?

Votorx 09-21-2004 12:52

Well...Yeah.

Trp. Jed 09-21-2004 13:51

Depending on who touched who first you could check properties of the toucher and touchee entity (such as classname) to identify if they are ones you want to care about. Ones you've identified that they are, you'll need to write the relevant logic to make a descision on what to do.

An example from some code I've written in my own plugin:

Code:
// check if the grenade has hit something // public pfn_touch(ptr, ptd) {         // get the name of the touching entity     new classname[32]     entity_get_string(ptr, EV_SZ_classname, classname, 32)         // was it a smoke grenade?     if (equali(classname, "smoke_grenade")) {         // is it on the ground?         if (entity_get_int(ptr, EV_INT_flags) & FL_ONGROUND)         {             // handle smoke grenade hitting ground                 }else {                                              // hangle grenade hitting anything but ground         }     }     return PLUGIN_CONTINUE }

In this case ptr is the "toucher", ptd is the "touched". Im checking if the entity was of classname "smoke_grenade" and if it was on the ground.

You would use something similar but alter the logic to taste. However ptr and ptd are still valid.

Votorx 09-22-2004 13:01

Don't forget. The PTD (which is the touched) will always be the player (in this case where you want it to be inbetween a player and an ent).

johnjg75 09-22-2004 15:54

Quote:

Originally Posted by Votorx
Don't forget. The PTD (which is the touched) will always be the player (in this case where you want it to be inbetween a player and an ent).

always? it cant be when any other two entities touch that are not info_player_start and info_player_deathmatch?


All times are GMT -4. The time now is 17:19.

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