Jump to content

getElementType


Recommended Posts

"Military"السلام عليكم انا كنت بعمل كود لما ادوس علي السيارة ينقلني مكان و بعد تاني بس مش عارف و عايز اخليها ل فريق

 
addEventHandler ( "onResourceStart", getRootElement(),
function()
local marker1 = createMarker( 190.89999, 1931.6, 24.3,"arrow",1.5,255,0,0,255)
local MOC = createVehicle ( 407, 210.75168, 1872.98572, 18.08962 )
end)
 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), --This Part should be edited.
function()
local playerTeam = getPlayerTeam ( source )
if not getPlayerTeam(source) and getPlayerTeam(source) ~= getTeamFromName("Military") then return removePedFromVehicle( source ) end
end)

function elementClicked( theButton, theState, thePlayer )
    if theButton == "left" and theState == "down" then -- if left mouse button was pressed down
 if getElementType ( elementClicked ) == "vehicle" and getElementModel ( elementClicked ) == 407 then
    setElementPosition( thePlayer, 191.89999, 1931.6, 24.3)
    setElementDimension( thePlayer, 6000)
    else return outputChatBox("You Should be a Military Officer to get in the MOC",source)
    end
         end
         end
     
addEventHandler( "onElementClicked", getRootElement(), elementClicked )

 

Link to comment
11 hours ago, mr.pop said:

if not getPlayerTeam(source) and getPlayerTeam(source) == getTeamFromName("Military")

جرب و ردلي

اشتغلت

بس الفنكشن دة مش شغال 

function elementClicked( theButton, theState, thePlayer )
    if theButton == "left" and theState == "down" then -- if left mouse button was pressed down
 if getPlayerTeam(source) and getPlayerTeam(source) == getTeamFromName("Military") then
    if getElementType ( elementClicked ) == "vehicle" and getElementModel ( elementClicked ) == 407 then
    setElementPosition( thePlayer, 191.89999, 1931.6, 24.3)
    setElementDimension( thePlayer, 6000)
    else return outputChatBox("You Should be a Military Officer to get in the MOC",source)
    end
         end
         end
         end
addEventHandler( "onElementClicked", getRootElement(), elementClicked )

اسف للرد المتاخر

Link to comment
addEventHandler ( "onElementClicked", root, 
	function ( button, state, player )
		if ( button == "left" and state == "down" ) then
			if ( getElementType ( source ) == "vehicle" and getElementModel ( source ) == 407 ) then
				if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Military" ) then
					setElementDimension ( source, 60000 )
					setElementPosition ( source, 191.89999, 1931.6, 24.3 )
				else
					outputChatBox ( "You Should be a Military Officer to get in the MOC", player, 255, 0, 0 )
				end
			end
		end
	end
)

 

  • Like 1
Link to comment
16 minutes ago, ` Allawi said:

addEventHandler ( "onElementClicked", root, 
	function ( button, state, player )
		if ( button == "left" and state == "down" ) then
			if ( getElementType ( source ) == "vehicle" and getElementModel ( source ) == 407 ) then
				if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Military" ) then
					setElementDimension ( source, 60000 )
					setElementPosition ( source, 191.89999, 1931.6, 24.3 )
				else
					outputChatBox ( "You Should be a Military Officer to get in the MOC", player, 255, 0, 0 )
				end
			end
		end
	end
)

 

انت عملت غلطة واحدة و اللي هي دي 

 

31 minutes ago, ProMax said:

شغلت الكود الغلط كان في "elementClicked" غيرتها ب "source"  

"source" المقصود بيها في الايفنت الحاجة المضغوط عليها كليك

هنا هو السيارةSourceال

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

بس شكرا انت صلحت التيم 

لو ينفع ممكن تعلمني ازاي احط 

fadeCamer

Link to comment
20 minutes ago, ProMax said:

انت عملت غلطة واحدة و اللي هي دي 

 

هنا هو السيارةSourceال

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

بس شكرا انت صلحت التيم 

لو ينفع ممكن تعلمني ازاي احط 

fadeCamer

أنا ما عملت غلطة ركز في الأكواد :-?

تبي تحط الـ

fadeCamera

في الكود نفسه ؟

  • Like 1
Link to comment
3 minutes ago, ` Allawi said:

أنا ما عملت غلطة ركز في الأكواد

 انا جربته باللعبة + ان الويكي بيقول ان السورس هو الاليمنت المضغوط عليه

Source

The source of this event is the element that got clicked by the player.

5 minutes ago, ` Allawi said:

في الكود نفسه ؟

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

بس ممكن طلب انا مش عارف اشغل الماركر في الديمنشن 

function teleport()
local posX, posY, posZ = getElementPosition ( MOC )
local dimension = getElementDimension( MOC )
if ( getElementType ( player ) ) then
setElementPosition ( player, posX, posY, posZ )
setElementDimension ( player, dimension )
end 
end
addEventHandler("onMarkerHit",myMarker,teleport)

 

Link to comment
3 minutes ago, ProMax said:

 انا جربته باللعبة + ان الويكي بيقول ان السورس هو الاليمنت المضغوط عليه

Source

The source of this event is the element that got clicked by the player.

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

بس ممكن طلب انا مش عارف اشغل الماركر في الديمنشن 


function teleport()
local posX, posY, posZ = getElementPosition ( MOC )
local dimension = getElementDimension( MOC )
if ( getElementType ( player ) ) then
setElementPosition ( player, posX, posY, posZ )
setElementDimension ( player, dimension )
end 
end
addEventHandler("onMarkerHit",myMarker,teleport)

 

MOC  ??

  • Like 1
Link to comment
11 minutes ago, ProMax said:

 انا جربته باللعبة + ان الويكي بيقول ان السورس هو الاليمنت المضغوط عليه

Source

The source of this event is the element that got clicked by the player.

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

بس ممكن طلب انا مش عارف اشغل الماركر في الديمنشن 


function teleport()
local posX, posY, posZ = getElementPosition ( MOC )
local dimension = getElementDimension( MOC )
if ( getElementType ( player ) ) then
setElementPosition ( player, posX, posY, posZ )
setElementDimension ( player, dimension )
end 
end
addEventHandler("onMarkerHit",myMarker,teleport)

 

 

أنا عارف هذا الشيء

بس ممكن تقولي أنا في سطر كم مستخدمة غلط ؟

:-?:-?

setElementDimension ( myMarker, dimension )

ضع الكود هذا تحت الماركر

وأستبدل الـ

dimension

بالرقم اللي تبيه

  • Like 1
Link to comment
1 minute ago, ` Allawi said:

بس ممكن تقولي أنا في سطر كم مستخدمة غلط ؟

7\6

4 minutes ago, ` Allawi said:

ضع الكود هذا تحت الماركر

انت مفهمتش قصدي

الماركر في ديمنشن 6000 بس انا كل م احاول ادخل الماركر واروح علي المكان اللي فيه السيارة 

function teleport()
local posX, posY, posZ = getElementPosition ( MOC )
local dimension = getElementDimension( MOC )
if ( getElementType ( player ) ) then
setElementPosition ( player, posX, posY, posZ )
setElementDimension ( player, dimension )
end 
end
addEventHandler("onMarkerHit",myMarker,teleport)

 

Link to comment
6 minutes ago, ProMax said:

7\6

انت مفهمتش قصدي

الماركر في ديمنشن 6000 بس انا كل م احاول ادخل الماركر واروح علي المكان اللي فيه السيارة 


function teleport()
local posX, posY, posZ = getElementPosition ( MOC )
local dimension = getElementDimension( MOC )
if ( getElementType ( player ) ) then
setElementPosition ( player, posX, posY, posZ )
setElementDimension ( player, dimension )
end 
end
addEventHandler("onMarkerHit",myMarker,teleport)

 

if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Military" ) then -- تحقق إذا كان أللاعب ألذي قام بالضغط في تيم "Military"
setElementDimension ( source, 60000 ) -- وضع ألشيء ألذي تم ألضغط عليه في عالم غير ألعالم الإفتراضي

  -- وين الغلط ؟؟

 

تصحيح ألكود حقك

addEventHandler ( "onMarkerHit", myMarker, 
	function ( player )
		if ( getElementType ( player ) == "player" ) then
			local posX, posY, posZ = getElementPosition ( MOC )
			setElementPosition ( player, posX, posY, posZ )
			setElementDimension ( player, getElementDimension ( MOC ) )
		end 
	end
)

 

Link to comment
7 minutes ago, ` Allawi said:
  • if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Military" ) then -- تحقق إذا كان أللاعب ألذي قام بالضغط في تيم "Military"
  • setElementDimension ( source, 60000 ) -- وضع ألشيء ألذي تم ألضغط عليه في عالم غير ألعالم الإفتراضي
  •  
  • -- وين الغلط ؟؟

الغلط بكلمة "Source" مينفع تشتغل بالايفينت دة علي اساس انها لاعب بس بتشتغل علي اساس انها الاليمينت اللي اللاعب ضغط عليه

9 minutes ago, ` Allawi said:

addEventHandler ( "onMarkerHit", myMarker, 
	function ( player )
		if ( getElementType ( player ) == "player" ) then
			local posX, posY, posZ = getElementPosition ( MOC )
			setElementPosition ( player, posX, posY, posZ )
			setElementDimension ( player, getElementDimension ( MOC ) )
		end 
	end
)

 

مش شغال جربته

Link to comment
6 minutes ago, ProMax said:

الغلط بكلمة "Source" مينفع تشتغل بالايفينت دة علي اساس انها لاعب بس بتشتغل علي اساس انها الاليمينت اللي اللاعب ضغط عليه

مش شغال جربته

أنا فكرت تبي تنقل ألسيارة بس خلاص تقدر تستبدلها بـ player

وتنقل أللاعب المكان اللي تبيه

--

وألكود اللي وضعته فوق صحيح ومافيه خطا تاكد من أكوادك

Link to comment
5 minutes ago, ` Allawi said:

أنا فكرت تبي تنقل ألسيارة بس خلاص تقدر تستبدلها بـ player

وتنقل أللاعب المكان اللي تبيه

--

وألكود اللي وضعته فوق صحيح ومافيه خطا تاكد من أكوادك

بيعطيني 

WARNING: MOC\server.lua:43:Bad argument @'addEventHandler'[Expected element at argument 2, got nil]

Link to comment
local myMarker = createMarker ( 0, 0, 4, "arrow", 1.5, 255, 0, 0, 255 )
local MOC = createMarker ( 3, 3, 4, "arrow", 1.5, 255, 0, 0, 255 )

addEventHandler ( "onMarkerHit", myMarker, 
	function ( player )
		if ( getElementType ( player ) == "player" ) then
			local posX, posY, posZ = getElementPosition ( MOC )
			setElementPosition ( player, posX, posY, posZ )
			setElementDimension ( player, getElementDimension ( MOC ) )
		end 
	end
)

جربه وتاكد إنه شغال

المشكلة من عندك أخوي

Link to comment

فين الغلط هنا 

addEventHandler ( "onVehicleStartEnter", getRootElement(), --This Part should be edited.
function ()
if ( getElementType ( source ) == "vehicle" and getElementModel ( source ) == 407 ) then
    if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Military" ) then
    cancelEvent()
    end
    end
    end)

@` Allawi ااسف كترت في الاسئلة 

15 minutes ago, ` Allawi said:

local myMarker = createMarker ( 0, 0, 4, "arrow", 1.5, 255, 0, 0, 255 )
local MOC = createMarker ( 3, 3, 4, "arrow", 1.5, 255, 0, 0, 255 )

addEventHandler ( "onMarkerHit", myMarker, 
	function ( player )
		if ( getElementType ( player ) == "player" ) then
			local posX, posY, posZ = getElementPosition ( MOC )
			setElementPosition ( player, posX, posY, posZ )
			setElementDimension ( player, getElementDimension ( MOC ) )
		end 
	end
)

جربه وتاكد إنه شغال

المشكلة من عندك أخوي

حييييياك الله والله مشكور واشتغل

 

14 minutes ago, ProMax said:

فين الغلط هنا 


addEventHandler ( "onVehicleStartEnter", getRootElement(), --This Part should be edited.
function ()
if ( getElementType ( source ) == "vehicle" and getElementModel ( source ) == 407 ) then
    if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Military" ) then
    cancelEvent()
    end
    end
    end)

@` Allawi ااسف كترت في الاسئلة 

ممكن ترد علي دة

Link to comment
14 minutes ago, ProMax said:

فين الغلط هنا 


addEventHandler ( "onVehicleStartEnter", getRootElement(), --This Part should be edited.
function ()
if ( getElementType ( source ) == "vehicle" and getElementModel ( source ) == 407 ) then
    if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Military" ) then
    cancelEvent()
    end
    end
    end)

@` Allawi ااسف كترت في الاسئلة 

حييييياك الله والله مشكور واشتغل

 

ممكن ترد علي دة

addEventHandler ( "onVehicleStartEnter", root, 
	function ( player )
		if ( getElementType ( source ) == "vehicle" and getElementModel ( source ) == 407 ) then
			if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) ~= "Military" ) then
				cancelEvent ( )
			end 
		end 
	end 
)

الخطأ

مو معرف player

في الحدث

ومتحقق إنه "Military"

هو إلي مايقدر يركب

صححت لك الكود فوق ^

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