AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   return damage. (https://forums.alliedmods.net/showthread.php?t=95608)

ƒa†es™ 06-25-2009 09:31

return damage.
 
Is it possible to make a plugin that can return damage like when a attacker hit victim the attacker will get slap.

--kml-- 06-25-2009 09:35

Re: return damage.
 
Oo

you can find it in the wiki

http://wiki.amxmodx.org/Half-Life_1_Game_Events#Damage


Quote:

Called when a player takes damage, to display the red locational indicators. The last three arguments is the origin of the damage inflictor or victim origin if inflictor isn't found. DamageType is a bitwise value usually consist of a single bit.


Note: To caputure this message,you should use "b" as the third parameter in the register_event() function.


Quote:

Name: Damage
Structure: byte DamageSave
byte DamageTake
long DamageType
coord CoordX
coord CoordY
coord CoordZ
And for Ham i guess is

Quote:

* Description: Usually called whenever an entity gets attacked by a hitscan (such as a gun) weapon.
* Use the get/set tr2 natives in fakemeta to handle the traceresult data.
* Do not use a handle of 0 as a traceresult in execution, use create_tr2() from Fakemeta
* to pass a custom handle instead. (Don't forget to free the handle when you're done.)
* Forward params: function(this, idattacker, Float:damage, Float:direction[3], traceresult, damagebits)
* Return type: None.
* Execute params: ExecuteHam(Ham_TraceAttack, this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits);
*/
Ham_TraceAttack,

xD

P.S : what is your Garena ACC? :D

shadow.hk 06-25-2009 10:20

Re: return damage.
 
PHP Code:

#pragma semicolon 1
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
public plugin_init()
{
 
register_plugin("Return Damage","0.1""shadow.hk");
 
 
RegisterHam(Ham_TakeDamage,"player","fwdHamTakeDamage",1);
}
public 
fwdHamTakeDamage(iVictiminflictoriAttackerFloat:iDamagebitDamage)
{
 new 
iHealth get_user_health(iAttacker);
 
 if(!(
<= iAttacker <= get_maxplayers()))
  return 
HAM_IGNORED;
 
 if(
get_user_team(iVictim) == get_user_team(iAttacker))
 {
  if(
iHealth iDamage <= 0)
   
user_silentkill(iAttacker);
 
  if(
is_user_alive(iAttacker))
   
set_pev(iAttacker,pev_health,iHealth iDamage);
 
  return 
HAM_SUPERCEDE;
 }
 
 return 
HAM_IGNORED;


Depending on what you want it for specifically... that script is for team attackers. Just change get_user_team to what you want, or any other conditional.


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

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