Jump to content

help with this


Deep thinker

Recommended Posts

Posted

hello,today i needed a script which enables the friendlyfire between two teams among like 7 teams in the scoreboard but i didn't know what to type in the script or what functions or events should i use ,

i wish if someone gives me an example to make this script, thank you ,

Posted

actually i want you to explain something and tide the functions and events as  i say in the following sentences,I want check if the player who is shooting for example in "Team 1" and the anther one in "Team 2" if the both tried to kill each others they fail.

Posted

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

 

Posted
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
Posted
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

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...