Difference between revisions of "Lua:player ondamage"
From Fortress Forever Wiki
Jump to navigationJump to searchLine 29: | Line 29: | ||
− | [[Category:Lua | + | [[Category:Lua Callbacks]] |
{{Infobox manual/Footer}} | {{Infobox manual/Footer}} |
Revision as of 15:24, 11 May 2009
This function may modify the info_damage global variable in the global scope. If it does, the damage the player takes will be changed. This means that the script for a map can make players recieve more or less damage through scripting. Here is an example script that makes the player take no damage from the super shotgun. function player_ondamage(player_id) ConsoleToAll(GetPlayerName(info_attacker).." shot "..GetPlayerName(player_id).." with a "..info_classname.." for "..info_damage.." damage") if info_classname == "ff_weapon_supershotgun" then ConsoleToAll("Take no damage from supershotty") info_damage = 0 end end Here's another example in case you wanted to not take damage from your own rockets: function player_ondamage( player_id ) -- Don't take rocket damage from ourselves if ( player_id == info_attacker ) then if ( info_classname == "rocket" ) then info_damage = 0 end end end |