XPro Posted August 2, 2015 Share Posted August 2, 2015 ابي فنشكن الي يتعرف على عدد الاعبين داخل الماركر 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
Naif Posted August 2, 2015 Share Posted August 2, 2015 https://wiki.multitheftauto.com/wiki/GetPlayersInMarker Link to comment
XPro Posted August 2, 2015 Author Share Posted August 2, 2015 عادي استخدمها على onColShapeHit ؟ Link to comment
XPro Posted August 2, 2015 Author Share Posted August 2, 2015 ColShape و الفنشكن الي يتعرف على العدد الي داخل ? Link to comment
Naif Posted August 2, 2015 Share Posted August 2, 2015 عدلت لك على الكود 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
XPro Posted August 2, 2015 Author Share Posted August 2, 2015 بس getPlayersInColShape مش موجود في الويكي Link to comment
Naif Posted August 2, 2015 Share Posted August 2, 2015 خذ الكود الي انا حطيته لك الي هو 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
i S6O Posted August 2, 2015 Share Posted August 2, 2015 (edited) # 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 August 2, 2015 by Guest Link to comment
#Wizard Posted August 2, 2015 Share Posted August 2, 2015 سطر 17 يتأكد ان الليمنت اذا كان لاعب صح عليه Link to comment
Naif Posted August 3, 2015 Share Posted August 3, 2015 ^ XX هو كان مسوي getElementsByType ! Link to comment
i S6O Posted August 3, 2015 Share Posted August 3, 2015 ^ XXهو كان مسوي getElementsByType ! معليش عدلته .. وكل الناس تخطي Link to comment
Naif Posted August 3, 2015 Share Posted August 3, 2015 لا عادي بس هو يقول انه صح وانا علمته انك عدلته Link to comment
TAPL Posted August 3, 2015 Share Posted August 3, 2015 ماركر ولا كول شيب؟ الي اشوفه بكودك كول شيب مو ماركر مع علامة # عشان يجيب حجم الجدول getElementsWithinColShape إذا كان كول شيب تستخدم الفنكشن # و العلامة getElementsWithinColShape عشان تجيب كول شيب الماركر و نفس الشي تستخدم معه getElementColShape إذا كان ماركر تستخدم Link to comment
XPro Posted August 4, 2015 Author Share Posted August 4, 2015 (edited) كول شيب انا مسوي انا قلت بس ماركر لاني ضنيت مثلا انهم نفس الفنكشن و حتى اخليهم بس يفهموني بس انا مسوي كول شيب و مشكورين جاري التجريب Edited August 4, 2015 by Guest Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now