Focker Posted August 31, 2015 Posted August 31, 2015 I can do as a team can not attack neither can be attacked
Mr_Moose Posted August 31, 2015 Posted August 31, 2015 (edited) That will only prevent team members from attacking each others, not from being attacked and damaged by other teams. To protect a team from others you can disable damage for it's members by cancelling the event. function protect_team(attacker, weapon, bodypart) if not getPlayerTeam(source) or getPlayerTeam(source) ~= getTeamFromName("TEAM_NAME") then return end cancelEvent() -- Cancel otherwise end addEventHandler("onClientPlayerDamage", localPlayer, protect_team) Updated Edited August 31, 2015 by Guest
JR10 Posted August 31, 2015 Posted August 31, 2015 You have an extra end. And you don't need to check if source is not the localPlayer as the event is only attached to the localPlayer. function protect_team(attacker, weapon, bodypart) if getPlayerTeam(source) and getPlayerTeam(source) == getTeamFromName("TEAM_NAME") then cancelEvent() end end addEventHandler("onClientPlayerDamage", localPlayer, protect_team)
Mr_Moose Posted August 31, 2015 Posted August 31, 2015 Thanks JR10, guess I didn't woke up yet. Updated my post as well.
Focker Posted September 1, 2015 Author Posted September 1, 2015 but the player can attack and do not want to attack anybody or take damage
Mr_Moose Posted September 1, 2015 Posted September 1, 2015 toggleControl( player thePlayer, string control, bool enabled) Could be used to solve that, by disabling controls like fire, next/previous weapon and target you can stop the ability to attack other players. Here's a list of all available controls you can disable: https://wiki.multitheftauto.com/wiki/Control_names
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