12-04-2008, 03:33 AM | #1 |
Banned
Join Date: Sep 2008
Class/Position: Soldier Gametype: AVD Affiliations: TALOS Posts Rated Helpful 5 Times
|
Headshot reward lua?
Can someone conjure some lua code for me that awards a player's team 10 points if he or she makes a successful (resulting in death) headshot on an enemy?
EDIT: Preferably 10 points for a regular kill and 20 for a headshot? Last edited by Bridget; 12-04-2008 at 03:41 AM. |
|
12-04-2008, 05:37 AM | #2 |
Stuff Do-er
Lua Team
Wiki Team Fortress Forever Staff |
This code is untested. It should give 20 team points per headshot (10 for regular kill, 10 bonus for headshots).
Code:
TEAM_POINTS_PER_KILL = 10 BONUS_TEAM_POINTS_PER_HEADSHOT = 10 player_onheadshot( shot_entity, shooter_entity ) if IsPlayer(shooter_entity) then local player = CastToPlayer(shooter_entity) local team = player:GetTeam() team:AddScore(BONUS_TEAM_POINTS_PER_HEADSHOT) end end player_killed( player, damageinfo ) -- Entity that is attacking local attacker = damageinfo:GetAttacker() -- If no attacker do nothing if not attacker then return end -- If attacker not a player do nothing if not IsPlayer(attacker) then return end local playerAttacker = CastToPlayer(attacker) local weapon = damageinfo:GetInflictor():GetClassName() -- If attacked by sniper rifle, add points if weapon == "ff_weapon_sniperrifle" then local team = playerAttacker:GetTeam() -- Add score to team team:AddScore(TEAM_POINTS_PER_KILL) end end
__________________
#FF.Pickup ยค Fortress-Forever pickups My Non-official Maps Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic Beta FF_Myth - FF_Redlight_Greenlight Sick of the people on the internet, always moanin'. They just moan. - Karl Pilkington |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|