Jump to content

كود بوابة


Mr.GD7H

Recommended Posts

Posted

السلام عليكم

شباب ابي كود بوابة اذا قربت منها تفتح واذا بعدت منها تقفل

ومابي لها تيم مخصص يعني اي واحد لاني ابي احط بوابه في البدايه تبع السيرفر

وبحثت بالمنتدى ماحصلت كلهم لازم اما تضغط تاب وتفتح

او

تقرب من البوابه بس لازم انت ب تيم مخصص

اتمنى فهمتم

وشكرا :)

~|لا اله الا الله|~

~|محمد رسسول الله|~

qVyjv.png
Posted

بحثت بالمنتدى ماحصلت كلهم لازم تيم معين انا مابي تيم ابي اي واحد تفتح معه البوابه

~|لا اله الا الله|~

~|محمد رسسول الله|~

qVyjv.png
Posted
local Object = createObject ( 980,x,y,z ) 
local Marker = createMarker ( x,y,z, "cylinder", 2, 255, 0, 0, 0 ) 
  
function OpenObject ( player ) 
    if isElementWithinMarker ( player, Marker ) then 
       if ( getElementData(player, "Group") == "اسم القروب الي في التاب" ) then 
            if not Open then 
                moveObject ( Object, 1500, x,y,z ) 
            else 
                moveObject ( Object, 1500, x, y, z ) 
            end 
            Open = not Open 
        else 
            outputChatBox ( "* You Must Be In 'اسم القروب هنا' ", player, 200, 0, 0, true ) 
        end 
    end 
end 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, v in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( v, "tab", "down", OpenObject ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, "tab", "down", OpenObject ) 
    end 
) 

ذا هو الكود الي لقيته بالمنتدى لاكن ذا اذا قربت من البوابه ودخلت الماركر لازم تضغط تاب وتفتح

ولازم تكون في تيم

انا مابي التيم يعني ابي الجميع يقدرون يفتحون البوابه ومابي لازم اضغط زر تاب بس ادخل الماركر وتفتح البوابه

اتمنى فهمت :D

~|لا اله الا الله|~

~|محمد رسسول الله|~

qVyjv.png
Posted
local Object = createObject ( 980,x,y,z ) 
local Marker = createMarker ( x,y,z, "cylinder", 2, 255, 0, 0, 0 ) 
  
function OpenObject ( player ) 
    if isElementWithinMarker ( player, Marker ) then 
            if not Open then 
                moveObject ( Object, 1500, x,y,z ) 
            else 
                moveObject ( Object, 1500, x, y, z ) 
            end 
            Open = not Open 
    end 
end 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, v in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( v, "tab", "down", OpenObject ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, "tab", "down", OpenObject ) 
    end 
) 

560x95_FFFFFF_FF9900_000000_000000.png

Posted
local Object = createObject ( 980,x,y,z ) 
local Marker = createMarker ( x,y,z, "cylinder", 2, 255, 0, 0, 0 ) 
  
function OpenObject ( player ) 
    if isElementWithinMarker ( player, Marker ) then 
            if not Open then 
                moveObject ( Object, 1500, x,y,z ) 
            else 
                moveObject ( Object, 1500, x, y, z ) 
            end 
            Open = not Open 
    end 
end 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, v in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( v, "tab", "down", OpenObject ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, "tab", "down", OpenObject ) 
    end 
) 

بدال الأزرار .. لانه هو يبيها يوم تقرب منه يفتح عطول بدون زر ولا شي onMarkerLeave + onMarkerHit خطأ شغلكـ مفروض تستخدم حدث

Posted
local Object = createObject ( 980, -2485.599609375, -615.2998046875, 134.30000305176 ) 
local Marker = createMarker ( -2484.5, -615.5, 131.48368835449, "cylinder", 2, 255, 0, 0, 0 ) 
  
function OpenObject ( player ) 
    if isElementWithinMarker ( player, Marker ) then 
            if not Open then 
                moveObject ( Object, 1500, 980, -2485.599609375, -615.2998046875, 137.30000305176 ) 
            else 
                moveObject ( Object, 1500, 980, -2485.599609375, -615.2998046875, 134.30000305176 ) 
            end 
            Open = not Open 
    end 
end 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, v in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( v, "tab", "down", OpenObject ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, "tab", "down", OpenObject ) 
    end 
) 

ماضبط معي $:

~|لا اله الا الله|~

~|محمد رسسول الله|~

qVyjv.png
Posted
-- Server Side # 
local x, y, z = -2485.599609375, -615.2998046875, 134.30000305176 
local Object = createObject ( 980, x, y, z ) 
local Marker = createMarker ( x, y, z, "cylinder", 5, 0, 0, 0, 0 ) 
  
function countPlayersInMarker ( marker ) 
    local players = 0 
    if marker and getElementType(marker) == "marker" then 
        for i,player in ipairs(getElementsByType("player")) do 
            if isElementWithinMarker(player,marker) then 
                players = players + 1 
            end 
        end 
    end 
    return players 
end 
  
function MoveObject ( theElm ) 
    if ( getElementType ( theElm ) == "player" ) then 
        if ( eventName == "onMarkerHit" ) then 
            if ( countPlayersInMarker ( Marker ) <= 1 ) then 
                moveObject ( Object, 1500, x, y, z + 3 ) 
            end 
        else 
            if ( countPlayersInMarker ( Marker ) == 0 ) then 
                moveObject ( Object, 1500, x, y, z ) 
            end 
        end 
    end 
end 
addEventHandler ( "onMarkerHit", Marker, MoveObject ) 
addEventHandler ( "onMarkerLeave", Marker, MoveObject ) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if ( isElementWithinMarker ( source, Marker ) ) and ( countPlayersInMarker ( Marker ) == 0 ) then 
            moveObject ( Object, 1500, x, y, z ) 
        end 
    end 
) 

Posted

يعطيكمم الف الف عافيه جميع من حب يساعدني :)

وضبط معي الكود الي ابيه وذا هو الي حاب يشوفه :mrgreen:

local Object = createObject ( 980, -2485.599609375, -615.2998046875, 134.30000305176, 0, 0, 259.99694824219 ) 
local Marker = createMarker ( -2484.5, -615.5, 131.48368835449, "cylinder", size, 0, 0, 0, 0 ) 
  
function countPlayersInMarker ( marker ) 
    local players = 0 
    if marker and getElementType(marker) == "marker" then 
        for i,player in ipairs(getElementsByType("player")) do 
            if isElementWithinMarker(player,marker) then 
                players = players + 1 
            end 
        end 
    end 
    return players 
end 
  
function MoveObject ( theElm ) 
    if ( getElementType ( theElm ) == "player" ) then 
        if ( eventName == "onMarkerHit" ) then 
            if ( countPlayersInMarker ( Marker ) <= 1 ) then 
                moveObject ( Object, 1500, -2485.599609375, -615.2998046875, 137.30000305176 + 3 ) 
            end 
        else 
            if ( countPlayersInMarker ( Marker ) == 0 ) then 
                moveObject ( Object, 1500, -2485.599609375, -615.2998046875, 134.30000305176 ) 
            end 
        end 
    end 
end 
addEventHandler ( "onMarkerHit", Marker, MoveObject ) 
addEventHandler ( "onMarkerLeave", Marker, MoveObject ) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if ( isElementWithinMarker ( source, Marker ) ) and ( countPlayersInMarker ( Marker ) == 0 ) then 
            moveObject ( Object, 1500, x, y, z ) 
        end 
    end 
) 

تمت الافاده من كنق

~|لا اله الا الله|~

~|محمد رسسول الله|~

qVyjv.png
Posted
theMarker = createMarker ( x, y, z, "cylinder", 2, 255, 255, 0, 170 ) -------- مكان الماركر x,y,z 
  
door = createObject ( ID, x, y, z ) ----- ايدي الاوبجكت ID والباب الايدي حقه 971 / مكان الباب x,y,z 
  
addEventHandler( "onMarkerHit", theMarker,function(element) ----عند الوقوف على الماركر 
    if getElementType(element) == 'player' then 
        moveObject ( door, time, x, y, z ) ------ وقت المستغرق لتحرك الاوبجكت يعني كم تبيه ياخذ وقت لين يوصل فوق time / المكان اللي راح يطلع له الباب x,y,z 
        end 
end) 
  
addEventHandler( "onMarkerLeave", theMarker,function(element) -------- عند الابتعاد عن الماركر 
    if getElementType(element) == 'player' then 
        moveObject ( door, time, x, y, z ) -------- الوقت المستغرق لوصول البوابة لمكانها الاصلي time / المكان الذي سيرجع اليه الباب وانصح ان يكون نفس احداثيات مكانه الاصلي x,y,z 
       end 
 end)   
  

350x20_FFFFFF_FFFFFF_000000_000000.png

type-460x42_cborder-000000_ctop-222222_cbottom-333333_ctext1-CCCCCC_ctext2-FFCC00_chighlight-FFCC00.png

Posted
يعطيكمم الف الف عافيه جميع من حب يساعدني :)

وضبط معي الكود الي ابيه وذا هو الي حاب يشوفه :mrgreen:

local Object = createObject ( 980, -2485.599609375, -615.2998046875, 134.30000305176, 0, 0, 259.99694824219 ) 
local Marker = createMarker ( -2484.5, -615.5, 131.48368835449, "cylinder", size, 0, 0, 0, 0 ) 
  
function countPlayersInMarker ( marker ) 
    local players = 0 
    if marker and getElementType(marker) == "marker" then 
        for i,player in ipairs(getElementsByType("player")) do 
            if isElementWithinMarker(player,marker) then 
                players = players + 1 
            end 
        end 
    end 
    return players 
end 
  
function MoveObject ( theElm ) 
    if ( getElementType ( theElm ) == "player" ) then 
        if ( eventName == "onMarkerHit" ) then 
            if ( countPlayersInMarker ( Marker ) <= 1 ) then 
                moveObject ( Object, 1500, -2485.599609375, -615.2998046875, 137.30000305176 + 3 ) 
            end 
        else 
            if ( countPlayersInMarker ( Marker ) == 0 ) then 
                moveObject ( Object, 1500, -2485.599609375, -615.2998046875, 134.30000305176 ) 
            end 
        end 
    end 
end 
addEventHandler ( "onMarkerHit", Marker, MoveObject ) 
addEventHandler ( "onMarkerLeave", Marker, MoveObject ) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if ( isElementWithinMarker ( source, Marker ) ) and ( countPlayersInMarker ( Marker ) == 0 ) then 
            moveObject ( Object, 1500, x, y, z ) 
        end 
    end 
) 

تمت الافاده من كنق

. حيآكـ ي الغالي

+ انا مسويه فوق ومعرف كل شي + انت ناسي تعوض مكان احداثيات حدث الخروج وشايل المتغير بنفس الوقت x, y, z لعلمكـ ما يحتاج تعوض الإحداثيات بمتغير

على احداثياتكـ x, y, z عشان كذا .. انسخ الكود الي حطيته لك فوق مرة ثانية ولاتعدل فيه اي شي .. وهو بيجيب الاحداثيات لحاله لأنه انا معرف

theMarker = createMarker ( x, y, z, "cylinder", 2, 255, 255, 0, 170 ) -------- مكان الماركر x,y,z 
  
door = createObject ( ID, x, y, z ) ----- ايدي الاوبجكت ID والباب الايدي حقه 971 / مكان الباب x,y,z 
  
addEventHandler( "onMarkerHit", theMarker,function(element) ----عند الوقوف على الماركر 
    if getElementType(element) == 'player' then 
        moveObject ( door, time, x, y, z ) ------ وقت المستغرق لتحرك الاوبجكت يعني كم تبيه ياخذ وقت لين يوصل فوق time / المكان اللي راح يطلع له الباب x,y,z 
        end 
end) 
  
addEventHandler( "onMarkerLeave", theMarker,function(element) -------- عند الابتعاد عن الماركر 
    if getElementType(element) == 'player' then 
        moveObject ( door, time, x, y, z ) -------- الوقت المستغرق لوصول البوابة لمكانها الاصلي time / المكان الذي سيرجع اليه الباب وانصح ان يكون نفس احداثيات مكانه الاصلي x,y,z 
       end 
 end)   
  

كودكـ فيه اخطاء كثير .. من ضمنها انه اذا انا خرجت من الماركر وفيه لاعب ثاني للحين بالماركر رح يقفل الاوبجكت عليه .. ثاني شي لنفرض انا كنت بداخل الماركر وطلعت من السيرفر بهالحالة ما رح يجي اشارة الى حدث الخروج من الماركر وبيضل الاوبجكت مفتوح .. وبعدين ليه مطول السالفة وانت تقدر تختصرها بكم سطر

+ :mrgreen: ماتشوف صاحب الموضوع حاط تمت الإفادة ؟ وش المعنى من ردكـ !! تبي تقول انه معكـ الكود ولا وش ؟

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