Deep thinker Posted December 4, 2016 Posted December 4, 2016 hello, i am promax and i am scripting disable killing between two teams ( Military , Police ) ,i have tried to make it but i have failed 100% :3 ,i just knew the functions from an ex post ,but it wasn't useful that much but it was maded by Iprestege (Fahad) he helped me lil a bit ,also taught me some new functions and i appreciate what he have done for me, the script that he gave me --this was my first try to make these teams can't get killed. local team = getTeamFromName (getLocalPlayer()) addEventHandler ( 'onClientPlayerDamage',root, function () if ( team == "Unemployed" ) or ( team == "Off Duty Workers" ) or ( team == "Civilian" ) or ( team == "Emergency" ) then if getElementData ( Player, "team" ) then cancelEvent() end end end ) ---------------------------------------------------------------------------------------------------------------------- --that was Iprestege's one addEventHandler ( 'onClientPlayerDamage',localPlayer, function ( aAttacker ) if ( aAttacker and getElementType ( aAttacker ) == 'player' and aAttacker ~= source ) then local aLocalTeam = getPlayerTeam ( source ) local aAttackerTeam = getPlayerTeam ( aAttacker ) if ( aLocalTeam and aAttackerTeam ) then if ( aLocalTeam == getTeamFromName ( 'Unemployed' ) and aAttackerTeam == getTeamFromName ( 'Police' ) ) then cancelEvent ( ) end end end end ) my question here ,how can i use table in Iprestege's one for the aAttackerTeam and aLocalTeam thank you :3
Dimos7 Posted December 4, 2016 Posted December 4, 2016 (edited) addEventHandler("onClientPlayerDamage", root, function() local team = getTeamName(getPlayerTeam(source)) if (team == "Unempolyed") or (team == "Off Duty Workers") or (team=="Emergency") then if getElementData(source, "team") then cancelEvent() end end end) addEventHandler("onClientPlayerDamage", root, function(attacker) if isElement(attacker) and getElementType(attacker) == "player" and attacker ~= source then local aLocalTeam = getPlayerTeam(source) local aAttackerTeam = getPlayerTeam(attacker) if aLocalTeam and aAttackerTeam then if aLocalTeam == getTeamFromName("Unempolyed") and aAttackerTeam == getTeamFromName("Police") then cancelEvent() end end end end) Edited December 4, 2016 by Dimos7
Deep thinker Posted December 4, 2016 Author Posted December 4, 2016 2 minutes ago, Dimos7 said: 6 minutes ago, Dimos7 said: if aLocalTeam == getTeamFromName("Unempolyed") and aAttackerTeam == getTeamFromName("Police") then in the first part i have already added the code which disabled death for (Unemployed , Civilian,Emergency ) then why did you disable death for him again. also you didn't explain anything about what you have done.
Dimos7 Posted December 4, 2016 Posted December 4, 2016 i make it so if other player is police don't die from him too because i first he not die from same teams
Deep thinker Posted December 4, 2016 Author Posted December 4, 2016 then switch the teams Unemployed should be in Police's team postion
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