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: 3221 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(veh, 94,0,0 )
local col = createColSphere( 0,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: 4569 dni
Posty: 3409

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: 3221 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[1] then
        return true
    else
        return false
    end
end


local fractionVehicles = {

{ "Burrito",298.69, -169.11, 1.60,90},
{ "Fire Truck",298.50, -162.79, 1.80,90},
{ "Fire Truck",298.39, -156.35, 1.80,90},
                                               

}

local col

for key, value in ipairs(fractionVehicles) do
    local veh = createVehicle( getVehicleModelFromName( value[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(veh, 94,0,0 )
local col = createColSphere( 0,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(veh, 108,0,0,255,255,255,0,0,0,0,0,0 )
local col = createColSphere( 0,0,3,1 )
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 ( col, veh, 0, -3, 0 )
setVehicleHandling(veh, "driveType", "awd")
setVehicleVariant(veh,1,1)
end

if value[3] == "Patriot" then
setVehicleColor(veh, 94,0,0, 94,0,0 )
local col = createColSphere( 0,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 Thanks, vovo4ka for the this script :)

local screenW, screenH = guiGetScreenSize()

local sx, sy = guiGetScreenSize()

local strobo_interval = 0        -- strobo light freq. 10 = 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.5, 0.9}, ["color"]={255,0,0}, ["size"]=0.12, ["phase"]=5.0}, 
[2]={["pos"]={-0.38, -0.5, 0.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0}, 
[3]={["pos"]={0.38, -0.5, 0.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0},
[4]={["pos"]={-0.13, -0.5, 0.9}, ["color"]={255,0,0}, ["size"]=0.12, ["phase"]=5.0}, 
[5]={["pos"]={-0.48, -0.5, 0.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0}, 
[6]={["pos"]={0.48, -0.5, 0.9}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0}, 
[7]={["pos"]={-0.22, 2.15, -0.0}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=10.0}, 
[8]={["pos"]={0.22, 2.15, -0.0}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=0.0} 
},


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

[427] = {["mode"]="led", 
[1]={["pos"]={0.15, 1.18, 1.39}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=5.0}, -- gora front niebieskie
[2]={["pos"]={0.55, 1.18, 1.39}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=5.0}, -- gora front niebieskie
[3]={["pos"]={-0.15, 1.18, 1.39}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- gora front czerwone
[4]={["pos"]={-0.55, 1.18, 1.39}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- gora front czerwone
[5]={["pos"]={-1.15, -3.1, 1.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy tyl red
[6]={["pos"]={-1.15, -3.35, 1.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy tyl blue
[7]={["pos"]={-1.15, -0.53, 1.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy przod red
[8]={["pos"]={-1.15, -0.78, 1.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok lewy przod blue
[9]={["pos"]={1.15, -3.1, 1.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy tyl red
[10]={["pos"]={1.15, -3.35, 1.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy tyl blue
[11]={["pos"]={1.15, -0.53, 1.52}, ["color"]={169,0,0}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy przod red
[12]={["pos"]={1.15, -0.78, 1.52}, ["color"]={0,65,140}, ["size"]=0.18, ["phase"]=0.0}, -- bok prawy przod blue
[13]={["pos"]={1.02, -3.83, 0.95}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=5.0}, -- tyl prawy przod red
[14]={["pos"]={0.83, -3.83, 0.95}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=9.0}, -- tyl prawy przod blue
[15]={["pos"]={-0.83, -3.83, 0.95}, ["color"]={169,0,0}, ["size"]=0.16, ["phase"]=5.0}, -- tyl lewy przod red
[16]={["pos"]={-1.02, -3.83, 0.95}, ["color"]={0,65,140}, ["size"]=0.16, ["phase"]=9.0}, -- tyl lewy przod blue
},


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

[498] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.87, 1.96, 2.18}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={0.87, 1.96, 2.18}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
----
[3]={["pos"]={0, -3.97, 2.27}, ["color"]={0,100,255}, ["size"]=0.25, ["phase"]=7},
},


--[[
-- Karetka S
[413] = {["mode"]="led", 
[1]={["pos"]={-0.5, 0.4, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[2]={["pos"]={-0.4, 0.4, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.6, 0.4, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------
[4]={["pos"]={0.4, 0.4, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[5]={["pos"]={0.5, 0.4, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[6]={["pos"]={0.6, 0.4, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
[7]={["pos"]={0.5, -2.8, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[8]={["pos"]={0.4, -2.8, 2}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------------
[9]={["pos"]={-0.4, -2.8, 2}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1},
[10]={["pos"]={-0.5, -2.8, 2}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},
},
]]
----Karetka P
[421] = {["mode"]="led",  
[1]={["pos"]={ 0.45, -0.28, 0.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=1},
[2]={["pos"]={ 0.20, -0.28, 0.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=1},
[3]={["pos"]={ 0.08, -0.28, 0.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=1},
[4]={["pos"]={ -0.45, -0.28, 0.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=7},
[5]={["pos"]={ -0.20, -0.28, 0.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=7},
[6]={["pos"]={ -0.08, -0.28, 0.87}, ["color"]={0,100,255}, ["size"]=0.12, ["phase"]=7},
[7]={["pos"]={ -0.27, 2.53, 0.01}, ["color"]={0,100,255}, ["size"]=0.07, ["phase"]=7},
[8]={["pos"]={ 0.27, 2.53, 0.01}, ["color"]={0,100,255}, ["size"]=0.07, ["phase"]=1},
},

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

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

[604] = {["mode"]="led", 
[1]={["pos"]={ 0.39, 0.33, 0.67}, ["color"]={0,30,255}, ["size"]=0.1, ["phase"]=6.0}, 
[2]={["pos"]={ 0.5, 0.33, 0.64}, ["color"]={169,0,0}, ["size"]=0.1, ["phase"]=5.0}, 
[3]={["pos"]={ -0.39, 0.33, 0.67}, ["color"]={0,30,255}, ["size"]=0.1, ["phase"]=8.0}, 
[4]={["pos"]={ -0.5, 0.33, 0.65}, ["color"]={169,0,0}, ["size"]=0.1, ["phase"]=5.0}, 
[5]={["pos"]={ -0.06, 0.9, 0.35}, ["color"]={0,65,140}, ["size"]=0.1, ["phase"]=0.0}, 
[6]={["pos"]={ 0.06, 0.9, 0.35}, ["color"]={0,65,140}, ["size"]=0.1, ["phase"]=5.0}, 
[7]={["pos"]={ 0.46, -1.7, 0.4}, ["color"]={0,65,140}, ["size"]=0.13, ["phase"]=5.0}, 
[8]={["pos"]={ -0.46, -1.7, 0.4}, ["color"]={0,65,140}, ["size"]=0.13, ["phase"]=0.0}, 
},

[550] = {["mode"]="lamp", 
[1]={["pos"]={0.25, 2.75, -0.1}, ["color"]={0,100,255}, ["size"]=0.1, ["phase"]=1}, 
[2]={["pos"]={-0.25, 2.75, -0.1}, ["color"]={0,100,255}, ["size"]=0.1, ["phase"]=9}, 
----
[3]={["pos"]={ -0.55, 0, 0.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=9}, 
[4]={["pos"]={ -0.45, 0, 0.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=9}, 
[5]={["pos"]={ -0.35, 0, 0.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=9}, 
-----
[6]={["pos"]={ 0.55, 0, 0.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=1}, 
[7]={["pos"]={ 0.45, 0, 0.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=1}, 
[8]={["pos"]={ 0.35, 0, 0.81}, ["color"]={0,100,255}, ["size"]=0.11, ["phase"]=1}, 
},

[573] = {["mode"]="lamp", 
[1]={["pos"]={0.9, 2.8, 1.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1}, 
[2]={["pos"]={0.7, 2.8, 1.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1}, 
[3]={["pos"]={0.5, 2.8, 1.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1}, 
-----------------
[4]={["pos"]={-0.9, 2.8, 1.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7}, 
[5]={["pos"]={-0.7, 2.8, 1.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7}, 
[6]={["pos"]={-0.5, 2.8, 1.4}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},

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

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

[440] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.6, 0.93, 1.25}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=7},
[2]={["pos"]={-0.5, 0.93, 1.25}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.4, 0.93, 1.25}, ["color"]={255,0,0}, ["size"]=0.2, ["phase"]=1},
------------
[4]={["pos"]={0.6, 0.93, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[5]={["pos"]={0.5, 0.93, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[6]={["pos"]={0.4, 0.93, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
[7]={["pos"]={-1.04, -3.6, 1.48}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[8]={["pos"]={1.04, -3.6, 1.48}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------------
[9]={["pos"]={-1.22, -3.36, 1.46}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=1},
[10]={["pos"]={1.22, -3.36, 1.46}, ["color"]={0,100,255}, ["size"]=0.3, ["phase"]=7},

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

},

[428] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.6, 0.88, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[2]={["pos"]={-0.5, 0.88, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.4, 0.88, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------
[4]={["pos"]={0.6, 0.88, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[5]={["pos"]={0.5, 0.88, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[6]={["pos"]={0.4, 0.88, 1.25}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
},

[407] = {["mode"]="lamp",  ----Woz strazacki 
[1]={["pos"]={1, 3.8, 1.0}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={1, 3.8, 1.0}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={1, 3.8, 1.0}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
------------------
[4]={["pos"]={0.9, 3.2, 1.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[5]={["pos"]={0.9, 3.1, 1.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[6]={["pos"]={0.9, 3.1, 1.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
-----------------
[7]={["pos"]={-0.9, 3.2, 1.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[8]={["pos"]={-0.9, 3.1, 1.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
[9]={["pos"]={-0.9, 3.1, 1.8}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=8},
},
[544] = {["mode"]="led",  ----Karetka P 582 
[1]={["pos"]={-0.88, 3.1, 1.6}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
---
[2]={["pos"]={0.88, 3.1, 1.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.5, 0.4, 1.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={-0.5, 0.4, 1.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[3]={["pos"]={0.2, -3.7, 1.3}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
},

[500] = {["mode"]="lamp",  ----Karetka P 582 
[1]={["pos"]={-0.6, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={-0.5, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[3]={["pos"]={-0.4, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[4]={["pos"]={-0.3, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
-----
[5]={["pos"]={0.6, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
[6]={["pos"]={0.5, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
[7]={["pos"]={0.4, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
[8]={["pos"]={0.3, 0.2, 1}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=11},
},

[578] = {["mode"]="led", 
[1]={["pos"]={0.4, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[2]={["pos"]={-0.4, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
[3]={["pos"]={0.6, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[4]={["pos"]={-0.6, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
[5]={["pos"]={0.8, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[6]={["pos"]={-0.8, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
[7]={["pos"]={1.0, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=1},
[8]={["pos"]={-1.0, 4.05, 1.42}, ["color"]={255,160,50}, ["size"]=0.20, ["phase"]=6},
},

[482] = {["mode"]="lamp", 
[1]={["pos"]={0.5, 0.4, 1.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=1},
[2]={["pos"]={-0.5, 0.4, 1.4}, ["color"]={0,100,255}, ["size"]=0.2, ["phase"]=7},
[3]={["pos"]={0.2, -3.7, 1.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_enabled) then
            setVehicleOverrideLights ( vehicle, 0)
            setVehicleLightState ( vehicle, 0,  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
            if (checkForAbility(vehicle)==false) then
                release_vehicle(vehicle)
                return
            end
            local veh_model = getElementModel ( vehicle )
            
            
            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
            
            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==nil) then
                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_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
        
        -- 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
        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
            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+1)and(tmp_val<blink_duration*1+2)) 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

    
    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: 4569 dni
Posty: 3409

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: 3221 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