Jump to content

[Help]Gates


Recommended Posts

I want to make it open on team but can't get it i dont know how. Team name is Navy

local gate1 = createObject(980,-1530.9265136719,482.71939086914,8.6744327545166,0,0,0) 
local marker1 = createMarker(-1530.5067138672,482.19729614258,6.4375,"cylinder",8,255,0,0,0) 
  
function openGate() 
moveObject (gate1,1500,-1541.51,482.69,8.67) 
end 
addEventHandler("onClientMarkerHit",marker1,openGate) 
  
function closeGate() 
moveObject (gate1,1500,-1530.92,482.71,8.67) 
end 
addEventHandler("onClientMarkerLeave",marker1,closeGate) 

If you can please help me

Link to comment
I want to make it open on team but can't get it i dont know how. Team name is Navy
local gate1 = createObject(980,-1530.9265136719,482.71939086914,8.6744327545166,0,0,0) 
local marker1 = createMarker(-1530.5067138672,482.19729614258,6.4375,"cylinder",8,255,0,0,0) 
  
function openGate() 
moveObject (gate1,1500,-1541.51,482.69,8.67) 
end 
addEventHandler("onClientMarkerHit",marker1,openGate) 
  
function closeGate() 
moveObject (gate1,1500,-1530.92,482.71,8.67) 
end 
addEventHandler("onClientMarkerLeave",marker1,closeGate) 

If you can please help me

  
local gate1 = createObject(980,-1530.9265136719,482.71939086914,8.6744327545166,0,0,0) 
local marker1 = createMarker(-1530.5067138672,482.19729614258,6.4375,"cylinder",8,255,0,0,0) 
  
function openGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1541.51,482.69,8.67) 
end 
end 
addEventHandler("onClientMarkerHit",marker1,openGate) 
  
function closeGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1530.92,482.71,8.67) 
end 
end 
addEventHandler("onClientMarkerLeave",marker1,closeGate) 
  
  

edit refresh page

Link to comment

Doesn't work

look

local gate1 = createObject(980,-1530.9265136719,482.71939086914,8.6744327545166,0,0,0) 
local marker1 = createMarker(-1530.5067138672,482.19729614258,6.4375,"cylinder",8,255,0,0,0) 
  
function openGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1541.51,482.69,8.67) 
end 
end 
addEventHandler("onClientMarkerHit",marker1,openGate) 
  
function closeGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1530.92,482.71,8.67) 
end 
end 
addEventHandler("onClientMarkerLeave",marker1,closeGate) 

Link to comment
Doesn't work

look

local gate1 = createObject(980,-1530.9265136719,482.71939086914,8.6744327545166,0,0,0) 
local marker1 = createMarker(-1530.5067138672,482.19729614258,6.4375,"cylinder",8,255,0,0,0) 
  
function openGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1541.51,482.69,8.67) 
end 
end 
addEventHandler("onClientMarkerHit",marker1,openGate) 
  
function closeGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1530.92,482.71,8.67) 
end 
end 
addEventHandler("onClientMarkerLeave",marker1,closeGate) 

this server side

  
local gate1 = createObject(980,-1530.9265136719,482.71939086914,8.6744327545166,0,0,0) 
local marker1 = createMarker(-1530.5067138672,482.19729614258,6.4375,"cylinder",8,255,0,0,0) 
  
function openGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1541.51,482.69,8.67) 
end 
end 
addEventHandler("onMarkerHit",marker1,openGate) 
  
function closeGate(theTeam) 
if getElementModel( theTeam ) == Navy then 
moveObject (gate1,1500,-1530.92,482.71,8.67) 
end 
end 
addEventHandler("onMarkerLeave",marker1,closeGate) 
  
  
  

EDIT use

  

Link to comment
local gate1 = createObject(980,-1530.9265136719,482.71939086914,8.6744327545166,0,0,0) 
local marker1 = createMarker(-1530.5067138672,482.19729614258,6.4375,"cylinder",8,255,0,0,0) 
  
function openGate(player) 
  if getElementType(player) == "player" then -- check if a player element hit the marker 
    local team = getPlayerTeam" class="kw2">getPlayerTeam(player) -- geting player's team 
    if team and getTeamName(team) == "Navy" then -- if player is in team and team name is "Navy" 
      moveObject (gate1,1500,-1541.51,482.69,8.67)  
    end 
  end   
end 
addEventHandler("onClientMarkerHit",marker1,openGate) 
  
function closeGate(player) 
  if getElementType(player) == "player" then 
    local team = getPlayerTeam" class="kw2">getPlayerTeam(player) 
    if team and getTeamName(team) == "Navy" then 
       moveObject (gate1,1500,-1530.92,482.71,8.67) 
    end 
  end   
end 
addEventHandler("onClientMarkerLeave",marker1,closeGate) 

JasperRieken, use [lua] or

 tags please.

[b]volk-rus[/b], please stop posting nonsense like «if getElementModel( theTeam ) == Navy then» :D

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