Gravestone Posted March 25, 2016 Posted March 25, 2016 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 )
Addlibs Posted March 25, 2016 Posted March 25, 2016 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.
Gravestone Posted March 25, 2016 Author Posted March 25, 2016 (edited) Its working now. Thanks for the help. Edited March 25, 2016 by Guest
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now