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 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.