Jump to content

تصحيح كود


Recommended Posts

الــسلام عليكمـ ورحمةة اللهه وبركـآتهه

يا شباب ياليت تشوفو وش مشكلة الكؤد ذآ

gate = createObject(980,2673.5,596.79998779297,16.89999961853,0,0,0) 
marker = createMarker(2674.3000488281,599,14,"cylinder",10,255,255,255,0) 
createTeam("Army",255,0,0) 
  
bindKey("tap","down", 
function (thePlayer) 
if (isElementWithInMarker(thePlayer,marker)) then 
if (getPlayerTeam (thePlayer) == getTeamFromName("Army") ) then 
moveObject(gate,1000,2673.5,596.79998779297,22,0,0,0) 
else 
outputChatBox("This Army Base...",thePlayer,255,255,0,true) 
end 
end 
end 
) 
  
function move2 (thePlayer) 
if (getPlayerTeam (thePlayer) == getTeamFromName("Army") ) then 
moveObject(gate,1000,2673.5,596.79998779297,16.89999961853,0,0,0) 
end 
end 
  
addEventHandler("onMarkerLeave",marker,move2) 
  

Link to comment
gate = createObject( 980, 2673.5, 596.79998779297, 16.89999961853, 0, 0, 0 ) 
marker = createMarker( 2674.3000488281, 599, 14, "cylinder", 10, 255, 255, 255, 0 ) 
createTeam( "Army", 255, 0, 0 ) 
  
function openGate( thePlayer ) 
    if isElementWithInMarker( thePlayer, marker ) then 
        if getPlayerTeam( thePlayer ) == getTeamFromName( "Army" ) then 
            moveObject( gate, 1000, 2673.5, 596.79998779297, 22, 0, 0, 0 ) 
        else 
            outputChatBox( "This Army Base...", thePlayer, 255, 255, 0, true ) 
        end 
    end 
end 
  
addEventHandler( "onResourceStart", resourceRoot,  
    function( ) 
        local armyPlayers = getPlayersInTeam( getTeamFromName( "Army" ) ) 
        if #armyPlayers > 0 then 
            for k,v in ipairs( armyPlayers ) do 
                bindKey( v, "tab", "down", openGate, v ) 
            end 
        end 
    end 
) 
  
addEventHandler( "onPlayerLogin", root,  
    function( ) 
        if getPlayerTeam( source ) == getTeamFromName( "Army" ) then 
            bindKey( source, "tab", "down", openGate, source ) 
        end 
    end 
) 
  
function closeGate( thePlayer ) 
    if getElementType( thePlayer ) == "player" then 
        if getPlayerTeam( thePlayer ) == getTeamFromName( "Army" ) then 
            moveObject( gate, 1000, 2673.5, 596.79998779297, 16.89999961853, 0, 0, 0 ) 
        end 
    end 
end 
addEventHandler( "onMarkerLeave", marker, closeGate ) 

Link to comment
^ إفرض ان اللاعب ماعنده تيم

ممكن يسبب أخطاء ؟

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

if false ==  getTeamFromName( "Army" ) then 

. . .

Link to comment
انت جرب الوظيفة كاملة ..

انا ماكان عندي تيم + البوابة تحركت

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

يعني انت مثلاً تسوي كذا

if getPlayerTeam(player) == getTeamFromName("3NAD") then 

وتيم عناد مهو موجود يعني التحقق رح يكون كذا

if false == false then 

اكيد المقارنة بتكون صحيحة

تاكد من التيم الي تتحقق منه اذا موجود

edit :

الموضوع انحرف عن مساره ذذ .. نكمل في الخاص

Link to comment
  
 local ob = createObject (  7910,  87,  1868.5, 22.700000762939,0,0, 180 ) 
 local mr = createMarker ( 86.5, 1867.1999511719, 18.39999961853, "cylinder", 15, 255, 0, 0, 0 ) 
  
addEventHandler( "onMarkerHit", mr, 
function ( player ) 
 local PlayerTeam = getPlayerTeam ( player ) 
 local TheTeam = getTeamFromName ( "ARMY" ) 
        if PlayerTeam == TheTeam then 
          moveObject(ob, 2000, 87, 1868.5, 28.5 ) 
       end 
end) 
  
addEventHandler("onMarkerLeave", mr, 
function ( player ) 
     moveObject ( ob, 2000, 87, 1868.5, 22.700000762939 ) 
end) 
  

هذا انا مجربه و شغال تمام

ملاحظه : اذا انت بسويه ل حرب العصابات

اسم الفريق بالكابتل

ARMY

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