Jump to content

مساعدة كود ضغطة زر


Recommended Posts

السلام عليكم اخوتي هاد مود فلشر يشتغل لما تكتب شي في اف8 

vehicles = {}
 
function toggleFlashingLights ( thePlayer, key, keyState )
        if getPlayerOccupiedVehicleSeat ( thePlayer ) == 0 then
            if vehicles[getPlayerOccupiedVehicle ( thePlayer )] then
                killTimer ( vehicles[getPlayerOccupiedVehicle ( thePlayer )] )
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = nil
            else
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = setTimer ( toggleVehicleLights, 500, 0, getPlayerOccupiedVehicle ( thePlayer ) )
            end
        end
end
addCommandHandler ( "flash", toggleFlashingLights )
 
function toggleVehicleLights ( car )
    if ( getVehicleOverrideLights ( car ) ~= 2 ) then
        setVehicleOverrideLights ( car, 2 )
    else
        setVehicleOverrideLights ( car, 1 )
    end
end

هاد يشغل فلشر بطيء بدي لما اضغط علا زر معين يشتغل بطيئ ولما اضغط مره ثانية يشتغل سريع ولما اضغط الثالثة يطفى 

حاولت ماصار معي

Link to comment
vehicles = {}
 
function toggleFlashingLights ( thePlayer, key, keyState )
        if getPlayerOccupiedVehicleSeat ( thePlayer ) == 0 then
            if vehicles[getPlayerOccupiedVehicle ( thePlayer )] then
                killTimer ( vehicles[getPlayerOccupiedVehicle ( thePlayer )] )
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = nil
            else
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = setTimer ( toggleVehicleLights, 500, 0, getPlayerOccupiedVehicle ( thePlayer ) )
            end
        end
end
addCommandHandler ( "flash", toggleFlashingLights )
 
function toggleVehicleLights ( car )
    if ( getVehicleOverrideLights ( car ) ~= 2 ) then
        setVehicleOverrideLights ( car, 2 )
    else
        setVehicleOverrideLights ( car, 1 )
    end
end
---------------------2
vehicles = {}
 
function toggleFlashingLights2 ( thePlayer, key, keyState )
        if getPlayerOccupiedVehicleSeat ( thePlayer ) == 0 then
            if vehicles[getPlayerOccupiedVehicle ( thePlayer )] then
                killTimer ( vehicles[getPlayerOccupiedVehicle ( thePlayer )] )
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = nil
            else
                vehicles[getPlayerOccupiedVehicle ( thePlayer )] = setTimer ( toggleVehicleLights22, 100, 0, getPlayerOccupiedVehicle ( thePlayer ) )
            end
        end
end
addCommandHandler ( "flash2", toggleFlashingLights2 )
 
function toggleVehicleLights22 ( car )
    if ( getVehicleOverrideLights ( car ) ~= 2 ) then
        setVehicleOverrideLights ( car, 2 )
    else
        setVehicleOverrideLights ( car, 1 )
    end
end

 

8 hours ago, Rakan# said:

محاولتك طيب؟

 

Edited by MR_Mahmoud
Link to comment
addEventHandler("onResourceStart", resourceRoot,
	function()
		for _,player in ipairs(getElementsByType("player")) do
			bindKey(player, "z", "down", toggleFlashingLights, player)
		end
	end
)

addEventHandler("onPlayerJoin", root,
	function()
		bindKey(source, "z", "down", toggleFlashingLights, source)
	end
)

ضيفهم لكودك

Link to comment
Just now, #َxLysandeR said:

addEventHandler("onResourceStart", resourceRoot,
	function()
		for _,player in ipairs(getElementsByType("player")) do
			bindKey(player, "z", "down", toggleFlashingLights, player)
		end
	end
)

addEventHandler("onPlayerJoin", root,
	function()
		bindKey(source, "z", "down", toggleFlashingLights, source)
	end
)

ضيفهم لكودك

اي بس انا بدي لما اضغط اول مره يشغل الفلشر الي فوق يعني البطيء ولما اضغط مره ثانية يطفي الأول ويشغل الفلشر الثاني السريع 

+

ممكن تشرحلي ليش عند الدخول لسيرفر الي حاطه انت لو سمحت

addEventHandler("onPlayerJoin", root,
	function()
		bindKey(source, "z", "down", toggleFlashingLights, source)
	end
)

 

Edited by MR_Mahmoud
Link to comment
  • 3 weeks later...

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