Damage

From EventScripts Community Encyclopedia

Contents

Overview

Syntax: damage <target user> <damage> [<damage type> [<source userid>]]

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Description

Damages a player with specified amount of damage.


Note: It doesn't expand server variables. Prefix the command with es to expand variables (es damage).

Parameters

  • target user - the user(s) to be damaged
    • it can be userid, partial playername, steamid or any supported foreach player flag.
    • if using a # flag, preceeding it with ! will exclude the damage source.
  • damage - the amount of damage to give.
  • damage type - optional, specifies the type of damage to give, see Damage types. Defaults to fall damage (32).
  • source userid - optional, the player that causes the damage and who gets credit for it. If omitted, the source is the target userid or random player if non-userid was given as target.
    • Note: damage type must be specified in order to use source userid.


Damage types

0 		GENERIC 
1 		CRUSH 
2 		BULLET 
4 		SLASH 
8 		BURN 
16 		FREEZE 
32 		FALL       (default)
64 		BLAST 
128 		CLUB 
256 		SHOCK 
512 		SONIC 
1024 		ENERGYBEAM 
16384 		DROWN 
32768 		PARALYSE 
65536 		NERVEGAS 
131072 		POISON 
262144 		RADIATION 
524288 		DROWNRECOVER 
1048576 	CHEMICAL 
2097152 	SLOWBURN 
4194304 	SLOWFREEZE

The damage type might not make any difference depending on in which Source game this command is used in.

More information about different damage types is available at developer.valvesoftware.com.

Notes

  • Comes with EventScripts 1.5, is a corelib command.
  • The target user's armor value and damage type affect the real loss of health.
    • Damage type fall (32) ignores armor value and does precise damage to the players.
  • Fires player_hurt event for each user damaged, event_var(weapon) will be "point_hurt".
    • Be aware to check for (event_var(weapon) != "point_hurt") if using this command inside player_hurt event!

Examples

// Causes 100 extra damage by any attack
// If the player health values are normal, this makes all weapons
// cause instant death on hit, the attacker is credited normally
event player_hurt
{
  if (event_var(weapon) != "point_hurt") do
  {
    es damage event_var(userid) 100 32 event_var(attacker)
  }
}
// GODJonez's console hax
es_xset gjuserid 0
es_getuserid gjuserid GODJonez
es damage !#all 200 32 server_var(gjuserid)
// !#all causes all users on server to be damaged except for server_var(gjuserid) 

See also

blog comments powered by Disqus