Jump to content

تصحيح كود


MrBiG

Recommended Posts

Posted (edited)

السلام عليكم 

 

انا مسوي باب ما يقدرو يفتحو غير الشرطة بس مو راضي يشتغل وش المشكلة متت يا اخوان 

 

-------------------------------- Marcker Open Door -----------------------------|
local Door = createMarker(590.20, 585.09, 15.699,"cylinder",1,0,0,255,250)
setElementDimension(Door,1)
setElementInterior(Door,3)
--------------------------- Objects Door ----------------------------------------|
local DP = createObject( 1537, 589.599, 585.70, 15.699,0,0,90 )
setElementDimension(DP,1)
setElementInterior(DP,3)
--
local DC = createObject( 1537, 589.599, 584.10, 15.699,0,0,90 )
setElementDimension(DC,1)
setElementInterior(DC,3)
----------------------------------------------------------------------------------|

addEventHandler("onMarkerHit",root,
function(player)
	if (source == Door) then
		local Team = getPlayerTeam(player)
		if Team and getTeamName(Team) == "Police" then
			bindKey(player,"tab","down",OpenDoor,1)
		end
	end
end)



function OpenDoor (player,_,_,Number)
	setPedAnimation(player,"ped","bomber")
	setTimer(setPedAnimation,500,1,player,nil,nil)
	if Number == 1 then
		if Opened == true then
			moveObject(DP,1000,589.599, 585.70-1, 15.699)
			moveObject(DC,1000,589.599, 584.10-1, 15.699)
			Opened = false
			exports ["guimessages"] : outputServer( player,"You Are Open Door", 0, 255, 0)
		else
			moveObject(DP,1000,589.599, 585.70, 15.699)
			moveObject(DC,1000,589.599, 584.10, 15.699)
			Opened = true
			exports ["guimessages"] : outputServer( player,"You Closed Door", 0, 255, 0)
		end
	end 
end

 

Edited by Debo15
Posted
addEventHandler("onMarkerHit",root,
function(player)
	if (source == Door) then
	local super = getPlayerTeam (player)
	local saiyan = getTeamFromName ( "Police" )
    if ( super ) == saiyan then 
			bindKey(player,"tab","down",OpenDoor,1)
		end
	end
end);

 

Posted
22 minutes ago, #BrosS said:

addEventHandler("onMarkerHit",root,
function(player)
	if (source == Door) then
	local super = getPlayerTeam (player)
	local saiyan = getTeamFromName ( "Police" )
    if ( super ) == saiyan then 
			bindKey(player,"tab","down",OpenDoor,1)
		end
	end
end);

 

ناقصك تحققات و كدا ممكن يصير مليون بند كي

Posted (edited)
function saiyansDoor ( saiyan )
    if ( saiyan and getElementType ( saiyan ) == 'player' and source == Door ) then
        local super = getPlayerTeam ( saiyan )
        local saiyanType = getTeamFromName ( 'Police' )
            if ( super == saiyanType ) then
            local isSaiyan = isKeyBound ( saiyan, 'tab', 'down', OpenDoor )
                if ( eventName == 'onMarkerHit' ) then
                    if not ( isSaiyan ) then
                    bindKey ( saiyan, 'tab', 'down', OpenDoor, 1 )
                end
                elseif ( eventName == 'onMarkerLeave' ) then
                    if ( isSaiyan ) then
                    unbindKey ( saiyan, 'tab', 'down', OpenDoor )
                end
            end
        end
    end
end

addEventHandler ( 'onMarkerHit', root, saiyansDoor )
addEventHandler ( 'onMarkerLeave', root, saiyansDoor )

 

Edited by #,+( _xiRoc[K]; >
Posted

لازم يكون فيه تحقق من نوع الالمنت الي دخل الماركر

نفترض انه دخل الماركر سيارة راح تظهر بقات ولا راح يستفيد شي من الكود

  • Like 1
Posted

ليش معقدين الأمر كذا يعني ؟؟ 

 

خلاص كتبتو بطريقة ثانية  

 

اشكركم

 

onMarkerLeave

 

انا مسوي كود يخص ذا للعلم

اقصد وظيفة 

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