Jump to content

help with this


Deep thinker

Recommended Posts

check this i have thought in anther idea for me ,i have created teams which can't be able to get killed but i will use this

17 minutes ago, iPrestege said:

Do it like this : 

 


if getElementType ( YourAttacker ) == 'player' then

 

again here i just wanted to make these people unable to 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
)           

is it right,i don't have a virtual machine to test it? and i don't know how to make one i have the program but i didn't get it

 

Link to comment
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 ( 'TeamOne' ) and aAttackerTeam == getTeamFromName ( 'TeamTwo' ) ) then
            cancelEvent (   )
            end
        end
    end
end
)

 

Try this and replace 'TeamOne' and 'TeamTwo', With your teams.

  • Like 1
Link to comment
21 hours ago, iPrestege said:

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 ( 'TeamOne' ) and aAttackerTeam == getTeamFromName ( 'TeamTwo' ) ) then
            cancelEvent (   )
            end
        end
    end
end
)

 

Try this and replace 'TeamOne' and 'TeamTwo', With your teams.

what about my code is it correct ( the point of the script that i made is to make these teams can't be killed by others ) is it correct in any kind of ways?

and i will test your code.thank you

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...