Jump to content

طلب فنكشن


XPro

Recommended Posts

ابي فنشكن الي يتعرف على عدد الاعبين داخل الماركر

getPlayerCount الفنكشن الي اعطيتوني من قبل يجي كل الاعبين

مثلا انا الحين مسوي ماركر كيف اجيب عدد الاعبين الي داخلها بس مو الي خارجها؟

انتو لما اعطيتوني الفنكشن سويت كذا مثال

local hillArea = createColRectangle ( 165.5,399.79998779297,80 , 60 ) 
local radar = createRadarArea ( 165.5,399.79998779297 ,80 , 60, 166, 7, 216, 155 ) 
function hill_Enter ( thePlayer, matchingDimension ) 
        if (getElementType(thePlayer) == "player") then 
        if getPlayerCount (onColShapeHit) == 1 then 
    outputChatBox ("#000FF0ther is " .. getPlayerCount(onColShapeHit) .." #FFFFFFPlayer",getRootElement(),0,255,255,true) 
    elseif getPlayerCount (onColShapeHit) == 2 then 
    outputChatBox ("#000FF0ther is " .. getPlayerCount(onColShapeHit) .." #FFFFFFPlayer",getRootElement(),0,255,255,true) 
end 
end 
end 
addEventHandler ( "onColShapeHit", hillArea, hill_Enter ) 

Link to comment

عدلت لك على الكود

function getPlayersInColShape(col) 
    local players = 0 
    if col and getElementType(col) == "colshape" then 
        for i,player in ipairs(getElementsByType("player")) do 
            if isElementWithinColShape(player,col) then 
                players = players + 1 
            end 
        end 
    end 
    return players 
end 
  

يصير كذا

getPlayersInColShape(المتغير حق الكول شيب) 

Link to comment

خذ الكود الي انا حطيته لك

الي هو

function getPlayersInColShape(col) 
    local players = 0 
    if col and getElementType(col) == "colshape" then 
        for i,player in ipairs(getElementsByType("player")) do 
            if isElementWithinColShape(player,col) then 
                players = players + 1 
            end 
        end 
    end 
    return players 
end 

وحطيتلك مثال عليه !

Link to comment

# Example :

local hillArea = createColRectangle ( 165.5,399.79998779297,80 , 60 ) 
local radar = createRadarArea ( 165.5,399.79998779297 ,80 , 60, 166, 7, 216, 155 ) 
  
function getPlayersInColShape(col) 
    local players = 0 
    if col and getElementType(col) == "colshape" then 
        for i,player in ipairs(getElementsByType("player")) do 
            if isElementWithinColShape(player,col) then 
                players = players + 1 
            end 
        end 
    end 
    return players 
end 
  
function hillEnter ( thePlayer ) 
   if (getElementType(thePlayer) == "player") then 
        outputChatBox ( 'There ' ..getPlayersInColShape ( hillArea ).. 'In Col Shape.', 255, 255, 255, false ) 
    end 
end 
  
addEventHandler ( 'onColShapeHit', hillArea, hillEnter ) 

Edited.

Edited by Guest
Link to comment

ماركر ولا كول شيب؟

الي اشوفه بكودك كول شيب مو ماركر

مع علامة # عشان يجيب حجم الجدول getElementsWithinColShape إذا كان كول شيب تستخدم الفنكشن

# و العلامة getElementsWithinColShape عشان تجيب كول شيب الماركر و نفس الشي تستخدم معه getElementColShape إذا كان ماركر تستخدم

Link to comment

كول شيب انا مسوي

انا قلت بس ماركر لاني ضنيت مثلا انهم نفس الفنكشن و حتى اخليهم بس يفهموني

بس انا مسوي كول شيب

و مشكورين جاري التجريب

Edited by Guest
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...