Castillo Posted September 17, 2010 Share Posted September 17, 2010 hey, i want to make when a player is on same team and he tryes to kill his teamate the health won't go down, i've done something but it won't work. function playerDamage ( attacker, weapon, bodypart, loss ) if attacker then if getElementType ( attacker ) == "vehicle" then cancelEvent() else local team = getPlayerTeam(source) local teamname = getTeamName(team) local team2 = getPlayerTeam(attacker) local teamname2 = getTeamName(team2) if teamname == teamname2 then --triggerClientEvent(source,"enableGodMode",source) cancelEvent() end end end end addEventHandler ( "onPlayerDamage", getRootElement(), playerDamage) thanks in advance. addEvent("enableGodMode", true) addEventHandler ("enableGodMode", getRootElement(), function() addEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent) end) Link to comment
dzek (varez) Posted September 17, 2010 Share Posted September 17, 2010 https://wiki.multitheftauto.com/wiki/SetTeamFriendlyFire ? Link to comment
Castillo Posted September 17, 2010 Author Share Posted September 17, 2010 varez said: https://wiki.multitheftauto.com/wiki/SetTeamFriendlyFire ? that was my old idea but dunno why it won't work O_o code was: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function () local allTeams = getElementsByType ( "team" ) for index, theTeam in ipairs(allTeams) do if ( getTeamFriendlyFire ( theTeam ) == true ) then setTeamFriendlyFire ( theTeam, false ) end end end) Link to comment
dzek (varez) Posted September 17, 2010 Share Posted September 17, 2010 hmm, what i don't like in games is that, that some of them treats friendly fire as when it's OFF - you can't kill your team mate, and some when it's ON. Try to reverse it, and set to true. And remove that "if" - you think it's really needed? Link to comment
Castillo Posted September 17, 2010 Author Share Posted September 17, 2010 varez said: hmm, what i don't like in games is that, that some of them treats friendly fire as when it's OFF - you can't kill your team mate, and some when it's ON.Try to reverse it, and set to true. And remove that "if" - you think it's really needed? Ok, when i will try when i get someone else. 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