Mr.unpredictable. Posted May 21, 2015 Posted May 21, 2015 You can use these functions to do that getPlayerTeam getTeamName cancelEvent onClientPlayerDamage
Bilal135 Posted May 21, 2015 Posted May 21, 2015 addEventHandler("onClientPlayerDamage", localPlayer, function() if getPlayerTeam(localPlayer) and getTeamName == "Team Name" then cancelEvent() else return false end end ) Untested.
WhoAmI Posted May 21, 2015 Posted May 21, 2015 Client side godModeTeams = { ["Name"] = true, } addEventHandler ( "onClientPlayerDamage", localPlayer, function ( ) local team = getPlayerTeam ( source ) if ( team and godModeTeams [ getTeamName ( team ) ] ) then cancelEvent ( ) end end )
Mr.unpredictable. Posted May 21, 2015 Posted May 21, 2015 (edited) addEventHandler("onClientPlayerDamage", localPlayer, function() if getPlayerTeam(localPlayer) and getTeamName == "Team Name" then cancelEvent() else return false end end ) Untested. Where is the element?Anyway, try this function Ebc ( attacker, weapon, bodypart ) local pt = getPlayerTeam(source) if (pt) then if getTeamName(pt) == "Team name" then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), Ebc ) Not tested Edited May 22, 2015 by Guest
xeon17 Posted May 21, 2015 Posted May 21, 2015 Are you guys kidding? What about this? setTeamFriendlyFire
Bilal135 Posted May 21, 2015 Posted May 21, 2015 (edited) Something like this? function friendlyFire() local team = getPlayerTeam(source) if team then if getTeamName(source) == "Team Name" then setTeamFriendlyFire(source, true) else return false end end end addEventHandler("onResourceStart", root, friendlyFire) Untested. Edited May 21, 2015 by Guest
Mr.unpredictable. Posted May 21, 2015 Posted May 21, 2015 Are you guys kidding?What about this? setTeamFriendlyFire It doesn't cancel the damage coming from fire.
Mr.unpredictable. Posted May 21, 2015 Posted May 21, 2015 (edited) Something like this? function friendlyFire() local team = getPlayerTeam() if team then if getTeamName(source) == "Team Name" then setTeamFriendlyFire(team, false) --Don't know if it should be 'source' or 'team' else return false end end end addEventHandler("onResourceStart", root, friendlyFire) Untested. setTeamFriendlyFire(team, true) -- edited Edited May 22, 2015 by Guest
ALw7sH Posted May 21, 2015 Posted May 21, 2015 Why source, source of onResourceStart is the resource started lol
Mr.unpredictable. Posted May 21, 2015 Posted May 21, 2015 I would just suggest to use this function Ebc ( attacker, weapon, bodypart ) local pt = getPlayerTeam(source) if (pt) then if getTeamName(pt) == "Team name" then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), Ebc )
xeon17 Posted May 21, 2015 Posted May 21, 2015 I would just suggest to use this function Ebc ( attacker, weapon, bodypart ) local pt = getPlayerTeam(source) if (pt) then if getTeamName(pt) == "Team name" then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), Ebc ) Simply no! addEventHandler('onResourceStart',resourceRoot, function () setTeamFriendlyFire(getTeamFromName('NAME'),false) end)
Mr.unpredictable. Posted May 21, 2015 Posted May 21, 2015 I would just suggest to use this function Ebc ( attacker, weapon, bodypart ) local pt = getPlayerTeam(source) if (pt) then if getTeamName(pt) == "Team name" then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), Ebc ) Simply no! addEventHandler('onResourceStart',resourceRoot, function () setTeamFriendlyFire(getTeamFromName('NAME'),false) end) Has i said before it will not cancel the damage coming from fire.
Mr.unpredictable. Posted May 21, 2015 Posted May 21, 2015 Why not? Because it's a bug which has been already reported on mantis. Just test it.
Moderators IIYAMA Posted May 22, 2015 Moderators Posted May 22, 2015 Damage from fire is most of the time not bounded to an attacker or the attacker weapon is unknown. Cancel using cancelEvent() would be hard under those conditions. The result will be in the end the same, it doesn't matter who owns the fire you simply die... So setTeamFriendlyFire would give the most performance. If you don't want fire in your server: addEventHandler("onClientPreRender",root, function () if isPedOnFire(localPlayer) then setPedOnFire(localPlayer,false) end end)
Mr.unpredictable. Posted May 22, 2015 Posted May 22, 2015 Damage from fire is most of the time not bounded to an attacker or the attacker weapon is unknown. Cancel using cancelEvent() would be hard under those conditions. The result will be in the end the same, it doesn't matter who owns the fire you simply die...So setTeamFriendlyFire would give the most performance. If you don't want fire in your server: addEventHandler("onClientPreRender",root, function () if isPedOnFire(localPlayer) then setPedOnFire(localPlayer,false) end end) This will cancel the damage from fire, You should test it. function Ebc ( attacker, weapon, bodypart ) local pt = getPlayerTeam(source) if (pt) then if getTeamName(pt) == "Team name" then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), Ebc )
Moderators IIYAMA Posted May 22, 2015 Moderators Posted May 22, 2015 That will dissable all damage, if he wants it that way then yes. But what I am trying to tell you is that you never know when the damage is caused by the fire.
Mr.unpredictable. Posted May 22, 2015 Posted May 22, 2015 The reason why i'm not suggesting him to use setteamfriendyfire function is because it has the following bugs -attacker can still kill with fire weapons -attacker can still kill with knife -attackera can still kill with vehicles And his question was how to set god mode to a team So i suggested him to use onClientPlayerDamage Even onClientPlayerDamage has a bug it still also allows attacker to kill with knife But it can easily be fixed by using the function onClientSteathKill.
Bilal135 Posted May 22, 2015 Posted May 22, 2015 To prevent knife kill, he can use. addEventHandler("onClientStealthKill", localPlayer, function() local team = getPlayerTeam(localPlayer) if not team then return false end local teamname = getTeamFromName("Team Name") if teamname then cancelEvent() else return false end end ) Untested.
xeon17 Posted May 22, 2015 Posted May 22, 2015 To prevent knife kill, he can use. addEventHandler("onClientStealthKill", localPlayer, function() local team = getPlayerTeam(localPlayer) if not team then return false end local teamname = getTeamFromName("Team Name") if teamname then cancelEvent() else return false end end ) Untested. Very bad scripted, this will check does the team exists and not if the player is in team It should be like this, didn't tested it though addEventHandler('onPlayerStealthKill',root, function (targetPlayer) team = getPlayerTeam(source) if team then if team ~= getPlayerTeam(targetPlayer) cancelEvent() end end)
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