Jacobob14 Posted May 19, 2014 Share Posted May 19, 2014 because the script leaves me working after a while function protect() for i, TEAMS in ipairs ( getElementsByType("team") ) do if ( getTeamFriendlyFire ( TEAMS ) == true ) then setTeamFriendlyFire ( TEAMS, false ) end end end addEventHandler("onResourceStart", resourceRoot, protect) Link to comment
Jacobob14 Posted May 19, 2014 Author Share Posted May 19, 2014 What? everything works fine but after a time the script stops working and teams can kill Link to comment
MIKI785 Posted May 19, 2014 Share Posted May 19, 2014 The script gets executed just on the resource's start. Use other event or use a timer. Link to comment
LonelyRoad Posted May 19, 2014 Share Posted May 19, 2014 Are you adding/removing teams after the resource start? This works fine, but only on teams that exist at resource start. Link to comment
TAPL Posted May 19, 2014 Share Posted May 19, 2014 You may have another script that enable the friendly fire again or as LonelyRoad said above. Link to comment
iPrestege Posted May 19, 2014 Share Posted May 19, 2014 addEventHandler ("onClientPlayerDamage",root, function ( attacker ) local attackerTeam = getPlayerTeam ( attacker ) local sourceTeam = getPlayerTeam ( source ) if ( attackerTeam == sourceTeam ) then cancelEvent ( ) end end ) P.S . It should be in the client side don't forget that. Link to comment
TAPL Posted May 19, 2014 Share Posted May 19, 2014 You miss the fact that the attacker may not exist or exist but not player or the attacker is the same person who got the damage. Link to comment
AboShanab Posted May 19, 2014 Share Posted May 19, 2014 addEventHandler ("onClientPlayerDamage",root, function ( attacker ) if ( attacker and getElementType ( attacker ) == "player" ) then if ( attacker ~= source ) then local attackerTeam = getPlayerTeam ( attacker ) local sourceTeam = getPlayerTeam ( source ) if ( attackerTeam == sourceTeam ) then cancelEvent () end end end end ) Link to comment
iPrestege Posted May 19, 2014 Share Posted May 19, 2014 You miss the fact that the attacker may not exist or exist but not player or the attacker is the same person who got the damage. Ops! Sorry I wrote that from my iPhone. 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