Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-11-06, 23:08


xTeRusX







Wiek: 26
Na forum: 2284 dni
Posty: 5
Nick w MP: xTeRusX



Respekt: 50

Witam mam problem z ?wiate?kami w SAPD w filmie poni?ej wrzucam o co mi chodzi

https://youtu.be/eJAksgET9b8

Imgur: https://imgur.com/sUYVJVY jak zapisane s? ?wiate?ka w danym modelu pojazdu.

B?edy w debugu ?adne nie wyskakuj? kiedy serwer sie zresetuje wszystko dzia?a prawid?owo ale po czasie sie psuje.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-07, 02:53


Dawcio77







Wiek: 22
Na forum: 3453 dni
Posty: 89
Nick w MP: cx_u

Piwa: 136

Respekt: 35,8

B??dne indexowanie w tablicy - trzy czw?rki wyst?puj? w tej tablicy po sobie
Zmie? te indexy by sz?y po kolei
https://imgur.com/a/Wj0sUSw

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-07, 07:47


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3506 dni
Posty: 284
Nick w MP: AxyZ

Piwa: 235

Respekt: 110
Respekt: 110

"Dawcio77" napisał/a:

B??dne indexowanie w tablicy - trzy czw?rki wyst?puj? w tej tablicy po sobie
Zmie? te indexy by sz?y po kolei
https://imgur.com/a/Wj0sUSw


My?l? ?e te? nie o to chodzi - to te? mo?e by? przyczyn? ale raczej nie, m?g? te? ?le napisa? skrypt na zmian? sygna?k?w - podaj ca?y kod ze zmian? sygna??w ?wietlnych.

Podpis
Kontakt:
Discord: fluffy.rbx
Wiadomość PW Forum [Odpiszę wtedy, kiedy będę mógł]

Support Team: 26.08.2020 do 04.05.2021 [*]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-07, 11:17


xTeRusX







Wiek: 26
Na forum: 2284 dni
Posty: 5
Nick w MP: xTeRusX



Respekt: 50

VVirmex tzn co mam ci wys?ac?
Dawcio zmienilem indexowanie i nic :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-07, 11:36


NegativE*

Naczelny AFKER






Wiek: 23
Na forum: 3115 dni
Posty: 51
Nick w MP: NegativE*

Piwa: 8

Respekt: 60

Musisz wys?a? ca?y kod, na kt?rym robisz te sygna?y ?wietlne.

Podpis

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-07, 12:43


xTeRusX







Wiek: 26
Na forum: 2284 dni
Posty: 5
Nick w MP: xTeRusX



Respekt: 50

--[[
--]]
--482
local strobo_interval = 10    
local is_strobo_enabled = enable

local flash_interval = 1    

local blink_interval = 20        
local blink_duration = 2        

local car_lights_table = {

[459] = {["mode"]="lamp", -- Burrito
[7]={["pos"]={-0.6, 0.9, 0.95}, ["color"]={255,0,0}, ["size"]=0.15, ["phase"]=-30}, 
[8]={["pos"]={0.6, 0.9, 0.95}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=30},

[9]={["pos"]={-0.4, 0.9, 0.95}, ["color"]={255,0,0}, ["size"]=0.15, ["phase"]=-30}, 
[10]={["pos"]={0.4, 0.9, 0.95}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=30},

[11]={["pos"]={0.65, -2.245, 0.93}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=-15}, 
[12]={["pos"]={-0.65, -2.245, 0.93}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=15},
},

[596] = {["mode"]="lamp", -- policeLS
[1]={["pos"]={0.5, -0.4, 0.9}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=25},
[2]={["pos"]={0.6, -0.4, 0.9}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=25},
[3]={["pos"]={0.7, -0.4, 0.9}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=25},
[3]={["pos"]={0.4, -0.4, 0.9}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=25},
[4]={["pos"]={0.3, -0.4, 0.9}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=25},
[5]={["pos"]={0.27, -0.4, 0.9}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=25},

[6]={["pos"]={-0.5, -0.4, 0.9}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=-25},
[7]={["pos"]={-0.6, -0.4, 0.9}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=-25},
[8]={["pos"]={-0.7, -0.4, 0.9}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=-25},
[9]={["pos"]={-0.4, -0.4, 0.9}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=-25},
[10]={["pos"]={-0.3, -0.4, 0.9}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=-25},
[11]={["pos"]={-0.27, -0.4, 0.9}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=-25},



},



[516] = {["mode"]="lamp", -- NEBULA (DODGE)
[1]={["pos"]={0.3, 2.58, -0.07}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=10}, 
[2]={["pos"]={-0.3, 2.58, -0.07}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=25},

[7]={["pos"]={0.1, 2.58, -0.07}, ["color"]={255,0,0}, ["size"]=0.17, ["phase"]=10}, 
[8]={["pos"]={-0.1, 2.58, -0.07}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=25},

[3]={["pos"]={0.5, -1.8, 0.5}, ["color"]={255,0,0}, ["size"]=0.18, ["phase"]=10}, 
[4]={["pos"]={-0.5, -1.8, 0.5}, ["color"]={0,0,255}, ["size"]=0.18, ["phase"]=1},

[5]={["pos"]={0.5, 0.35, 0.7}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=5}, 
[6]={["pos"]={-0.5, 0.35, 0.7}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=50},
},

[560] = {["mode"]="lamp", -- SULTAN
[1]={["pos"]={0.5, 0.25, 0.9}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=25},
},

[415] = {["mode"]="lamp", -- Cheetah
[1]={["pos"]={0.55, 0.15, 0.3}, ["color"]={0,0,255}, ["size"]=0.18, ["phase"]=30}, 
[2]={["pos"]={-0.55, 0.15, 0.3}, ["color"]={255,0,0}, ["size"]=0.18, ["phase"]=20},

[3]={["pos"]={0.79, -2.3, 0.0}, ["color"]={255,0,0}, ["size"]=0.20, ["phase"]=50}, 
[4]={["pos"]={-0.83, -2.3, 0.}, ["color"]={0,0,255}, ["size"]=0.20, ["phase"]=40},

[5]={["pos"]={0.25, 2.8,-0.4}, ["color"]={0,0,255}, ["size"]=0.20, ["phase"]=80}, 
[6]={["pos"]={-0.25, 2.8,-0.4}, ["color"]={255,0,0}, ["size"]=0.20, ["phase"]=50},

[7]={["pos"]={0.110, 2.8,-0.4}, ["color"]={0,0,255}, ["size"]=0.20, ["phase"]=50}, 
[8]={["pos"]={-0.10, 2.8,-0.4}, ["color"]={255,0,0}, ["size"]=0.20, ["phase"]=80},

},

[578] = {["mode"]="lamp",
[1]={["pos"]={-1.2, 4.4, -0.2}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[2]={["pos"]={1.2, 4.4, -0.2}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[3]={["pos"]={-1.2, 4.4, -0.2}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[4]={["pos"]={1.2, 4.4, -0.2}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[5]={["pos"]={1.2, -5.4, -0.5}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[6]={["pos"]={-1.2, -5.4, -0.5}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[7]={["pos"]={1.2, -5.4, -0.5}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[8]={["pos"]={-1.2, -5.4, -0.5}, ["color"]={255,90,0}, ["size"]=0.25, ["phase"]=15},
[9]={["pos"]={-1.4, 0.5, -0.8}, ["color"]={255,90,0}, ["size"]=0.30, ["phase"]=25},
[10]={["pos"]={-1.4, -0.8, -0.8}, ["color"]={255,90,0}, ["size"]=0.35, ["phase"]=25},
[11]={["pos"]={-1.4, -2.2, -0.8}, ["color"]={255,90,0}, ["size"]=0.35, ["phase"]=25},
[12]={["pos"]={1.4, 0.5, -0.8}, ["color"]={255,90,0}, ["size"]=0.35, ["phase"]=25},
[13]={["pos"]={1.4, -0.8, -0.8}, ["color"]={255,90,0}, ["size"]=0.35, ["phase"]=25},
[14]={["pos"]={1.4, -2.2, -0.8}, ["color"]={255,90,0}, ["size"]=0.35, ["phase"]=25},
},


[470] = {["mode"]="lamp", -- PATRIOT
[1]={["pos"]={0.5, 2.2, 0.2}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=50}, 
[2]={["pos"]={-0.5, 2.2, 0.2}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=80},

[3]={["pos"]={-0.3, 2.2, 0.2}, ["color"]={255,0,0}, ["size"]=0.15, ["phase"]=80}, 
[4]={["pos"]={0.3, 2.2, 0.2}, ["color"]={255,0,0}, ["size"]=0.15, ["phase"]=50},

[5]={["pos"]={-0.1, 2.2, 0.2}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=50}, 
[6]={["pos"]={0.1, 2.2, 0.2}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=80},

[7]={["pos"]={-0.8, 0.6, 0.9}, ["color"]={255,0,0}, ["size"]=0.15, ["phase"]=75}, 
[8]={["pos"]={0.8, 0.6, 0.9}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=25},

[9]={["pos"]={-0.5, 0.6, 0.9}, ["color"]={255,0,0}, ["size"]=0.15, ["phase"]=75}, 
[10]={["pos"]={0.5, 0.6, 0.9}, ["color"]={0,0,255}, ["size"]=0.15, ["phase"]=25},

[11]={["pos"]={0.8, -1.7, 0.85}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=25}, 
[12]={["pos"]={-0.8, -1.7, 0.85}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=75},

[13]={["pos"]={0.7, -2.7, -0.2}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=95}, 
[14]={["pos"]={-0.7, -2.7, -0.2}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=100},
},

[490] = {["mode"]="lamp", --FBI Rancher
[1]={["pos"]={0.4, 0.4, 1.1}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=27}, --DACH lewo 
[2]={["pos"]={-0.4, 0.4, 1.1}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=27}, --DACH Prawo
[1]={["pos"]={0.5, 0.4, 1.1}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=27}, --DACH lewo 
[2]={["pos"]={-0.5, 0.4, 1.1}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=27}, --DACH Prawo
[3]={["pos"]={0.6, 0.4, 1.1}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=27}, --DACH lewo 
[4]={["pos"]={-0.6, 0.4, 1.1}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=27}, --DACH Prawo
[5]={["pos"]={0.7, 0.4, 1.1}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=27}, --DACH lewo 
[6]={["pos"]={-0.7, 0.4, 1.1}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=27}, --DACH Prawo
},

[427] = {["mode"]="lamp", -- ENFORCER
[1]={["pos"]={-0.90,2.70,0.2}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=10}, 
[2]={["pos"]={0.90, 2.70,0.2}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=1},  

[3]={["pos"]={-0.5, 1.1, 1.4}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=45}, 
[4]={["pos"]={0.5, 1.1, 1.4}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=45},
[5]={["pos"]={0.0, 1.1, 1.4}, ["color"]={200,100,0}, ["size"]=0.30, ["phase"]=45},
[6]={["pos"]={-0.3, 1.1, 1.4}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=45}, 
[7]={["pos"]={0.3, 1.1, 1.4}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=45},

[8]={["pos"]={1,-3.87,0.35}, ["color"]={0,0,255}, ["size"]=0.30, ["phase"]=25}, 
[9]={["pos"]={-1,-3.87,0.35}, ["color"]={0,0,255}, ["size"]=0.30, ["phase"]=25},
[10]={["pos"]={-1.15,-3.80,-0.30}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=15},
[11]={["pos"]={1.15,-3.80,-0.30}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=15}, 
[12]={["pos"]={0.95, -3.80, 1.30}, ["color"]={255,255,255}, ["size"]=0.30, ["phase"]=25}, 
[13]={["pos"]={-0.95, -3.80, 1.30}, ["color"]={255,255,255}, ["size"]=0.30, ["phase"]=10},

[14]={["pos"]={1.10, -3.40, 1.25}, ["color"]={200,100,0}, ["size"]=0.30, ["phase"]=60}, 
[15]={["pos"]={-1.10, -3.40, 1.25}, ["color"]={200,100,0}, ["size"]=0.30, ["phase"]=30},
[16]={["pos"]={1.10, -3.40, 0.95}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=30}, 
[17]={["pos"]={-1.10, -3.40, 0.95}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=60},

[18]={["pos"]={1.10, -1.65, 1.25}, ["color"]={200,100,0}, ["size"]=0.30, ["phase"]=60}, 
[19]={["pos"]={-1.10, -1.65, 1.25}, ["color"]={200,100,0}, ["size"]=0.30, ["phase"]=30},
[20]={["pos"]={1.10, -1.65, 0.95}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=30}, 
[21]={["pos"]={-1.10, -1.65, 0.95}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=60},

[22]={["pos"]={1.10, 0.1, 1.25}, ["color"]={200,100,0}, ["size"]=0.30, ["phase"]=60}, 
[23]={["pos"]={-1.10, 0.1, 1.25}, ["color"]={200,100,0}, ["size"]=0.30, ["phase"]=30},
[24]={["pos"]={1.10, 0.1, 0.95}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=30}, 
[25]={["pos"]={-1.10, 0.1, 0.95}, ["color"]={255,0,0}, ["size"]=0.30, ["phase"]=60},
},

[541] = {["mode"]="lamp", -- Infek
[1]={["pos"]={0.45, 0.1, 0.7}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=25},
[2]={["pos"]={0.45, 0.1, 0.6}, ["color"]={0,0,255}, ["size"]=0.17, ["phase"]=25},
},


}

-- do not modify --------------------------------------------
local vehicles = {}
local timers = {}

local base_freq = 50    -- freq of timer for light change

-------------------------------------------------------------
function release_vehicle(vehicle)
    if (isElement(vehicle)) then
        if (is_strobo_enabled) then
            setVehicleOverrideLights ( vehicle, 1)
            setVehicleLightState ( vehicle, 3,  1 )
            setVehicleLightState ( vehicle, 1,  1 )
            setVehicleLightState ( vehicle, 2,  1 )
            setVehicleLightState ( vehicle, 3,  1 )
        end
    end
    if (vehicles[vehicle]~=nil) then    
        -- release the markers
        for key, value in pairs(vehicles[vehicle]["flist"]) do
            destroyElement (value["m"])
        end
        
        vehicles[vehicle] = nil
    end
    if (timers[vehicle]~=nil) then
        -- kill the strobo timer
        killTimer(timers[vehicle])
        timers[vehicle] = nil
        
        if (isElement(vehicle)) then
            if (getElementData( vehicle, "emerlights_source")==getPlayerName(getLocalPlayer())) then
                triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 0 )
            end
        end
    end
end

function checkForAbility(vehicle)
    local veh_model = getElementModel ( vehicle )

    if (car_lights_table[veh_model]==nil)or(getElementData( vehicle, "emerlights_enabled" )=="false") then
        return false
    end
    return true
end

function strobo_state_update (vehicle)
    -- check for valid vehicle
    if (isElement(vehicle)) then
        if (vehicles[vehicle]==nil) then
            -- check for disallowing to use lights
            -- its enabled by default
            if (checkForAbility(vehicle)==false) then
                release_vehicle(vehicle)
                return
            end
            local veh_model = getElementModel ( vehicle )
            
            --if (car_lights_table[veh_model]==nil) then
            --veh_model = "default"
            --end
            
            local occupant = getVehicleOccupant( vehicle, 0)
            if (getElementType(occupant)=="player") then    -- peds also can use emerlights
                local src = getPlayerName(occupant)
                setElementData( vehicle, "emerlights_source", src, false)
                if (src==getPlayerName(getLocalPlayer())) then
                    triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 1 )
                end
            end
            -- init state variable
            
            vehicles[vehicle] = {}
            vehicles[vehicle]["lstate"] = 0     -- strobo lights state
            vehicles[vehicle]["fstate"] = 0    -- flash light state
            vehicles[vehicle]["flist"] = {}        -- flash lights list (marker ids)
            
            -- create flash lights

            
            local mode = car_lights_table[veh_model]["mode"]
            if (mode==nil) then
                mode = "lamp"
            end
            
            local coeff = 0
            if (mode=="lamp") then
                coeff = 3.141592654/10.0
            else
                coeff = blink_interval/20.0
            end
            
            vehicles[vehicle]["fmode"] = mode
            if getElementData(vehicle,"vehicle:PSP") or getElementData(vehicle,"vehicle:police") or getElementData(vehicle,"vehicle:oswietlenie") or getElementData(vehicle,"data:job") or getElementData(vehicle,"vehicle:") or getElementData(vehicle, "vehicle:id") == 128 then
            for light_id, light_desc in pairs(car_lights_table[veh_model]) do
                if (light_id~="mode") then
                    vehicles[vehicle]["flist"][light_id] = {}
                    vehicles[vehicle]["flist"][light_id]["m"] = createMarker( 0.0001, 0.0001, 0.0001, "corona", light_desc["size"], light_desc["color"][1], light_desc["color"][2], light_desc["color"][3], 100)
                    vehicles[vehicle]["flist"][light_id]["p"] = light_desc["phase"]*coeff
                    attachElements ( vehicles[vehicle]["flist"][light_id]["m"], vehicle, light_desc["pos"][1], light_desc["pos"][2], light_desc["pos"][3] )
                end
            end
            end    
        end
        
        -- strobo light
        if (is_strobo_enabled) then
            setVehicleOverrideLights ( vehicle, 2)
            if (vehicles[vehicle]["lstate"]<strobo_interval) then
                setVehicleLightState ( vehicle, 0,  1 )
                setVehicleLightState ( vehicle, 1,  0 )
                setVehicleLightState ( vehicle, 2,  0 )
                setVehicleLightState ( vehicle, 3,  1 )    
            else
                setVehicleLightState ( vehicle, 0,  0 )
                setVehicleLightState ( vehicle, 1,  1 )
                setVehicleLightState ( vehicle, 2,  1 )
                setVehicleLightState ( vehicle, 3,  0 )     
            end
            if (vehicles[vehicle]["lstate"]>=strobo_interval*2) then
                vehicles[vehicle]["lstate"] = 0
            else
                vehicles[vehicle]["lstate"] = vehicles[vehicle]["lstate"] + 1
            end
        end
        -- flash light --createMarker
        if (vehicles[vehicle]["fmode"]=="lamp") then
        -- lamp mode
            local tmp_fstate = vehicles[vehicle]["fstate"]
            for key, value in pairs(vehicles[vehicle]["flist"]) do
                local R, G, B, A = getMarkerColor( value["m"] )
                setMarkerColor(value["m"], R, G, B, (math.sin(tmp_fstate+value["p"])+1.0)*128.0)
            end
            
            vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + flash_interval
            
        else
        -- led mode  3
            local tmp_fstate = vehicles[vehicle]["fstate"]

            for key, value in pairs(vehicles[vehicle]["flist"]) do
                local R, G, B, A = getMarkerColor(value["m"])
                -- blinking mode
                local tmp_val = tmp_fstate+value["p"]
                if (tmp_val>blink_interval) then
                    tmp_val = tmp_val - blink_interval
                end
                if ((tmp_val>=0)and(tmp_val<blink_duration))or((tmp_val>=blink_duration*6)and(tmp_val<blink_duration*5)) then
                    setMarkerColor(value["m"], R, G, B, 255)
                else
                    setMarkerColor(value["m"], R, G, B, 0)
                end
            end        
            vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + 1
            if (vehicles[vehicle]["fstate"]>blink_interval) then
                vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] - blink_interval
            end
        end
    else
        -- if vehicle is no more exists
        release_vehicle(vehicle)
    end
end

-- not used anymore
function stroboLightOn()
    playerVehicle = getPedOccupiedVehicle ( getLocalPlayer()  )  -- get the player's vehicle

    --setElementData( playerVehicle, "emerlights_enabled", "true" )    -- debug
    
    if ( playerVehicle ) then
        -- if player is not a driver
        if (getLocalPlayer()~=getVehicleOccupant( playerVehicle )) then
            --outputChatBox("you're not a driver!")
            return
        end
        
        setStroboLightsOn(playerVehicle, nil)
    end
end

function isStroboLightsOn (vehicle_id)
    if (timers[vehicle_id]) then
        return 1
    else
        return 0
    end
end

function setStroboLightsOn(vehicle_id, value)
    if ( vehicle_id ) then
        if (value==nil) then
            if (isStroboLightsOn(vehicle_id)==1) then
                value = 0
            else
                value = 1
            end;
        end;
        if (value==0) then
            if (timers[vehicle_id]) then
                release_vehicle(vehicle_id)
                end
        end
        if (value==1) then
            if (timers[vehicle_id]) then
                release_vehicle(vehicle_id)
            end
            -- create strobo timer
            timers[vehicle_id] = setTimer ( strobo_state_update, base_freq, 0,  vehicle_id )
        end
    end
end
--vehicle:psp
-- only local effect
function enableStroboLightsMode(source, value)
    if (value=="0")or(value=="false") then
        is_strobo_enabled = false
        outputConsole("Stroboscopic mode disabled")
    else
        if (value=="1")or(value=="true") then
            is_strobo_enabled = true
            outputChatBox("Stroboscopic mode enabled")
        else
            outputChatBox("Usage: strobo 0 or strobo 1  for disable/enable stroboscopic lights mode")
        end
    end
end
addCommandHandler("psrpgtozajebistyserwer", enableStroboLightsMode)

-- triggered by server
function setEmerlightsState(value, state)
    local player = getPlayerFromName ( value )
    local vehicle = getPedOccupiedVehicle(player)
    if (vehicle) then
        setStroboLightsOn(vehicle, state)
    end
end
addEvent("setEmerlights", true)
addEventHandler("setEmerlights", getRootElement(), setEmerlightsState)

function requestEmerlights()
    -- check for driver
    playerVehicle = getPedOccupiedVehicle (getLocalPlayer())  -- get the player's vehicle

    if (playerVehicle) then
        -- if player is not a driver
        if (getLocalPlayer()~=getVehicleOccupant( playerVehicle )) then
            --outputChatBox("you're not a driver!")
            return
        end
        if (checkForAbility(playerVehicle)) then
            -- sync
            triggerServerEvent("requestEmerlightChangeState", getLocalPlayer(), 1-isStroboLightsOn(getPedOccupiedVehicle(getLocalPlayer())))
        else
            -- not able to use lights for this vehicle
                --outputChatBox("unknown car!")
        end
    end

end

addCommandHandler("sygnaly_swietlne", requestEmerlights)--stroboLightOn)
bindKey("n", "down", "sygnaly_swietlne")

addEvent("onPlayerEmergencyLightStateChange")
--582 


Dodano: 2020-11-07, 12:44
Wys?a?em plik ze ?wiate?kami. Nie potrafie da? tego jako code :)

Kod dodawaj za pomoc? znacznik?w code/lua -> [ lua] Tw?j kod [/lua] [bez spacji w tagu] //Emm :)

Ostatnio zmieniony przez Emm 2020-11-07, 16:58, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-07, 20:47


RudyTMM
[Usunięty]









Po lewej s? cyferki, tam s? cyferki kolejno?ci prawdopodobnie masz ustawione takie same i sie pojawiaj? w takim samym momencie

 

 
Wysłany: 2020-11-07, 22:47


xTeRusX







Wiek: 26
Na forum: 2284 dni
Posty: 5
Nick w MP: xTeRusX



Respekt: 50

a jak powinno wygl?da?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-08, 00:16


RudyTMM
[Usunięty]









Najpierw podaj id radiowozu w kt?rym robisz sygna?y

 

 
Wysłany: 2020-11-08, 14:05


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4535 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Czy wyst?puj? jakies bledy db3? Moze nawarstwiac sie wykonywanie kodu na siebie w jednym czasie i wydaje sie ze "stoja w miejscu" .

Postaw piwo autorowi tego posta
 

 
Tagi: światełka :: sapd
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Światełka SAPD Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku