Jump to content

gate don't open


Thivenin

Recommended Posts

gatecol = createColCircle ( 1105.59, -1794.6, 10 ) 
firstObject = createObject ( 974, 1105.59, -1794.6, 18.39, 0, 0, 90 ) 
secoundObject = createObject ( 974, 1105.59, -1798.99, 18.39, 0, 0, 90 ) 
moving = false 
  
function move ( thePlayer ) 
    if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "United States Olympic Committee" ) then 
        if ( moving ) then 
            return 
        end 
  
        if ( eventName == "onColShapeHit" ) then 
            moveObject ( firstObject, 1500, 1105.59, -1794.6, 18.39 ) 
            moveObject ( secoundObject, 1500, 1105.59, -1798.99, 18.39 ) 
            moving = true 
        else 
            moveObject ( firstObject, 1500, 1105.59, -1794.6, 0 ) 
            moveObject ( secoundObject, 1500, 1105.59, -1798.99, 0 ) 
            moving = true 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", gatecol, move ) 
addEventHandler ( "onColShapeLeave", gatecol, move ) 

hai all, I need help on that script, the gate is not opening ( I'm well in the team but not opening :( )

Link to comment
  
gatecol = createColCircle ( 1105.59, -1794.6, 10 ) 
firstObject = createObject ( 974, 1105.59, -1794.6, 18.39, 0, 0, 90 ) 
secoundObject = createObject ( 974, 1105.59, -1798.99, 18.39, 0, 0, 90 ) 
moving = false 
  
local function checkTeam (thePlayer)  
     return getPlayerTeam(thePlayer) == getTeamFromName("United States Olympic Committee");  
end;  
  
function move_hit (thePlayer)  
      if not checkTeam(thePlayer) then return; end;  
      moveObject ( firstObject, 1500, 1105.59, -1794.6, 18.39 ) 
      moveObject ( secoundObject, 1500, 1105.59, -1798.99, 18.39 ) 
      moving = true 
end;  
function move_leave(thePlayer) 
      if not checkTeam(thePlayer) then return; end;  
      moveObject ( firstObject, 1500, 1105.59, -1794.6, 0 ) 
      moveObject ( secoundObject, 1500, 1105.59, -1798.99, 0 ) 
      moving = true 
end;  
addEventHandler("onColShapeHit", gatecol, move_hit); 
addEventHandler("onColShapeLeave", gatecol, move_leave);  
  

Link to comment
  
gatecol = createColCircle ( 1105.59, -1794.6, 10 ) 
firstObject = createObject ( 974, 1105.59, -1794.6, 18.39, 0, 0, 90 ) 
secoundObject = createObject ( 974, 1105.59, -1798.99, 18.39, 0, 0, 90 ) 
moving = false 
  
local function checkTeam (thePlayer) 
    return getTeamName (getPlayerTeam ( thePlayer )) == "United States Olympic Committee";  
end; 
  
function move_hit (thePlayer) 
      if not checkTeam(thePlayer) then return; end; 
      moveObject ( firstObject, 1500, 1105.59, -1794.6, 18.39 ) 
      moveObject ( secoundObject, 1500, 1105.59, -1798.99, 18.39 ) 
      moving = true 
end; 
function move_leave(thePlayer) 
      if not checkTeam(thePlayer) then return; end; 
      moveObject ( firstObject, 1500, 1105.59, -1794.6, 0 ) 
      moveObject ( secoundObject, 1500, 1105.59, -1798.99, 0 ) 
      moving = true 
end; 
addEventHandler("onColShapeHit", gatecol, move_hit); 
addEventHandler("onColShapeLeave", gatecol, move_leave); 
  
  

Link to comment

Why dont you change the checkTeam function so it accepts 2 parameters, would make it alot easier in further scripting;

function checkTeam( thePlayer, theTeam ) 
    return getTeamName (getPlayerTeam ( thePlayer )) == theTeam; 
end 

All you have to do is change these lines;

if not checkTeam(thePlayer) then return; end 

to this;

if not checkTeam( thePlayer, "" ) then return; end 

Link to comment

yea thats better.

  
gatecol = createColCircle ( 1105.59, -1794.6, 10 ) 
firstObject = createObject ( 974, 1105.59, -1794.6, 18.39, 0, 0, 90 ) 
secoundObject = createObject ( 974, 1105.59, -1798.99, 18.39, 0, 0, 90 ) 
moving = false 
local USAcomiteeTeam = getTeamFromName("United States Olympic Committee");  
  
local function checkTeam (thePlayer, theTeam) 
    return getPlayerTeam(thePlayer) == theTeam; 
end; 
  
function move_hit (thePlayer) 
      if not checkTeam(thePlayer, USAcomiteeTeam) then return; end; 
      moveObject ( firstObject, 1500, 1105.59, -1794.6, 18.39 ) 
      moveObject ( secoundObject, 1500, 1105.59, -1798.99, 18.39 ) 
      moving = true 
end; 
function move_leave(thePlayer) 
      if not checkTeam(thePlayer,USAcomiteeTeam ) then return; end; 
      moveObject ( firstObject, 1500, 1105.59, -1794.6, 0 ) 
      moveObject ( secoundObject, 1500, 1105.59, -1798.99, 0 ) 
      moving = true 
end; 
addEventHandler("onColShapeHit", gatecol, move_hit); 
addEventHandler("onColShapeLeave", gatecol, move_leave); 
  
  

Link to comment

you can also skip this part;

local USAcomiteeTeam = getTeamFromName("United States Olympic Committee"); 

just use the parameter to this;

if not checkTeam(thePlayer, "United States Olympic Committee") then return; end 

else you will have to create alot of those team names haha. :3 will be easier if you have to reuse the team name over and over again, but for this its easier to just do it this way.

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