Jump to content

اخذ التيم


Recommended Posts

السلام عليكم

شباب ابي اعرف كيف ياخذ التيم, اذا كان هذا التيم

يقدر ياخذ الماركر اما اذا كان في تيم ثاني مايقدر

----

وابي كيف اخلي ماركر مايطلع الا لشخص واحد, اللى ضغط الزر

Link to comment

شوف هذا المثال ,

local marker = createMarker(...) -- نسوي ماركر # 
addEventHandler('onMarkerHit',marker, -- اذا لمس الماركر # 
function(player) -- نظيف العنصر للفنكشن # 
    if getElementType(player) == 'player' then -- نعرف العنصر انه لاعب # 
        if getPlayerTeam(player) and (getTeamName(getPlayerTeam(player)) == 'Blue' ) then -- تحقق اذا كان اللاعب في الفريق # (Blue) 
        setElementPosition(player,x,y,z) -- نرسله لإحداثيات محدده # 
            end -- اغلاق # 
        end -- اغلاق # 
    end,false -- اغلاق # 
) -- اغلاق # 

اذا تبي الي لمس الماركر يكون اللاعب لازم تتحقق ,

والسورس على حسب الايفنت ,

نشوف السورس حق onMarkerHit :

The source of this event is the marker that got hit by the element.

يعني السورس هو الماركر الي انلمس على كذا لازم نعرف اللاعب ذذ,

مثال ثاني ,

addEventHandler('onPlayerWasted',root, -- اذا مات اللاعب # 
function() -- وظيفه # 
    if getPlayerTeam(source) and (getTeamName(getPlayerTeam(source)) == 'Grove') then -- نتحقق اذا اللاعب في التيم (Grove) # 
    setPlayerTeam(source ,nil) -- نحذف اللاعب من التيم # 
        end -- اغلاق # 
    end -- اغلاق # 
) -- اغلاق # 

هنا السورس هو اللاعب الي مات , كيف عرفت ؟

نشوف الايفنت onPlayerWasted :

The source of this event is the player that died or got killed.

إن شاء الله فهمت ,

Edited by Guest
Link to comment

مو شرط يكون زر , يمكن يكون جريد ليست او لبل او زر او صوره ...الخ,

وتقدر تستخدمه بطريقتين ,

الطريقه الاولى اذا كان ما معك الا زر واحد فقط ,

addEventHandler('onClientGUIClick',Button, -- اذا ضغط على الزر # 
function() -- وظيفه # 
    -- كودك # 
    end,false -- اغلاق # 
) -- اغلاق # 

الطريقه الثانيه اذا كان عندك مثلا اكثر من زر ,

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

addEventHandler('onClientGUIClick',root, -- اذا ضغط على العنصر # 
function() 
    if source == Button then -- اذا ضغط على العنصر وهو الزر # 
        -- كودك # 
    elseif source == Image then -- اذا ضغط على الصوره # 
        -- كودك # 
        end -- اغلاق # 
    end -- اغلاق # 
) -- اغلاق # 
Link to comment

طيب وش احط هنا؟

addEventHandler ( "onClientGUIClick", root, 
    function() 
    if source == GUIEditor.button[1] then 
    if getPlayerTeam(source) and (getTeamName(getPlayerTeam(source)) == 'Civilian' ) then --وشش احط هنا؟؟؟؟ 
     guiSetEnabled ( GUIEditor.window[1], false ) 
     else 
     if not getPlayerTeam(source) == 'Civilian' then 
        guiSetVisible ( GUIEditor.window[1], false ) 
                showCursor ( false ) 
             end 
       end 
   end 
end 

Link to comment

آسف غلطت ذذ ,

ما يحتاج تحط if not...

+ تبي تجيب تيم الزر .؟

addEventHandler ( "onClientGUIClick", root, 
function() 
    if source == GUIEditor.button[1] then 
        if getPlayerTeam(localPlayer) and (getTeamName(getPlayerTeam(localPlayer)) == 'Civilian' ) then 
            guiSetEnabled ( GUIEditor.window[1], false ) 
     else 
        guiSetVisible ( GUIEditor.window[1], false ) 
                showCursor ( false ) 
                    guiSetEnabled ( GUIEditor.window[1], true ) 
            end 
        end 
    end 
) 

+ كذا اذا ضغط الزر راح يتقفل ,

واذا كان مو في التيم راح ينفتح الزر وتختفي النافذه ويختفي السهم ( الماوس)

Link to comment

هذا الكود كامل, مو عارف له xD

job = createMarker ( -2168.5, 243.39999389648, 34.299999237061, "cylinder", 1.5, 255, 255, 0, 170 ) 
  
function showUserPanel ( hitPlayer ) 
    if hitPlayer == localPlayer then 
    if guiGetVisible ( GUIEditor.window[1] ) then 
        guiSetVisible ( GUIEditor.window[1], false ) 
        showCursor ( false ) 
    else 
        guiSetVisible ( GUIEditor.window[1], true ) 
        showCursor ( true ) 
        if getPlayerTeam(localPlayer) and (getTeamName(getPlayerTeam(localPlayer)) == 'Civilian' ) then 
  guiSetEnabled ( GUIEditor.window[1], false ) 
  showCursor ( false ) 
  end 
    end 
    end 
end 
addEventHandler ( "onClientMarkerHit", job, showUserPanel ) 

Edited by Guest
Link to comment

الي فهمته انك تبي النافذه اذا لمس الماركر ما تفتح الا لتيم محدد ,

job = createMarker ( -2168.5, 243.39999389648, 34.299999237061, "cylinder", 1.5, 255, 255, 0, 170 ) 
  
addEventHandler('onClientMarkerHit',job, 
function(player) 
    if player == localPlayer then 
        if getPlayerTeam(player) and (getTeamName(getPlayerTeam(player)) == 'Clivian') then 
            if not guiGetVisible ( GUIEditor.window[1] ) then guiSetVisible ( GUIEditor.window[1], true ) showCursor ( true ) 
    else 
            outputChatBox('* You Must be in team (Clivian) ') 
                end 
            end 
        end 
    end,false 
) 
  
Link to comment

نفسها ,

انت سوي تحقق ,

اذا مثلا اللاعب في تيم محدد ,

if getPlayerTeam(player) and (getTeamName(getPlayerTeam(player)) == 'اسم الفريق') then return end 

وبكذا ما راح ينفذ الوظيفه ,

طبعا player على حسب الفنكشن او الايفنت مثل ما قلت لك ذذ

اما اذا كان قصدك انه تبيه اول مره يدخل ينفذ الوظيفه ومره ثانيه يدخل ما ينفذها ,

فـ استخدم الداتا,

setElementData 
getElementData 

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