Gravestone Posted March 25, 2016 Share 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 ) Link to comment
Addlibs Posted March 25, 2016 Share 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. Link to comment
Gravestone Posted March 25, 2016 Author Share Posted March 25, 2016 (edited) Its working now. Thanks for the help. Edited March 25, 2016 by Guest Link to comment
Addlibs Posted March 25, 2016 Share Posted March 25, 2016 Remove lines 6-8 (inclusive) [...] Link to comment
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