Jump to content

addCommandHandler + create marker , آستفسآر عن


Recommended Posts

سلام عليكم

آلحين آنآ آبي لو كتبت كومآند يسوي مآركر , ولو دخلت آلمآركر هآدآ يطلع آسم آلي دخل فيه

آلمشكلة كيف آعرف آلمآركر ؟؟

addCommandHandler("mark",
	function ( player )
	local x,y,z = getElementPosition( player )
	local testMarker = createMarker ( x,y,z -1, "cylinder", 1.5, 255, 255, 0, 170 )
		outputChatBox("done create marker",player,0,255,0,true)
	end
)

addEventHandler( "onMarkerHit", root,
	function( hiter )
		if source == testMarker then
			outputChatBox(""..getPlayerName(hiter).." joined to marker",root,0,255,0,true)
		end
	end
)

 

Link to comment
12 minutes ago, Mr.Mostafa said:

سلام عليكم

آلحين آنآ آبي لو كتبت كومآند يسوي مآركر , ولو دخلت آلمآركر هآدآ يطلع آسم آلي دخل فيه

آلمشكلة كيف آعرف آلمآركر ؟؟


addCommandHandler("mark",
	function ( player )
	local x,y,z = getElementPosition( player )
	local testMarker = createMarker ( x,y,z -1, "cylinder", 1.5, 255, 255, 0, 170 )
		outputChatBox("done create marker",player,0,255,0,true)
	end
)

addEventHandler( "onMarkerHit", root,
	function( hiter )
		if source == testMarker then
			outputChatBox(""..getPlayerName(hiter).." joined to marker",root,0,255,0,true)
		end
	end
)

 

addCommandHandler("mark",
	function ( player )
	local x,y,z = getElementPosition(player)
	local testMarker = createMarker ( x,y,z -1, "cylinder", 1.5, 255, 255, 0, 170 )
		outputChatBox("done create marker",player,0,255,0,true)
	end
)

addEventHandler( "onMarkerHit", root,
	function ( hit )
			outputChatBox(""..getPlayerName(hit).." joined to marker",player,0,255,0,true)
	 end	
)

تفضل

Link to comment
34 minutes ago, Berko said:

addCommandHandler("mark",
	function ( player )
	local x,y,z = getElementPosition(player)
	local testMarker = createMarker ( x,y,z -1, "cylinder", 1.5, 255, 255, 0, 170 )
		outputChatBox("done create marker",player,0,255,0,true)
	end
)

addEventHandler( "onMarkerHit", root,
	function ( hit )
			outputChatBox(""..getPlayerName(hit).." joined to marker",player,0,255,0,true)
	 end	
)

تفضل

يب بس انت الحين ما عرفت اي ماركر الي الاعب دخله

افرض انا ابي اسوي اكتر من ماركر

Link to comment
1 hour ago, Mr.Mostafa said:

يب بعدين؟ 

كيف بعرف آلمآركر؟

ي حبيب قلبي , لما تسوي اللوكال التعريف راح ينحصر داخل الوظيفة الي تم وضع فيه التعريف
بس بدون اللوكال التعريف بيكون عام والجميع بيقدر يتعرف عليه ..

 

  • Like 1
Link to comment
5 hours ago, Berko said:

addCommandHandler("mark",
	function ( player )
	local x,y,z = getElementPosition(player)
	local testMarker = createMarker ( x,y,z -1, "cylinder", 1.5, 255, 255, 0, 170 )
		outputChatBox("done create marker",player,0,255,0,true)
	end
)

addEventHandler( "onMarkerHit", root,
	function ( hit )
			outputChatBox(""..getPlayerName(hit).." joined to marker",player,0,255,0,true)
	 end	
)

تفضل

اول شئ مسوي الماركر لوكل 

ثاني شئ في الاوتبوت شات بوكس مسوي 

player

في الحاله دي 

player = nil

لانوا مو معرف 

addCommandHandler("mark",
	function ( player )
	 	x,y,z = getElementPosition(player)
	 	testMarker = createMarker ( x,y,z -1, "cylinder", 1.5, 255, 255, 0, 170 )
	 	outputChatBox("done create marker",player,0,255,0,true)
	end
)

addEventHandler( "onMarkerHit", root,
	function ( hit )
    if source == testMarker then
			outputChatBox(getPlayerName(hit).." joined to marker",hit,0,255,0,true)
      end
	 end
  )

 

Edited by KillerX
  • Like 1
Link to comment
addCommandHandler ( 'Marker' , 
	function ( Player )
		Marker = createMarker ( Vector3 ( getElementPosition ( Player ) ) , 'arrow' ) 
		addEventHandler ( 'onMarkerHit' , Marker , 
			function ( Hit )
				outputChatBox ( getElementType ( Hit ) )
			end , false 
		)
	end 
)

 

Edited by #_iMr,[E]coo
Link to comment
21 minutes ago, #_iMr,[E]coo said:

addCommandHandler ( 'Marker' , 
	function ( Player )
		Marker = createMarker ( Vector3 ( getElementPosition ( Player ) ) , 'arrow' ) 
		addEventHandler ( 'onMarkerHit' , Marker , 
			function ( Hit )
				outputChatBox ( getElementType ( Hit ) )
			end , false 
		)
	end 
)

 

مايحتاج اكثر من افنت واحد ولا يحتاج جداول

تقدرون تسوون كذا بكل بساطة:

local markersParent = createElement('markersParent');

addCommandHandler('mark', function(player)
    local x, y, z = getElementPosition(player)
    local testMarker = createMarker(x, y, z -1, 'cylinder', 1.5, 255, 255, 0, 170)
    setElementParent(testMarker, markersParent)
    outputChatBox('done create marker', player, 0, 255, 0, true)
end)

addEventHandler('onMarkerHit', markersParent, function(hiter)
    if isElement(hiter) and getElementType(hiter) == 'player' then
        outputChatBox(getPlayerName(hiter)..' joined to marker', root, 0, 255, 0, true)
    end
end)

 

  • Like 1
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...