Jump to content

Gate problem.


ramzi

Recommended Posts

Hi guys,i have this gate code works fine but the gates open when i be far from them,how can i make the distance to open them so near?plz help me.

gate1 = createObject (980, -13.60, 2067.30,19, 0,0,90 ) 
    gatecol = createColCircle (-13.60, 2067.30,19,12.5,10 ) 
    local className = "Army" 
                    
function OpenGates (thePlayer) 
if ( getTeamName(getPlayerTeam(thePlayer)) == "Army" ) then 
    moveObject (gate1,2000,-13.60,2067.30, 24.799 ) 
    end 
    end 
    addEventHandler( "onColShapeHit", gatecol, OpenGates ) 
              
function CloseGates (thePlayer) 
if ( getTeamName(getPlayerTeam(thePlayer)) == "Army" ) then 
    moveObject (gate1,2000,-13.60, 2067.30,19 ) 
    end 
    end 
    addEventHandler( "onColShapeLeave", gatecol, CloseGates ) 

Link to comment

CreateColCircle has only 3 arguements.

Syntax

  
colshape createColCircle ( float fX, float fY, float radius ) 
  

So it should be

  
createColCircle ( X , Y, radius ) 
  

I hope this helps.

EDIT: All you need to do is

  
 createColCircle (-13.60,   2067.30,  19) -- Now decrease 19 
  

Link to comment

you can also use

createMarker ( float x, float y, float z, "cylinder" float size, 0, 0, 0, 255 ) -- change the alpha value to 0 to be invisible 

You can use the addEventHandler as input to the element.

addEventHandler("onMarkerHit", marker, FUNCTION_NAME)  -- server 

or

if isElementWithinMarker ( element , marker ) then -- if the element is within the marker 
--- FUNCTIONS 
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...