SHOW:
|
|
- or go back to the newest paste.
| 1 | - | function preventDM ( attacker, attacker2 ) |
| 1 | + | function preventDM(attacker) |
| 2 | - | if ( attacker2 ) and ( attacker ) and ( attacker ~= attacker2 ) then |
| 2 | + | if (attacker and getElementType(attacker) == "player") then |
| 3 | - | local attackerTeam = ( getTeamName( getPlayerTeam( attacker ) ) ) |
| 3 | + | local attackerTeam = getTeamName(getPlayerTeam(attacker)) |
| 4 | - | local sourceTeam = ( getTeamName( getPlayerTeam( attacker2 ) ) ) |
| 4 | + | local sourceTeam = getTeamName(getPlayerTeam(source)) -- source is the player who got damaged |
| 5 | - | if ( getElementDimension ( attacker ) == 0 and getElementDimension ( attacker2 ) == 0 ) then |
| 5 | + | if (getElementDimension(attacker) == 0 and getElementDimension(source) == 0) then |
| 6 | - | if ( attackerTeam == "Criminals" ) then |
| 6 | + | if (attackerTeam == "Criminals") then |
| 7 | - | if ( sourceTeam == "Criminals" ) or ( sourceTeam == "Civilian Workers" ) then |
| 7 | + | if (sourceTeam == "Criminals" or sourceTeam == "Civilian Workers") then |
| 8 | return false | |
| 9 | - | else |
| 9 | + | |
| 10 | - | return true |
| 10 | + | return true |
| 11 | elseif (attackerTeam == "Civilian Workers") then | |
| 12 | - | elseif ( attackerTeam == "Civilian Workers" ) then |
| 12 | + | if (sourceTeam == "Criminals" or sourceTeam == "Civilian Workers") then |
| 13 | - | if ( sourceTeam == "Criminals" ) or ( sourceTeam == "Civilian Workers" ) then |
| 13 | + | |
| 14 | end | |
| 15 | - | else |
| 15 | + | return true |
| 16 | - | return true |
| 16 | + | |
| 17 | - | end |
| 17 | + | |
| 18 | end | |
| 19 | end | |
| 20 | addEventHandler("onClientPlayerDamage", root, preventDM) |