Jump to content

Alliance


marty000123

Recommended Posts

Hey

I'm looking for a script with the following features:

We got a spawn script which has Town > Category > Class.

For example, Military Forces > US Army > Soldier.

But for some reason, the US Army always kills the SWAT team..

( Military Forces > S.W.A.T > S.W.A.T Soldier )

So I am looking for the script which makes players unable to kill SWAT as Army and to kill Army as SWAT.

So it's a kinda alliance between Categories.

So Military Forces > US Army > .. won't be able to kill Military Forces > US Army > .. and vice versa!

( Category can be seen as Team, so it will be like Town > Team > Class )

Thanks in advance!!!

Marty

Edited by Guest
Link to comment

no one will create something like that for free , you can use those function :

"getTeamName"

"getPlayerTeam"

"onClientPlayerDamage"

etc ...

i will make it easy for you , example army can't kill swat.

  
addEventHandler( "onClientPlayerDamage", root, 
function ( theAttacker ) 
    if ( isElement( source ) ) and ( isElement( theAttacker ) ) then --- check if is element ... 
        if ( getElementType(theAttacker) == "player" ) then 
if ( getTeamName( getPlayerTeam( theAttacker ) ) == "Army" ) and ( getTeamName( getPlayerTeam( source ) ) == "SWAT" ) then --- check teams  
                       cancelEvent() 
                    end 
  

Link to comment

That's pretty much all you need, just modify the if statement after your own conditions. 'theAttacker' is the player who attacked you and the source is the victim, you may also add this:

... source == localPlayer ... 

in your if statement to verify that the victim and local player actually are the same and that this event is cancelled for the correct player.

Link to comment
  
  
addEventHandler( "onClientPlayerDamage", root, 
function ( theAttacker ) 
    if  isElement( source ) and isElement( theAttacker )  then --- check if is element ... 
        if  getElementType(theAttacker) == "player"  then 
if getTeamName( getPlayerTeam( theAttacker ) ) == "Army"  and getTeamName( getPlayerTeam( source ) ) == "SWAT" then --- check teams 
                       cancelEvent() 
end 
end 
end 
                    end 
  

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