Jump to content

[HELP]Bug with events area script(toggleControl)


Recommended Posts

So, now, I'm trying to make an Event's Area, where players can't kill each others. It worked, but when player leaves Area he can't aim, or fire ( I know I've set fire and aim_weapon as false ) . The problem is that I want to make them allowed to shoot and kill each other outside Event's area

. It's bugging players and they need to reconnect to fix the bugs. I don't see a good point on it, May you please help me to make players allowed to kill each other outside area and keep making them unable to shoot inside area ?

local col = createColCuboid ( -676.31543, -2143.39429, 20.17123, 200, 200, 200 ) 
local zone = createRadarArea ( -676.31543, -2143.39429, 200, 200, 0, 255, 0, 60 ) 
setElementData ( zone, "zombieProof", true ) 
  
function eventsArea ( hitElement, matchingDimension ) 
    if ( getElementType ( hitElement ) == "player" ) then 
        local accName = getAccountName ( getPlayerAccount ( hitElement ) ) 
        if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Everyone" ) ) then 
            toggleControl ( hitElement, "fire", false ) 
            toggleControl ( hitElement, "aim_weapon", false ) 
            toggleControl ( hitElement, "vehicle_fire", false ) 
            outputChatBox ( "Você entrou na área de Eventos", hitElement, 0, 255, 0 ) 
            end 
    end 
end 
addEventHandler ( "onColShapeHit", col, eventsArea ) 

Link to comment
local col = createColCuboid ( -676.31543, -2143.39429, 20.17123, 200, 200, 200 ) 
local zone = createRadarArea ( -676.31543, -2143.39429, 200, 200, 0, 255, 0, 60 ) 
setElementData ( zone, "zombieProof", true ) 
  
function eventsArea ( hitElement, matchingDimension ) 
    if ( getElementType ( hitElement ) == "player" ) then 
        local accName = getAccountName ( getPlayerAccount ( hitElement ) ) 
        if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Everyone" ) ) then 
            toggleControl ( hitElement, "fire", false ) 
            toggleControl ( hitElement, "aim_weapon", false ) 
            toggleControl ( hitElement, "vehicle_fire", false ) 
            outputChatBox ( "Você entrou na área de Eventos", hitElement, 0, 255, 0 ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", col, eventsArea ) 
  
function quited( hitElement ) 
    if ( getElementType ( hitElement ) == "player" ) then 
        local accName = getAccountName ( getPlayerAccount ( hitElement ) ) 
        if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Everyone" ) ) then 
            toggleControl ( hitElement, "fire", true ) 
            toggleControl ( hitElement, "aim_weapon", true ) 
            toggleControl ( hitElement, "vehicle_fire", true ) 
            outputChatBox ( "Você entrou na área de Eventos", hitElement, 0, 255, 0 ) -- modify this ! 
        end 
    end 
addEventHandler ( "onColShapeLeave", col, quited ) 

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