Jump to content

[Help]Moving gate


+Razer+

Recommended Posts

Hey guys i have a problem in mapping i am making a base for my gang but i don't know how to make a moving gate

i try to make a gate but it was not working

object = createobject (975, 2596.3100585938, -2015.4100341797, 4.539999961853) 
maker  = createmarker (975, 2596.3100585938, -2015.4100341797, 4.539999961853, "Cylinder", 2, 100, 0, 0, 100) 
function gateo(player)  
  local skin = getElementModel (hitPlayer) 
    if skin ==248 then 
      moveobject(object, 100, 2599, -2015.4100341797, 4.539999961853) 
    else 
      outputChatBox("sorry, you're not a SoA member, this gate will not open for you.",player,255,0,0) 
    end 
end 
addEventHandler ("onMarkHit",gateo) 
function getec (player) 
    moveObject(object, 975, 2596.3100585938, -2015.4100341797, 4.539999961853) 
end 
addEventHandler("onMarkerLeave",getec) 

I watch a video in youtube but it was hard to understand :(

i want to make a gate which will open when a player will come near it and i also want that gate to open only for skin id 248

and sorry for my bad english :D

Link to comment
object = createObject ( 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
maker  = createMarker ( 2596.3100585938, -2015.4100341797, 4.539999961853, "cylinder", 2, 100, 0, 0, 100 ) 
  
function gateo ( player ) 
    local skin = getElementModel ( player ) 
    if ( skin == 248 ) then 
        moveObject ( object, 100, 2599, -2015.4100341797, 4.539999961853 ) 
    else 
        outputChatBox ( "sorry, you're not a SoA member, this gate will not open for you.", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit", maker, gateo ) 
  
function getec ( player ) 
    moveObject ( object, 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
end 
addEventHandler ( "onMarkerLeave", maker, getec ) 

Link to comment
object = createObject ( 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
maker  = createMarker ( 2596.3100585938, -2015.4100341797, 4.539999961853, "cylinder", 2, 100, 0, 0, 100 ) 
  
function gateo ( player ) 
    local skin = getElementModel ( player ) 
    if ( skin == 248 ) then 
        moveObject ( object, 100, 2599, -2015.4100341797, 4.539999961853 ) 
    else 
        outputChatBox ( "sorry, you're not a SoA member, this gate will not open for you.", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit", maker, gateo ) 
  
function getec ( player ) 
    moveObject ( object, 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
end 
addEventHandler ( "onMarkerLeave", maker, getec ) 

the marker you just created is in the gate

object = createObject ( 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
marker  = createMarker ( x,y,z - 2, "cylinder", 2, 100, 0, 0, 100 ) 
local x,z,y = getElementPosition( object ) 
  
function gateo ( player ) 
    local skin = getElementModel ( player ) 
    if ( skin == 248 ) then 
        moveObject ( object, 100, 2599, -2015.4100341797, 4.539999961853 ) 
    else 
        outputChatBox ( "sorry, you're not a SoA member, this gate will not open for you.", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker, gateo ) 
  
function getec ( player ) 
    moveObject ( object, 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
end 
addEventHandler ( "onMarkerLeave", marker, getec ) 
Link to comment
object = createObject ( 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
maker  = createMarker ( 2596.3100585938, -2015.4100341797, 4.539999961853, "cylinder", 2, 100, 0, 0, 100 ) 
  
function gateo ( player ) 
    local skin = getElementModel ( player ) 
    if ( skin == 248 ) then 
        moveObject ( object, 100, 2599, -2015.4100341797, 4.539999961853 ) 
    else 
        outputChatBox ( "sorry, you're not a SoA member, this gate will not open for you.", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit", maker, gateo ) 
  
function getec ( player ) 
    moveObject ( object, 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
end 
addEventHandler ( "onMarkerLeave", maker, getec ) 

the marker you just created is under the gate

object = createObject ( 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
marker  = createMarker ( x,y,z - 2, "cylinder", 2, 100, 0, 0, 100 ) 
local x,z,y = getElementPosition( object ) 
  
function gateo ( player ) 
    local skin = getElementModel ( player ) 
    if ( skin == 248 ) then 
        moveObject ( object, 100, 2599, -2015.4100341797, 4.539999961853 ) 
    else 
        outputChatBox ( "sorry, you're not a SoA member, this gate will not open for you.", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker, gateo ) 
  
function getec ( player ) 
    moveObject ( object, 975, 2596.3100585938, -2015.4100341797, 4.539999961853 ) 
end 
addEventHandler ( "onMarkerLeave", marker, getec ) 

lol? This isn't a problem he can change it castro code should work just fine.

Link to comment

ah i don't know why this gate is not moving up :cry:

object = createObject ( 980, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
marker  = createMarker ( 2495.7800292969,2772.9799804688,10.819999694824 , "cylinder", 2, 100, 0, 0, 255 ) 
  
function gateo ( player ) 
    local skin = getElementModel ( player ) 
    if ( skin == 287 ) then 
        moveObject ( object, 100, 2497.1799316406, 2773.2600097656, 18, 0, 0, 90.186767578125 ) 
    else 
        outputChatBox ( "sorry, you're not a USAS member, You can't enter in this base.", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onMarkerHit", maker, gateo ) 
  
function getec ( player ) 
    moveObject ( object, 980, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
end 
addEventHandler ( "onMarkerLeave", maker, getec ) 

I can see the gate but when i go near that gate it is not opening :cry:

Link to comment

you didnt checked the player's element

object = createObject ( 980, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
marker  = createMarker ( 2495.7800292969,2772.9799804688,10.819999694824 , "cylinder", 2, 100, 0, 0, 255 ) 
  
function gateo ( player ) 
local skin = getElementModel ( player ) 
    if getElementType( player ) == "player" then 
        if ( skin == 287 ) then 
           moveObject ( object, 100, 2497.1799316406, 2773.2600097656, 18, 0, 0, 90.186767578125 ) 
        else 
           outputChatBox ( "sorry, you're not a USAS member, You can't enter in this base.", player, 255, 0, 0 ) 
        end 
    end 
end  
addEventHandler ( "onMarkerHit", maker, gateo ) 
  
function getec ( player ) 
    if getElementType( player ) == "player" then 
    moveObject ( object, 980, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
    end 
end 
addEventHandler ( "onMarkerLeave", maker, getec ) 
Link to comment

Ah still it is not working the gate is not moving up and that Outputchatbox is also not working :x

object = createObject ( 980, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
marker  = createMarker ( 2495.7800292969,2772.9799804688,8, "cylinder", 2, 0, 0, 0, 255 ) 
  
function gateo ( player ) 
    if getElementType( player ) == "player" then 
        if ( skin == 287 ) then 
           moveObject ( object, 100, 2497.1799316406, 2773.2600097656, 18, 0, 0, 90.186767578125 ) 
        else 
           outputChatBox ( "sorry, you're not a USAS member, You can't enter in this base.", player, 255, 0, 0 ) 
        end 
    end 
end  
addEventHandler ( "onMarkerHit", maker, gateo ) 
  
function getec ( player ) 
    if getElementType( player ) == "player" then 
    moveObject ( object, 980, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
    end 
end 
addEventHandler ( "onMarkerLeave", maker, getec ) 

Link to comment

Test :D

   object = createObject ( 980, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
   markerx  = createMarker ( 2495.7800292969,2772.9799804688,10, "cylinder", 2, 0, 0, 0, 255 ) 
function gateo(thePlayer) 
if getElementModel( thePlayer ) == 248 then 
       moveObject (object, 2000, 2497.1799316406, 2773.2600097656, 18, 0, 0, 90.186767578125 ) 
        else 
           outputChatBox ( "sorry, you're not a USAS member, You can't enter in this base.", thePlayer, 255, 0, 0 ) 
           end 
end 
addEventHandler( "onMarkerHit", markerx, gateo ) 
  
function gatec(thePlayer) 
if getElementModel( thePlayer ) == 248 then 
       moveObject (object, 1000, 2497.1799316406, 2773.2600097656, 12.630000114441, 0, 0, 90.186767578125 ) 
end 
end 
addEventHandler( "onMarkerLeave", markerx, gatec ) 

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