Jump to content

Gate system


Nelson

Recommended Posts

Hello.I'm Nelson, an other MTA new scripter.I need some help with a gate system.I'm here till now

  
function createTheGate () 
   gate1 = createObject ( 2938, 984.8, 1480.7, 14.6 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
function openMyGate ( ) 
   moveObject ( gate1, 2938, 984.8, 1480.7, 16.6 ) 
       setTimer ( movingMyGateBack, 5000, 1 ) 
end 
getPlayerTeam ( ThePlayer, openMyGate ) 
  
function movingMyGateBack () 
   moveObject ( gate1, 2938, 984.8, 1480.7, 14.6 ) 
end 
  

can anyone help me?

Edited by Guest
Link to comment
Well, i just want to close a place with gate and to open only with teams.

are you want to do when you come near gate open and when you left gate close ?

if that you want your code wil be like this :

Server Side :

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
          gate1 = createObject ( 2938, 984.8, 1480.7, 14.6 ) 
        Marker = createMarker (  2938, 984.8, 1480.7, 14.6, "corona", Size, 0, 0, 255, 0 ) 
    end 
) 
  
function moveGate(player) 
    local PlayerTeam = getPlayerTeam ( player ) 
    local TeamN = getTeamFromName ( "TeamName" ) 
    if isElementWithinMarker ( player, Marker ) then 
        if PlayerTeam == TeamN then 
          moveObject ( gate1, 2938, 984.8, 1480.7, 16.6 ) 
     end 
end 
end 
addEventHandler("onMarkerHit",Marker, moveGate) 
  
function moveBack() 
     moveObject ( gate1, 2938, 984.8, 1480.7, 14.6 ) 
end 
addEventHandler("onMarkerLeave",Marker,moveBack) 
   

about the replace in code :

put size for marker line 4 for the size from player to gate wil open

and GoodLuck .

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