AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find grenade in relation to player position?? -- help m3h! (https://forums.alliedmods.net/showthread.php?t=6523)

ThantiK 10-05-2004 10:52

Find grenade in relation to player position?? -- help m3h!
 
Anyone have any idea if its possible to get the direction of DMG from a grenade? -- or would it be possible to write the coord of a grens position when it detonates?

I also need to find out how far away that point is (but I'm sure there is a distance function)...and at what angle its at...

Anyone mind pointing me in a good direction?

Johnny got his gun 10-05-2004 11:02

The Damage message sends the coords also for hegrens, at least in CS...

if my memory is right...

Try this, dunno if it still works, I had it commented out in one of my plugins:

Code:
register_event("Damage", "hedamage_event", "b", "2!0", "4!0", "5!0", "6!0")

Code:
public hedamage_event(id) {     new inflictor = entity_get_edict(id, EV_ENT_dmg_inflictor)     if (inflictor <= MAXPLAYERS)         return PLUGIN_CONTINUE     new classname2[8]     entity_get_string(inflictor, EV_SZ_classname, classname2, 7)     if (!equal(classname2, "grenade"))         return PLUGIN_CONTINUE     new bangorigin[3]     bangorigin[0] = read_data(4)     bangorigin[1] = read_data(5)     bangorigin[2] = read_data(6)     client_print(0, print_chat, "%d got hit by %d which is a %s, from %d, %d, %d", id, inflictor, classname2, bangorigin[0], bangorigin[1], bangorigin[2])     server_print("%d got hit by %d which is a %s, from %d, %d, %d", id, inflictor, classname2, bangorigin[0], bangorigin[1], bangorigin[2])     feathersnsqueek(bangorigin)     return PLUGIN_CONTINUE }

Now you do the math. :-) Kind of like the feathersnsqueek function name.

I think the coords are used in CS/HL to know where to make the red "hurt" icons you see on screen when you're being shot at.

The coords are integers here, might be a bad thing. Maybe you can get them to be more precise using register_message and reading them as floats.

ThantiK 10-05-2004 11:10

TY JGHG, thats much more than I expected from anybody. -- time for me to get to work.


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

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