Wysłany: 2018-11-02, 14:39
adisonboss
Wiek: 21 Na forum: 2702 dni Posty: 235
Piwa : 6
Witam ot?? mam dwa skrypty na sygna?y d?wi?kowe. Dla przyk?adu mam sygna?y pod klawiszem "1" oraz "h" i gdy w??cz? dwa wszystko dzia?a Okej, ale gdy chce wy??czy? jeden z nich to wy??czaj? si? dwa. Jak to naprawi? ?Bo generalnie chce ?eby ten pod "h" by? jako horn. ZA POMOC PIWO i RESPEKT
addEvent ( "broadcastSound3D1" , true )
addEventHandler ( "broadcastSound3D1" , root , function( sound , range , minrange , bliskiKomunikat , dalekiKomunikat )
local el = source
if getElementDimension ( localPlayer )~= getElementDimension ( el ) then return end
if getElementInterior ( localPlayer )~= getElementInterior ( el ) then return end
local x , y , z = getElementPosition ( localPlayer )
local x2 , y2 , z2 = getElementPosition ( el )
local dist = getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )
if dist < range * 2 then
if bliskiKomunikat and minrange and dist < minrange then
triggerEvent ( "onCaptionedEvent1" , root , bliskiKomunikat , 10 )
outputChatBox ( " * " .. bliskiKomunikat )
elseif dalekiKomunikat and dist < range then
triggerEvent ( "onCaptionedEvent1" , root , dalekiKomunikat , 10 )
outputChatBox ( " * " .. dalekiKomunikat )
end
local s = playSound3D ( sound , x2 , y2 , z2 )
setSoundMinDistance ( s , minrange or 5 )
setSoundMaxDistance ( s , range )
end
end )
--------------------------------------------------------------------------------------- SAPD
local soundSwitch_lu1 = getTickCount ()- 2000
local function soundSwitch_lu1 ()
outputDebugString ( "sw0" )
if getTickCount ()- soundSwitch_lu1 < 2000 then return end
soundSwitch_lu1 = getTickCount ()
local pojazd = getPedOccupiedVehicle ( localPlayer )
outputDebugString ( "sw2" )
if pojazd and getVehicleController ( pojazd )== localPlayer then
local em = getElementModel ( pojazd )
if em == 431 or em == 490 or em == 433 or em == 552 or em == 544 or em == 419 or em == 515 or em == 601 or em == 407 or em == 499 or em == 403 then -- SAPD
triggerServerEvent ( "toggleVehicleSound1" , pojazd , "poganiaczPSP.ogg" , 225 )
cancelEvent ()
return
end
end
end
bindKey ( "i" , "down" , soundSwitch_lu1 )
local soundSwitch_lu1 = getTickCount ()- 2000
local function soundSwitch_lu1 ()
outputDebugString ( "sw0" )
if getTickCount ()- soundSwitch_lu1 < 2000 then return end
soundSwitch_lu1 = getTickCount ()
local pojazd = getPedOccupiedVehicle ( localPlayer )
outputDebugString ( "sw2" )
if pojazd and getVehicleController ( pojazd )== localPlayer then
local em = getElementModel ( pojazd )
if em == 467 or em == 498 or em == 416 or em == 438 or em == 440 or em == 456 or em == 609 or em == 482 or em == 483 or em == 529 or em == 507 or em == 596 or em == 418 or em == 598 or em == 523 or em == 545 or em == 427 or em == 599 or em == 597 or em == 546 or em == 413 or em == 471 or em == 500 then -- SAPD
triggerServerEvent ( "toggleVehicleSound1" , pojazd , "sapd_horn.ogg" , 225 )
cancelEvent ()
return
end
end
end
bindKey ( "i" , "down" , soundSwitch_lu1 )
-- SAPD + SAMC / SAMA
-- triggerClientEvent ( "createVehicleSound1" , source , dzwiek , range )
addEvent ( "createVehicleSound1" , true )
addEventHandler ( "createVehicleSound1" , root , function( dzwiek , range )
local snd = playSound3D ( dzwiek , 0 , 0 , 0 , true )
setSoundMaxDistance ( snd , range or 125 )
attachElements ( snd , source )
end )
addEvent ( "destroyVehicleSound1" , true )
addEventHandler ( "destroyVehicleSound1" , root , function()
local el = getAttachedElements ( source )
for i , v in ipairs ( el ) do
if getElementType ( v )== "sound" then
destroyElement ( v )
end
end
end )
-- triggerClientEvent ( "odtworzDzwiek1" , resourceRoot , dzwiek )
addEvent ( "odtworzDzwiek1" , true )
addEventHandler ( "odtworzDzwiek1" , resourceRoot , function( dzwiek )
if fileExists ( "audio/" .. dzwiek .. ".ogg" ) then
playSound ( "audio/" .. dzwiek .. ".ogg" )
elseif fileExists ( "audio/" .. dzwiek .. ".mp3" ) then
playSound ( "audio/" .. dzwiek .. ".mp3" )
end
end )
DB3
https://imgur.com/a/2UPyUPm
Wysłany: 2018-11-02, 16:05
Avenged
Młodszy Szkrypter
Wiek: 22 Na forum: 2880 dni Posty: 654
Nick w MP: Avenged
Piwa : 1545
local soundSwitch_lu1 = getTickCount ()- 2000
local function soundSwitch_lu1 ()
zmie? nazw? zmiennej bo pokrywa Ci si? ona z funkcj?
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2018-11-02, 17:05
adisonboss
Wiek: 21 Na forum: 2702 dni Posty: 235
Piwa : 6
local soundSwitch_lu1 = getTickCount ()- 2000 na co? innego tak ?
[ Dodano : 2018-11-02, 17:13 ]
Mam takie cos ale nadal usuwaj? si? oba sygna?y a nie jeden
W DB3 NIC NIE MA
addEvent ( "broadcastSound3D1" , true )
addEventHandler ( "broadcastSound3D1" , root , function( sound , range , minrange , bliskiKomunikat , dalekiKomunikat )
local el = source
if getElementDimension ( localPlayer )~= getElementDimension ( el ) then return end
if getElementInterior ( localPlayer )~= getElementInterior ( el ) then return end
local x , y , z = getElementPosition ( localPlayer )
local x2 , y2 , z2 = getElementPosition ( el )
local dist = getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )
if dist < range * 2 then
if bliskiKomunikat and minrange and dist < minrange then
triggerEvent ( "onCaptionedEvent1" , root , bliskiKomunikat , 10 )
outputChatBox ( " * " .. bliskiKomunikat )
elseif dalekiKomunikat and dist < range then
triggerEvent ( "onCaptionedEvent1" , root , dalekiKomunikat , 10 )
outputChatBox ( " * " .. dalekiKomunikat )
end
local s = playSound3D ( sound , x2 , y2 , z2 )
setSoundMinDistance ( s , minrange or 5 )
setSoundMaxDistance ( s , range )
end
end )
--------------------------------------------------------------------------------------- SAPD
local soundSwitch_lu1 = getTickCount ()- 2000
local function soundSwitch_lu12 ()
outputDebugString ( "sw0" )
if getTickCount ()- soundSwitch_lu1 < 2000 then return end
soundSwitch_lu1 = getTickCount ()
local pojazd = getPedOccupiedVehicle ( localPlayer )
outputDebugString ( "sw2" )
if pojazd and getVehicleController ( pojazd )== localPlayer then
local em = getElementModel ( pojazd )
if em == 431 or em == 490 or em == 433 or em == 552 or em == 544 or em == 419 or em == 515 or em == 601 or em == 407 or em == 499 or em == 403 then -- SAPD
triggerServerEvent ( "toggleVehicleSound1" , pojazd , "poganiaczPSP.ogg" , 225 )
cancelEvent ()
return
end
end
end
bindKey ( "i" , "down" , soundSwitch_lu12 )
local soundSwitch_lu1 = getTickCount ()- 2000
local function soundSwitch_lu12 ()
outputDebugString ( "sw0" )
if getTickCount ()- soundSwitch_lu1 < 2000 then return end
soundSwitch_lu1 = getTickCount ()
local pojazd = getPedOccupiedVehicle ( localPlayer )
outputDebugString ( "sw2" )
if pojazd and getVehicleController ( pojazd )== localPlayer then
local em = getElementModel ( pojazd )
if em == 467 or em == 498 or em == 416 or em == 438 or em == 440 or em == 456 or em == 609 or em == 482 or em == 483 or em == 529 or em == 507 or em == 596 or em == 418 or em == 598 or em == 523 or em == 545 or em == 427 or em == 599 or em == 597 or em == 546 or em == 413 or em == 471 or em == 500 then -- SAPD
triggerServerEvent ( "toggleVehicleSound1" , pojazd , "sapd_horn.ogg" , 225 )
cancelEvent ()
return
end
end
end
bindKey ( "i" , "down" , soundSwitch_lu12 )
-- SAPD + SAMC / SAMA
-- triggerClientEvent ( "createVehicleSound1" , source , dzwiek , range )
addEvent ( "createVehicleSound1" , true )
addEventHandler ( "createVehicleSound1" , root , function( dzwiek , range )
local snd = playSound3D ( dzwiek , 0 , 0 , 0 , true )
setSoundMaxDistance ( snd , range or 125 )
attachElements ( snd , source )
end )
addEvent ( "destroyVehicleSound1" , true )
addEventHandler ( "destroyVehicleSound1" , root , function()
local el = getAttachedElements ( source )
for i , v in ipairs ( el ) do
if getElementType ( v )== "sound" then
destroyElement ( v )
end
end
end )
-- triggerClientEvent ( "odtworzDzwiek1" , resourceRoot , dzwiek )
addEvent ( "odtworzDzwiek1" , true )
addEventHandler ( "odtworzDzwiek1" , resourceRoot , function( dzwiek )
if fileExists ( "audio/" .. dzwiek .. ".ogg" ) then
playSound ( "audio/" .. dzwiek .. ".ogg" )
elseif fileExists ( "audio/" .. dzwiek .. ".mp3" ) then
playSound ( "audio/" .. dzwiek .. ".mp3" )
end
end )
[ Dodano : 2018-11-04, 13:05 ]
BarteQ03 , Jakis pomysl dalej ?
[ Dodano : 2018-11-12, 10:14 ]
Kto? co? ?
Tagi: trąby
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: