Jump to content

Recommended Posts

 How can i make the indicator have a sound of the Indicator when pressing "mouse1" or "mouse2" and the sound Stops when there is no indicator flash


--[[
    //\\ Script by CarlRayanitch //\\
]]

local left = false
local right = false

function Blinker_Left()
    if isPedInVehicle(getLocalPlayer()) == true then
        if left == false then
            outputChatBox(" ")
            
            left = true
            local occupiedVehicle = getPedOccupiedVehicle(getLocalPlayer())
            local x,y,z = getElementPosition(occupiedVehicle)
            Blinker_vorne = createMarker(x,y,z,"corona",0.3,238,154,0)
            Blinker_hinten = createMarker(x,y,z,"corona",0.3,238,154,0)
            attachElements(Blinker_vorne,occupiedVehicle,-0.8,2.3)
            attachElements(Blinker_hinten,occupiedVehicle,-0.8,-2.8)
            
            
            blink = setTimer(function()
                if getElementAlpha(Blinker_vorne) == tonumber(255) and getElementAlpha(Blinker_hinten) == tonumber(255) then
                setElementAlpha(Blinker_vorne,0)
                setElementAlpha(Blinker_hinten,0)
                else
                setElementAlpha(Blinker_vorne,255)
                setElementAlpha(Blinker_hinten,255)
                end
            end,500,0)
            
        else
            killTimer(blink)
            destroyElement(Blinker_vorne)
            destroyElement(Blinker_hinten)
            left = false
        end
    end
end
bindKey("mouse1","down",Blinker_Left)

function Blinker_Right()
    if isPedInVehicle(getLocalPlayer()) == true then
        if right == false then
            outputChatBox(" ")
            
            right = true
            local occupiedVehicle = getPedOccupiedVehicle(getLocalPlayer())
            local x,y,z = getElementPosition(occupiedVehicle)
            Blinker_vorne1 = createMarker(x,y,z,"corona",0.3,238,154,0)
            Blinker_hinten1 = createMarker(x,y,z,"corona",0.3,238,154,0)
            attachElements(Blinker_vorne1,occupiedVehicle,0.8,2.3)
            attachElements(Blinker_hinten1,occupiedVehicle,0.8,-2.8)
            
            
            blink1 = setTimer(function()
                if getElementAlpha(Blinker_vorne1) == tonumber(255) and getElementAlpha(Blinker_hinten1) == tonumber(255) then
                setElementAlpha(Blinker_vorne1,0)
                setElementAlpha(Blinker_hinten1,0)
                else
                setElementAlpha(Blinker_vorne1,255)
                setElementAlpha(Blinker_hinten1,255)
                end
            end,500,0)
            
        else
            killTimer(blink1)
            destroyElement(Blinker_vorne1)
            destroyElement(Blinker_hinten1)
            right = false
        end
    end
end
bindKey("mouse2","down",Blinker_Right)


Edited by Carl Rayanitch DZ
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...