AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Finding if player is aiming @ teammate... (https://forums.alliedmods.net/showthread.php?t=2118)

ThantiK 05-27-2004 00:49

Finding if player is aiming @ teammate...
 
How would I go about finding if a player is aiming at a teammate BEFORE he shoots?

Also, how would I block his shoot event from happening and deal the damage to him?

I'm having problems with a simple mirrordmg because AWP to the head, registers the death event pretty quickly and my spawn protect plugin, and mirrordmg plugin end up letting the user kill his teammate/opponent sometimes.

I'm looking for a way to combat this.

As of right now, I have a mirrordmg plugin that works...but I'd like a more refined one. Im taking dmg and healing the attacked player back and dealing damage to the attacker...

I'd like to be able to not even let the shot happen because AWPs seem to cause the deathevent to happen before dmg event.

ts2do 05-27-2004 10:20

of course u could get the damage event and the message arguments with the attacker and victim and use register_message like b4 and set_msg_block( get_user_msgid ( "Damage" ), BLOCK_ONCE )
and all this goes in a register_message ( which is a bit buggy coz it makes my server crash on map change )

AssKicR 05-27-2004 10:51

get_user_aiming(id,personaimedat,whereheaims, distance)

jtp10181 05-27-2004 11:00

Quote:

Originally Posted by AssKicR
get_user_aiming(id,personaimedat,whereheaims, distance)

wouldn't you have to call that every single frame to do what hes trying to do? using the engine (vexd) native that says it causes lag, heh.

AssKicR 05-27-2004 11:08

server_frame or set_task

devicenull 05-27-2004 17:34

Stay far away from server_frame, unless set_task wouldnt work

ThantiK 05-27-2004 18:29

Actually, I think I can try blocking the event. Thats actually what I need.

How would I go about checking and blocking the event? I just want to block it if they're trying to shoot a teammate.

Also, I'm trying to block death so just in case it is teammate, it doesn't kill them.

AssKicR 05-27-2004 19:04

u can't block death unless ur god

ThantiK 05-27-2004 20:07

I could have sworn there was an old amx plugin that blocked the death event for clan practices.

Peli 05-27-2004 20:12

Well maybe : If it checked if an admin put in some sort of a command that let the server/plugin know that they were practacing then it would give everyone godmode untill the round ended and then so on. Or maybe : I'm crazy. :)

ThantiK 05-27-2004 20:38

I have kind of a problem though. Why the hell does the deathevent happen BEFORE the dmgevent? -- is that just something AMX isn't handling correctly?

Is there a way to make sure it handles dmg events before deathevents?

ts2do 05-27-2004 20:52

just block the tk deathmessage with register_message...u can catch the message before the event is sent....I tried it b4 and it worked like a charm....only 1 problem....I got crashes every map change when I had the register_message in my plugin

PM 05-28-2004 06:06

Yes ts2do I also had that problem. A temporary fix (temporary because BAILOPAN has rewritten the Engine module, the bug should be fixed) is to block the message and register_event it. Works nicely for me :)

ThantiK 05-28-2004 06:35

Someone mind showing me an example of the register_message event? This is a relatively new function and not many plugins out there that use it.

and how to pass or not pass altered data?

and how to find out what events I can register?...this sounds VERY interesting and VERY useful.

BAILOPAN 05-28-2004 06:44

Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Test", "1.0", "BAILOPAN")     register_message(get_user_msgid("DeathMsg"), "hook_death") } public hook_death(msgid, msgdest, msgtarg) {     new args = get_msg_args()     new data[128]     new i = 0     server_print("Dumping message %d, dest=%d targ=%d", msgid, msgdest, msgtarg)     for (i=1; i<=args; i++) {         switch (get_msg_arg_type(i))         {             case ARG_STRING:                 get_msg_arg_string(i, data, 128)                 server_print("Argument %d=^"%s^"", i, data)             case ARG_COORD:                 server_print("Argument %d=^"%f^"", i, get_msg_arg_float(i))             case ARG_ANGLE:                 server_print("Argument %d=^"%f^"", i, get_msg_arg_float(i))             default:                 server_print("Argument %d=^"%d^"", i, get_msg_arg_int(i))         }     }     return PLUGIN_CONTINUE }

That will effectively dump the contents of any message... it's broken in 0.16, fixed in 0.20

Using the other functions you can find the definitive types and make new messages or edit the current one in real time.

That way you can actively block a message, for example:
if (get_msg_arg_int(2) == get_msg_arg_int(1))
return PLUGIN_HANDLED
block the message if the killer and victim are the same person

ts2do 05-28-2004 10:34

does returning it 1 actually block it? I thot u had to use set_msg_block( get_user_msgid ( "Damage" ), BLOCK_ONCE )

ThantiK 05-28-2004 11:59

wow, THANK YOU BAILO!

Thats some pretty sweet schtuff...

Can't wait for .20

BAILOPAN 05-28-2004 17:30

yes that blocks it


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

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