AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SpawnProtect and MirrorDMG examples for new API? (https://forums.alliedmods.net/showthread.php?t=5814)

ThantiK 09-13-2004 14:23

SpawnProtect and MirrorDMG examples for new API?
 
(I originally posted this in wrong forum, but may leave it there to see what replies I can get)

Would someone mind giving me any good examples on how to CATCH and BLOCK a damage event?

Right now I'm just using the normal damage event, getting attacker and victim, and afterwards setting the health back and applying the dmg to the attacker (for team attacking at least)

Could someone be kind enough to provide me with an example that uses the NEW engine/fakemeta natives to block the event completely, alter the data, then pass it on?

Colt 09-14-2004 12:00

why?
 
Sorry, but I don't really understand what do you wish to do :shock: ? I suppose you do something similar, but if you block the event, I think it will prevent the function to execute a new time if an other player TA while this event won't be finished.

Code:
public damage_info(attacker,victim,damage,wpnindex,hitplace,TA){     if (is_user_alive(victim) && TA) {         new hp = get_user_health( victim )         set_user_health( victim,hp + damage )     }     if ( is_user_alive(attacker) ){         new hp = get_user_health( attacker )         set_user_health( attacker,hp - damage )     } }

Excuse me if I don't undestand your question, I am not an expert :( , but I know those subjects about TA, Tk and Spawn protection because I've worked a lot to create DOD FF Manager, which has still bugs remaining I don't manage to solve :evil:

http://forums.alliedmods.net/showthread.php?t=5785

Please have a look if you have the time, maybe you will find the errors :wink: It will be very nice! My team is impatient to put the plugin on the server :)

PM 09-14-2004 12:10

Blocking the Damage event seems to be a bad idea for me; it only notifies the client of what has happened AFAIK. If you want to block the actual damage, you would have to think of something else. Anyway try the engine module's register_message function.

BAILOPAN 09-14-2004 12:24

You cannot block damage easily.

With fakemeta_amxx-0.20-20040914 build, I included the ability to hook and abstract TraceLine(), so in theory you could block traces and therefore block damage.

Otherwise the only way to do it is to catch the damage message, give the player tons of health, and hope they don't die.

Da Bishop 09-14-2004 12:51

wow, guess you weren't planning anyone wanting to block damage :?

mahnsawce 09-14-2004 13:33

Damage is handled entirely by the mod. There's no true way to actually block it, as Metamod (and thus AMX Mod X) can only hook stuff which is sent between the engine and the mod's game dll.

There are, however, a couple kinda hacky ways to block it. Such as blocking events which trigger damage. Some examples would be hooking traceline, which is used for hitscan weapons, or detecting when a grenade is about to explode and stop it, and handle it on your own.

Also there's a method which involves setting the players health to an extremely high amount (such as 1024 + actual health), and monitor it from there.

ThantiK 09-14-2004 14:27

Re: why?
 
Quote:

Originally Posted by Colt

Code:
public damage_info(attacker,victim,damage,wpnindex,hitplace,TA){     if (is_user_alive(victim) && TA) {         new hp = get_user_health( victim )         set_user_health( victim,hp + damage )     }     if ( is_user_alive(attacker) ){         new hp = get_user_health( attacker )         set_user_health( attacker,hp - damage )     } }

See, this bit of code is my problem. Because AWP headshots, etc tend to get past the script and people die and the damage handle starts acting really funny.

So basically the SDK hasn't provided a way to hook damage events, and the current way you guys are even handling these things are through your special programming magic...understandable. I was hoping that I could block the event from happening or handle it myself so I could get past this small flaw.

Twilight Suzuka 09-14-2004 14:56

Re: why?
 
Quote:

Originally Posted by ThantiK
Quote:

Originally Posted by Colt

Code:
public damage_info(attacker,victim,damage,wpnindex,hitplace,TA){     if (is_user_alive(victim) && TA) {         new hp = get_user_health( victim )         set_user_health( victim,hp + damage )     }     if ( is_user_alive(attacker) ){         new hp = get_user_health( attacker )         set_user_health( attacker,hp - damage )     } }

See, this bit of code is my problem. Because AWP headshots, etc tend to get past the script and people die and the damage handle starts acting really funny.

So basically the SDK hasn't provided a way to hook damage events, and the current way you guys are even handling these things are through your special programming magic...understandable. I was hoping that I could block the event from happening or handle it myself so I could get past this small flaw.

No way in hell Jose. The only way to do it would be with hooking the actual line, grabbing the message out of the engine dynamically, hard but not impossible, or using a server_frame to make sure AWP cant kill.

...or you could set up a small line to make sure they are ALIVE before doing anything. Lose a feature, lose a bug I suppose.

Freecode 09-14-2004 16:04

oh god i cant wait dor the day I and T(+)rget..........................*im not saying anything else* :D


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

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