Jump to content

[help] cancelEvent()


HUNGRY:3

Recommended Posts

hello i made a script but it's not working

the problem is when the attacker has data of "bandit"

can't shoot the other who has data of Bandit

code :

function noshootteam(attacker, target ) 
if getElementData( attacker,"bandit") == true then 
    if getElementData( target,"bandit") == true then  
         outputChatBox ( "Don't kill your teammates!!!",attacker, 255, 0, 0 )  
         cancelEvent() 
    end 
end 
end 
addEventHandler ( "onClientPlayerWeaponFire", root, noshootteam ) 

Link to comment
  • Moderators

A easier solution would be cancelling:

Cancel: "onClientPlayerDamage" :idea:

Cancelling firing when your teammate jumps in front of you, is pretty complex stuff for a beginner scripter.

If you want that, you will have to work with: "onClientPreRender", getPedTargetStart, processLineOfSight, setControlState, etc.

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