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

Wysłany: 2019-07-13, 17:05


konoszovsky







Wiek: 24
Na forum: 3080 dni
Posty: 33
Nick w MP: konosz615

Piwa: 5

Respekt: 60

Witam, posiadam paczke PSSM - Polski Serwer Sluzb Mundurowych, problem polega na tym, iz w frakcjach sa pododawane dzwieki w skrypcie pssm-syrenydzwiekowe oraz schowek ktory znajduje sie w np. frakcja-osp w pojazdy.lua,
chodzi o to ze chociaz dodany jest Burrito [482] w skrypcie i na dzwiekowe syreny i na schowek, ani schowek ani syreny nie dzialaja.
KOD W KTORYM DODANY JEST POJAZD DO SCHOWKA:

if value[2] == "Burrito" then
setVehicleColor(veh94,0,)
local col createColSphere0,0,3,2.5 )
setElementData(col,"col:OSPitems",true)
setElementData(veh,"vehicle:fraction"true)
setElementData(veh,"vehicle:osp"true)
setElementData(veh,"vehicle:swiatla"true)
attachElements(col,veh)
setVehicleHandling(veh"driveType""awd")
end


Identyczny kod posiada fire truck ktory dziala, i to mnie dziwi ze burrito nie dziala, chociaz gdy burrito bylo w psp, zanim go przenioslem do osp to dzialal.

KOD W KTORYM JEST DODANY DZWIEK DO POJAZDU (skrypt jest ustawiony tak ze dziwek dziala tylko wtedy gdy pojazd zostal zrespiony przez skrypt frakcji):

[428] = {
    ["1"] = {"PSP/GBA1.mp3",400},    


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-13, 19:08


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Poka? ca?y kod, co nam po jakim? warunku, kt?rego ?r?d?a nie znamy.
Sk?d mamy wiedzie? co si? kryje pod zmienn? value, por?wnujesz j? z nazw? pojazdu, a mo?e jest tam ID?

Co do d?wi?ku te? poka? nam kod, nie domy?limy si? co tam skry?e? w tym pseudolu, ?e nie dzia?a.

Mo?e jakie? b??dy DB3 uniemo?liwiaj? prawid?owe dzia?anie?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-13, 19:22


konoszovsky







Wiek: 24
Na forum: 3080 dni
Posty: 33
Nick w MP: konosz615

Piwa: 5

Respekt: 60

kod pojazdow
function isPlayerInFaction(plr)
    local uid=getElementData(plr,'player:uid')
    if not uid then return end

    local result=exports['ogrpg-db']:dbGet('SELECT 1 FROM ogrpg_factions WHERE code=? AND uid=? LIMIT 1;'"OSP"uid)
    if result[1then
        return true
    else
        return false
    end
end


local fractionVehicles = {

{ "Burrito",298.69, -169.111.60,90},
{ "Fire Truck",298.50, -162.791.80,90},
{ "Fire Truck",298.39, -156.351.80,90},
                                               

}

local col

for keyvalue in ipairs(fractionVehicles) do
    local veh createVehiclegetVehicleModelFromNamevalue[1] ), value[2],value[3],value[4],0,0,value[5])
    setElementData(veh,"vehicle:fraction","OSP")
    setElementFrozen(veh,true)
    setVehicleEngineState(veh,false)

if value[1] == "Fire Truck" then
setVehicleColor(veh94,0,)
local col createColSphere0,0,3,2.5 )
setElementData(col,"col:OSPitems",true)
setElementData(veh,"vehicle:fraction"true)
setElementData(veh,"vehicle:osp"true)
setElementData(veh,"vehicle:swiatla"true)
attachElements(col,veh)
setVehicleHandling(veh"driveType""awd")
end

if value[2] == "Burrito" then
setVehicleColor(veh108,0,0,255,255,255,0,0,0,0,0,)
local col createColSphere0,0,3,)
setElementData(col,"col:OSPitems",true)
setElementData(veh,"vehicle:fraction"true)
setElementData(veh,"vehicle:osp"true)
setElementData(veh,"vehicle:swiatla"true)
setElementData(veh,"vehicle:respiony"true)    
attachElements colveh0, -3)
setVehicleHandling(veh"driveType""awd")
setVehicleVariant(veh,1,1)
end

if value[3] == "Patriot" then
setVehicleColor(veh94,0,094,0,)
local col createColSphere0,0,3,2.5 )
setElementData(col,"col:OSPitems",true)
setElementData(veh,"vehicle:fraction"true)
setElementData(veh,"vehicle:osp"true)
setElementData(veh,"vehicle:swiatla"true)
attachElements(col,veh)
setVehicleHandling(veh"driveType""awd")
end


setElementFrozen(veh,true)
setVehicleEngineState(veh,false)
end

addEventHandler("onVehicleStartEnter",resourceRoot,function (plr,seat)
if getElementData(plr,"player:duty") == "OSP" then
else
cancelEvent()
end
end)


[ Dodano: 2019-07-13, 19:23 ]
kod syren dzwiekowych
-- Emergency Lights resource by vovo4ka
-- please, do not remove copyright
-- Edited by #FurkanOzulus [OzulusTR]
-- Special Thanksvovo4ka for the this script :)

local screenWscreenH guiGetScreenSize()

local sxsy guiGetScreenSize()

local strobo_interval 0        -- strobo light freq10 0.2 sec
local is_strobo_enabled enable    -- enable/disable stroboscopic lights mode
-- lamps
local flash_interval 1        -- flash freq
-- led blink mode
local blink_interval 11        -- blink interval
local blink_duration 3        -- 1..blink_interval

local car_lights_table = {


-- Police LS
[596] = {["mode"]="lamp", 
[1]={["pos"]={-0.23, -0.50.9}, ["color"]={255,0,0}, ["size"]=0.12, ["phase"]=5.0}, 
[2]={["pos"]={-0.38, -0.50.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0}, 
[3]={["pos"]={0.38, -0.50.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0},
[4]={["pos"]={-0.13, -0.50.9}, ["color"]={255,0,0}, ["size"]=0.12, ["phase"]=5.0}, 
[5]={["pos"]={-0.48, -0.50.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0}, 
[6]={["pos"]={0.48, -0.50.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0}, 
[7]={["pos"]={-0.222.15, -0.0}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0}, 
[8]={["pos"]={0.222.15, -0.0}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0} 
},


[597] = {["mode"]="led", 
[1]={["pos"]={-0.23, -0.40.9}, ["color"]={255,0,0}, ["size"]=0.12, ["phase"]=5.0},
[2]={["pos"]={-0.33, -0.40.9}, ["color"]={255,0,0}, ["size"]=0.12, ["phase"]=5.0},  
[3]={["pos"]={-0.38, -0.40.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0}, 
[4]={["pos"]={-0.54, -0.40.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0},
[5]={["pos"]={0.38, -0.40.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0}, 
[6]={["pos"]={0.58, -0.40.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0}, 
},

[427] = {["mode"]="led", 
[1]={["pos"]={0.151.181.39}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=5.0}, -- gora front niebieskie
[2]={["pos"]={0.551.181.39}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=5.0}, -- gora front niebieskie
[3]={["pos"]={-0.151.181.39}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- gora front czerwone
[4]={["pos"]={-0.551.181.39}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- gora front czerwone
[5]={["pos"]={-1.15, -3.11.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy tyl red
[6]={["pos"]={-1.15, -3.351.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy tyl blue
[7]={["pos"]={-1.15, -0.531.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy przod red
[8]={["pos"]={-1.15, -0.781.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy przod blue
[9]={["pos"]={1.15, -3.11.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy tyl red
[10]={["pos"]={1.15, -3.351.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy tyl blue
[11]={["pos"]={1.15, -0.531.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy przod red
[12]={["pos"]={1.15, -0.781.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy przod blue
[13]={["pos"]={1.02, -3.830.95}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=5.0}, -- tyl prawy przod red
[14]={["pos"]={0.83, -3.830.95}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=9.0}, -- tyl prawy przod blue
[15]={["pos"]={-0.83, -3.830.95}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=5.0}, -- tyl lewy przod red
[16]={["pos"]={-1.02, -3.830.95}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=9.0}, -- tyl lewy przod blue
},


-- Police LV
[598] = {["mode"]="led", 
[1]={["pos"]={-0.142.40, -0.032}, ["color"]={0,65,140}, ["size"]=0.10, ["phase"]=0.0}, -- mini front leds
[2]={["pos"]={0.142.40, -0.032}, ["color"]={169,0,0}, ["size"]=0.10, ["phase"]=5.0},
[3]={["pos"]={-0.41, -1.300.64}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=5.0}, -- rear lightbar
[4]={["pos"]={-0.57, -1.300.64}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=0.0},
[5]={["pos"]={0.41, -1.300.64}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=5.0},
[6]={["pos"]={0.57, -1.300.64}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=0.0},
[7]={["pos"]={-0.410.270.68}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=5.0}, -- front lightbar
[8]={["pos"]={-0.570.270.68}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=5.0},
[9]={["pos"]={0.410.270.68}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=0.0},
[10]={["pos"]={0.570.270.68}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=0.0},
},

[498] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.871.962.18}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={0.871.962.18}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
----
[3]={["pos"]={0, -3.972.27}, ["color"]={0,100,255}, ["size"]=0.25, ["phase"]=7},
},


--[[
-- Karetka S
[413] = {["mode"]="led", 
[1]={["pos"]={-0.50.42}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[2]={["pos"]={-0.40.42}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.60.42}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------
[4]={["pos"]={0.40.42}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[5]={["pos"]={0.50.42}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[6]={["pos"]={0.60.42}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
[7]={["pos"]={0.5, -2.82}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[8]={["pos"]={0.4, -2.82}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------------
[9]={["pos"]={-0.4, -2.82}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1},
[10]={["pos"]={-0.5, -2.82}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},
},
]]
----Karetka P
[421] = {["mode"]="led",  
[1]={["pos"]={ 0.45, -0.280.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=1},
[2]={["pos"]={ 0.20, -0.280.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=1},
[3]={["pos"]={ 0.08, -0.280.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=1},
[4]={["pos"]={ -0.45, -0.280.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=7},
[5]={["pos"]={ -0.20, -0.280.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=7},
[6]={["pos"]={ -0.08, -0.280.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=7},
[7]={["pos"]={ -0.272.530.01}, ["color"]={0,100,255}, ["size"]=0.07, ["phase"]=7},
[8]={["pos"]={ 0.272.530.01}, ["color"]={0,100,255}, ["size"]=0.07, ["phase"]=1},
},

-- Police Ranger
[599] = {["mode"]="led", 
[1]={["pos"]={-0.41, -0.551.3}, ["color"]={169,0,0}, ["size"]=0.25, ["phase"]=5.0},
[2]={["pos"]={-0.59, -0.551.3}, ["color"]={169,0,0}, ["size"]=0.25, ["phase"]=5.0},
[3]={["pos"]={0.41, -0.551.3}, ["color"]={0,65,140}, ["size"]=0.25, ["phase"]=0},
[4]={["pos"]={0.59, -0.551.3}, ["color"]={0,65,140}, ["size"]=0.25, ["phase"]=0},
},

[490] = {["mode"]="led", 
[1]={["pos"]={-0.510.61.15}, ["color"]={0,65,140}, ["size"]=0.3, ["phase"]=5.0},
[2]={["pos"]={-0.690.61.15}, ["color"]={0,65,140}, ["size"]=0.3, ["phase"]=5.0},
[3]={["pos"]={0.510.61.15}, ["color"]={0,65,140}, ["size"]=0.3, ["phase"]=0},
[4]={["pos"]={0.690.61.15}, ["color"]={0,65,140}, ["size"]=0.3, ["phase"]=0},
},

[604] = {["mode"]="led", 
[1]={["pos"]={ 0.390.330.67}, ["color"]={0,30,255}, ["size"]=0.1, ["phase"]=6.0}, 
[2]={["pos"]={ 0.50.330.64}, ["color"]={169,0,0}, ["size"]=0.1, ["phase"]=5.0}, 
[3]={["pos"]={ -0.390.330.67}, ["color"]={0,30,255}, ["size"]=0.1, ["phase"]=8.0}, 
[4]={["pos"]={ -0.50.330.65}, ["color"]={169,0,0}, ["size"]=0.1, ["phase"]=5.0}, 
[5]={["pos"]={ -0.060.90.35}, ["color"]={0,65,140}, ["size"]=0.1, ["phase"]=0.0}, 
[6]={["pos"]={ 0.060.90.35}, ["color"]={0,65,140}, ["size"]=0.1, ["phase"]=5.0}, 
[7]={["pos"]={ 0.46, -1.70.4}, ["color"]={0,65,140}, ["size"]=0.13, ["phase"]=5.0}, 
[8]={["pos"]={ -0.46, -1.70.4}, ["color"]={0,65,140}, ["size"]=0.13, ["phase"]=0.0}, 
},

[550] = {["mode"]="lamp", 
[1]={["pos"]={0.252.75, -0.1}, ["color"]={0,100,255}, ["size"]=0.1, ["phase"]=1}, 
[2]={["pos"]={-0.252.75, -0.1}, ["color"]={0,100,255}, ["size"]=0.1, ["phase"]=9}, 
----
[3]={["pos"]={ -0.5500.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=9}, 
[4]={["pos"]={ -0.4500.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=9}, 
[5]={["pos"]={ -0.3500.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=9}, 
-----
[6]={["pos"]={ 0.5500.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=1}, 
[7]={["pos"]={ 0.4500.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=1}, 
[8]={["pos"]={ 0.3500.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=1}, 
},

[573] = {["mode"]="lamp", 
[1]={["pos"]={0.92.81.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1}, 
[2]={["pos"]={0.72.81.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1}, 
[3]={["pos"]={0.52.81.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1}, 
-----------------
[4]={["pos"]={-0.92.81.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7}, 
[5]={["pos"]={-0.72.81.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7}, 
[6]={["pos"]={-0.52.81.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},

[7]={["pos"]={0.9, -3.60.9}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=4},
},

[416] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.60.32}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[2]={["pos"]={-0.20.32}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.40.32}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------
[4]={["pos"]={0.60.32}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[5]={["pos"]={0.40.32}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[6]={["pos"]={0.20.32}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
[7]={["pos"]={0.6, -2.82}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[8]={["pos"]={0.4, -2.82}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[9]={["pos"]={0.2, -2.82}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------------
[10]={["pos"]={-0.6, -2.82}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1},
[11]={["pos"]={-0.4, -2.82}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},
[12]={["pos"]={-0.2, -2.82}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},
},

[440] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.60.931.25}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=7},
[2]={["pos"]={-0.50.931.25}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.40.931.25}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=1},
------------
[4]={["pos"]={0.60.931.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[5]={["pos"]={0.50.931.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[6]={["pos"]={0.40.931.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
[7]={["pos"]={-1.04, -3.61.48}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[8]={["pos"]={1.04, -3.61.48}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------------
[9]={["pos"]={-1.22, -3.361.46}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1},
[10]={["pos"]={1.22, -3.361.46}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},

------------------
[11]={["pos"]={-1.20.251.45}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=5},
[12]={["pos"]={1.20.251.45}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=3},

},

[428] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.60.881.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[2]={["pos"]={-0.50.881.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.40.881.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------
[4]={["pos"]={0.60.881.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[5]={["pos"]={0.50.881.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[6]={["pos"]={0.40.881.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
},

[407] = {["mode"]="lamp",  ----Woz strazacki 
[1]={["pos"]={13.81.0}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={13.81.0}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={13.81.0}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------------
[4]={["pos"]={0.93.21.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[5]={["pos"]={0.93.11.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[6]={["pos"]={0.93.11.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
-----------------
[7]={["pos"]={-0.93.21.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[8]={["pos"]={-0.93.11.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[9]={["pos"]={-0.93.11.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
},
[544] = {["mode"]="led",  ----Karetka P 582 
[1]={["pos"]={-0.883.11.6}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
[2]={["pos"]={0.883.11.6}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
---
[3]={["pos"]={-0.99, -4, -0.55}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[4]={["pos"]={-0.99, -4, -0.55}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=2},
[5]={["pos"]={-0.99, -4,-0.55}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=3},
[6]={["pos"]={-0.99, -4,-0.55}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=4},
[7]={["pos"]={-0.99, -4,-0.55}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=5},
--578

},
[470] = {["mode"]="lamp",  ----Strazacki OSP
[1]={["pos"]={0.50.41.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={-0.50.41.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[3]={["pos"]={0.2, -3.71.3}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
},

[500] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.60.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={-0.50.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.40.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[4]={["pos"]={-0.30.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
-----
[5]={["pos"]={0.60.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
[6]={["pos"]={0.50.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
[7]={["pos"]={0.40.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
[8]={["pos"]={0.30.21}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
},

[578] = {["mode"]="led", 
[1]={["pos"]={0.44.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[2]={["pos"]={-0.44.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
[3]={["pos"]={0.64.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[4]={["pos"]={-0.64.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
[5]={["pos"]={0.84.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[6]={["pos"]={-0.84.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
[7]={["pos"]={1.04.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[8]={["pos"]={-1.04.051.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
},

[482] = {["mode"]="lamp", 
[1]={["pos"]={0.50.41.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={-0.50.41.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[3]={["pos"]={0.2, -3.71.3}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
},

}

-- do not modify ----------------v=----------------------------
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_enabledthen
            setVehicleOverrideLights vehicle0)
            setVehicleLightState vehicle0,  )
            setVehicleLightState vehicle1,  )
            setVehicleLightState vehicle2,  )
            setVehicleLightState vehicle3,  )
        end
    end
    if (vehicles[vehicle]~=nilthen    
        -- release the markers
        for keyvalue in pairs(vehicles[vehicle]["flist"]) do
            destroyElement (value["m"])
        end
        
        vehicles[vehicle] = nil
    end
    if (timers[vehicle]~=nilthen
        -- kill the strobo timer
        killTimer(timers[vehicle])
        timers[vehicle] = nil
        
        if (isElement(vehicle)) then
            if (getElementDatavehicle"emerlights_source")==getPlayerName(getLocalPlayer())) then
                triggerEvent "onPlayerEmergencyLightStateChange"getRootElement(), )
            end
        end
    end
end

function checkForAbility(vehicle)
    local veh_model getElementModel vehicle )
    if (car_lights_table[veh_model]==nil)or(getElementDatavehicle"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]==nilthen
            if (checkForAbility(vehicle)==falsethen
                release_vehicle(vehicle)
                return
            end
            local veh_model getElementModel vehicle )
            
            
            local occupant getVehicleOccupantvehicle0)
            if (getElementType(occupant)=="player"then    -- peds also can use emerlights
                local src getPlayerName(occupant)
                setElementDatavehicle"emerlights_source"srcfalse)
                if (src==getPlayerName(getLocalPlayer())) then
                    triggerEvent "onPlayerEmergencyLightStateChange"getRootElement(), )
                end
            end
            
            vehicles[vehicle] = {}
            vehicles[vehicle]["lstate"] = 0     -- strobo lights state
            vehicles[vehicle]["fstate"] = 0    -- flash light state
            vehicles[vehicle]["flist"] = {}        -- flash lights list (marker ids)

            
            local mode car_lights_table[veh_model]["mode"]
            if (mode==nilthen
                mode "lamp"
            end
            
            local coeff 0
            if (mode=="lamp"then
                coeff 3.141592654/10.0
            else
                coeff blink_interval/10.0
            end
            
            vehicles[vehicle]["fmode"] = mode
            
            for light_idlight_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"] = createMarker0.00010.00010.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"], vehiclelight_desc["pos"][1], light_desc["pos"][2], light_desc["pos"][3] )
                end
            end
                
        end
        
        -- strobo light
        if (is_strobo_enabledthen
            setVehicleOverrideLights vehicle2)
            if (vehicles[vehicle]["lstate"]<strobo_intervalthen
                setVehicleLightState vehicle0,  )
                setVehicleLightState vehicle1,  )
                setVehicleLightState vehicle2,  )
                setVehicleLightState vehicle3,  )    
            else
                setVehicleLightState vehicle0,  )
                setVehicleLightState vehicle1,  )
                setVehicleLightState vehicle2,  )
                setVehicleLightState vehicle3,  )     
            end
            if (vehicles[vehicle]["lstate"]>=strobo_interval*2then
                vehicles[vehicle]["lstate"] = 0
            else
                vehicles[vehicle]["lstate"] = vehicles[vehicle]["lstate"] + 1
            end
        end
        -- flash light
        if (vehicles[vehicle]["fmode"]=="lamp"then
        -- lamp mode
            local tmp_fstate vehicles[vehicle]["fstate"]
            for keyvalue in pairs(vehicles[vehicle]["flist"]) do
                local RGBgetMarkerColorvalue["m"] )
                setMarkerColor(value["m"], RGB, (math.sin(tmp_fstate+value["p"])+1.0)*128.0)
            end
            
            vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + flash_interval
            
        else
        -- led mode
            local tmp_fstate vehicles[vehicle]["fstate"]

            for keyvalue in pairs(vehicles[vehicle]["flist"]) do
                local RGBgetMarkerColor(value["m"])
                -- blinking mode
                local tmp_val tmp_fstate+value["p"]
                if (tmp_val>blink_intervalthen
                    tmp_val tmp_val blink_interval
                end
                if ((tmp_val>=0)and(tmp_val<blink_duration))or((tmp_val>=blink_duration+1)and(tmp_val<blink_duration*1+2)) then
                    setMarkerColor(value["m"], RGB255)
                else
                    setMarkerColor(value["m"], RGB0)
                end
            end        
            vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + 1
            if (vehicles[vehicle]["fstate"]>blink_intervalthen
                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

    
    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


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 (getLocalPlayer()~=getVehicleOccupant( playerVehicle )) then
            return
        end
        if (checkForAbility(playerVehicle)) then
            triggerServerEvent("requestEmerlightChangeState", getLocalPlayer(), 1-isStroboLightsOn(getPedOccupiedVehicle(getLocalPlayer())))
        end
    end
end

addCommandHandler("swiatla", requestEmerlights)
bindKey("j", "down", "swiatla")

addEvent("onPlayerEmergencyLightStateChange")

DB3 nie wykrylo zadnych bledow.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-13, 19:51


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Jakie? czary chyba, liczba zmienia si? w tekst.
Zamie?
if?value[2]?==?"Burrito"?then
na
if?value[1]?==?"Burrito"?then

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
konoszovsky
Wysłany: 2019-07-13, 21:06


konoszovsky







Wiek: 24
Na forum: 3080 dni
Posty: 33
Nick w MP: konosz615

Piwa: 5

Respekt: 60

TO DZIALA XD, dziekowa masz piwko, moglbys jeszcze ogarnac dla mnie te syrenki ? :D

[ Dodano: 2019-07-13, 21:24 ]
Jednak po zmieniu tej value naprawione zostaly 2 bledy , dzieki :D

Postaw piwo autorowi tego posta
 

 
Tagi: pssm :: schowek :: dzwiekowe
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » PSSM schowek i dzwiekowe Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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