Jump to content

Help script gate gang


threevictor

Recommended Posts

Posted
Hello guys, I have this problem in this script was for him to open the door only for gangs, but it is opening for any player and is giving this one on the console as you can see below if you can help me thanks!

Imagem

                                                                                          CODE!

gate = createObject(971, 1543.400390625, -1628.2001953125, 15.89999961853, 0, 0, 90)
x,y,z = getElementPosition (gate)
zona = createColCircle ( x,y, 7, 7 )

function open()
   playerTeam = getPlayerTeam ( source )
   Clann = getTeamFromName ("BOPE")
   if (playerTeam) == Clann then
   moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 )
end
end
addEventHandler ( "onColShapeHit", zona, open )

function close()
    moveObject(gate, 2000, 1543.400390625, -1628.2001953125, 15.89999961853 )
end
addEventHandler ( "onColShapeLeave", zona, close )

 

Posted
57 minutes ago, ViRuZGamiing said:

use  hitElement not source, source is the colshape that's hit

 

The error is present in the console and continues to open to player outside the team :(

Posted (edited)
function open()
   playerTeam = getPlayerTeam ( hitElement )
   Clann = getTeamFromName ("BOPE")
   if (playerTeam) == Clann then
   moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 )
end
end
addEventHandler ( "onColShapeHit", zona, open )

Here you compare team element "playerTeam" with string "Clann". Try this:

function open()
   playerTeam = getPlayerTeam ( source )
   playerTeamName = getTeamName(playerTeam)
   Clann = getTeamFromName ("BOPE")
   if (playerTeamName == Clann) then
     moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 )
   end
end
addEventHandler ( "onColShapeHit", zona, open )

 

Edited by NeverUnbeatable
Posted (edited)

Try this and make sure that you're in the BOPE team.

 

gate = createObject(971, 1543.400390625, -1628.2001953125, 15.89999961853, 0, 0, 90)
x,y,z = getElementPosition (gate)
zona = createColCircle ( x,y, 7, 7 )

function open(element)
	local playerTeam = getPlayerTeam ( element )
	if ( playerTeam and playerTeam == getTeamFromName ("BOPE") ) then 
		if ( eventName == 'onColShapeHit' ) then 
			moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 )
		elseif ( eventName == 'onColShapeLeave' ) then 
			moveObject(gate, 2000, 1543.400390625, -1628.2001953125, 15.89999961853 )
		end 
	end
end
addEventHandler ( "onColShapeHit", zona, open )
addEventHandler ( "onColShapeLeave", zona, open )

 

Edited by !#NssoR_)
  • Like 1
Posted
58 minutes ago, NeverUnbeatable said:

function open()
   playerTeam = getPlayerTeam ( hitElement )
   Clann = getTeamFromName ("BOPE")
   if (playerTeam) == Clann then
   moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 )
end
end
addEventHandler ( "onColShapeHit", zona, open )

Here you compare team element "playerTeam" with string "Clann". Try this:


function open()
   playerTeam = getPlayerTeam ( source )
   playerTeamName = getTeamName(playerTeam)
   Clann = getTeamFromName ("BOPE")
   if (playerTeamName == Clann) then
     moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 )
   end
end
addEventHandler ( "onColShapeHit", zona, open )

 

Didn't see. He gets team element from name. Sry.

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