Raised This Month: $ Target: $400
 0% 

SpawnProtect and MirrorDMG examples for new API?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 09-13-2004 , 14:23   SpawnProtect and MirrorDMG examples for new API?
Reply With Quote #1

(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?
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
Colt
Junior Member
Join Date: Sep 2004
Old 09-14-2004 , 12:00   why?
Reply With Quote #2

Sorry, but I don't really understand what do you wish to do ? 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

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

Please have a look if you have the time, maybe you will find the errors It will be very nice! My team is impatient to put the plugin on the server
Colt is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 09-14-2004 , 12:10  
Reply With Quote #3

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.
__________________
hello, i am pm
PM is offline
BAILOPAN
Join Date: Jan 2004
Old 09-14-2004 , 12:24  
Reply With Quote #4

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.
__________________
egg
BAILOPAN is offline
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 09-14-2004 , 12:51  
Reply With Quote #5

wow, guess you weren't planning anyone wanting to block damage
Da Bishop is offline
Send a message via MSN to Da Bishop
mahnsawce
Senior Member
Join Date: Apr 2004
Location: internet
Old 09-14-2004 , 13:33  
Reply With Quote #6

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.
mahnsawce is offline
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 09-14-2004 , 14:27   Re: why?
Reply With Quote #7

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.
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-14-2004 , 14:56   Re: why?
Reply With Quote #8

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.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-14-2004 , 16:04  
Reply With Quote #9

oh god i cant wait dor the day I and T(+)rget..........................*im not saying anything else*
Freecode is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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