Wisam Posted May 8, 2014 Share Posted May 8, 2014 I have a small team friendly fire script it makes the fire unharmful for teammates, and i wanted to add a new feature, its teammates cant damage each other's vehicles (when its being driven) Script: 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
Snow-Man Posted May 8, 2014 Share Posted May 8, 2014 if ( getTeamFriendlyFire ( theTeam ) == false ) then setTeamFriendlyFire ( theTeam, true ) end and you getPedOccupiedVehicle Link to comment
TAPL Posted May 9, 2014 Share Posted May 9, 2014 Try this and let me know if it worked. Client Side: addEventHandler("onClientVehicleDamage", root, function(attacker) if attacker and getElementType(attacker) == "player" then local driver = getVehicleController(source) if driver then local attackerTeam = getPlayerTeam(attacker) local driverTeam = getPlayerTeam(driver) if attackerTeam and driverTeam and attackerTeam == driverTeam then cancelEvent() end end end end) 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