Jump to content

giveMoney


Gravestone

Recommended Posts

Hello, I found this example of code on the wiki. So it basically give a reward of $10,000 to the player when he kills a person.

I want to disable the reward if the player who was killed is in the same team as the killer.

local team = getPlayerTeam(killer) 
local victim = getPlayerName ( source ) 
  
  
function rewardOnWasted ( ammo, killer, killerweapon, victim ) 
    if isPlayerInTeam(victim, team) then 
    return 
    end 
    if ( killer ) then  
        givePlayerMoney ( killer, 10000 ) 
             
    end 
end 
  
addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) 

Link to comment

Remove lines 6-8 and change line 9 to:

if ( killer and getPlayerTeam(killer) == getPlayerTeam(source) ) then 

(However, this code will give a reward for killing teamless players, unless the killer is also teamless)

Note bene: the source is the victim, and the last argument of the function (named victim) is actually the bodypart hit.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...