OskarYT
Mapper MTA
Wiek: 26 Na forum: 4245 dni Posty: 267
Nick w MP: Kaczorek2306
Piwa : 1230
local dzwiekiPojazdow = {
{ 407 , "sound/PSP.mp3" }, -- stra ? po ? arna
{ 416 , "sound/Ambulans.mp3" }, -- ambulans
}
addEventHandler ( "onPlayerVehicleEnter" , root , function()
local pojazd = getPedOccupiedVehicle ( source )
if not pojazd then return end -- nie powinno si ? wydarzy ?
local model = getElementModel ( pojazd ) -- pobieramy model pojazdu
for i , v in ipairs ( dzwiekiPojazdow ) do
if model == v [ 1 ] then
bindKey ( source , "j" , "down" , createSound )
bindKey ( source , "j" , "down" , destroySound )
end
end
end )
addEventHandler ( "onPlayerVehicleExit" , root , function()
local pojazd = getPedOccupiedVehicle ( source )
if not pojazd then return end -- nie powinno si ? wydarzy ?
local model = getElementModel ( pojazd ) -- pobieramy model pojazdu
for i , v in ipairs ( dzwiekiPojazdow ) do
if model == v [ 1 ] then
unBindKey ( source , "j" , "down" , createSound )
unBindKey ( source , "j" , "down" , destroySound )
end
end
end )
function createSound ( plr )
local pojazd = getPedOccupiedVehicle ( plr )
if not pojazd then return end -- not vehicle
local model = getElementModel ( pojazd )
for i , v in ipairs ( dzwiekiPojazdow ) do
if model == v [ 1 ] then
triggerClientEvent ( "createVehicleSound" , resourceRoot , pojazd , v [ 2 ])
end
end
end
function destroySound ( plr )
local pojazd = getPedOccupiedVehicle ( plr )
if not pojazd then return end -- not vehicle
local model = getElementModel ( pojazd )
for i , v in ipairs ( dzwiekiPojazdow ) do
if model == v [ 1 ] then
triggerClientEvent ( "destroyVehicleSound" , resourceRoot , pojazd , v [ 2 ])
end
end
end
--[[
@ author Split < yourworld . pl >
@ copyright 2011 - 2013 Split
Wszelkie prawa zastrze ? one .
#Zakazuje si? kopiowania tego kodu, zostawiam kod nie skopilowany aby
kto ? m ? g ? zobaczy ? jak to dzia ? a lub wygl ? da , prosz ? o nie kopiowanie ? ywcem kod ? w .
]]--
addEvent ( "createVehicleSound" , true )
addEventHandler ( "createVehicleSound" , root , function( pojazd , dzwiek )
for i , v in ipairs ( getAttachedElements ( pojazd )) do if getElementType ( v ) == "sound" then return end end
local snd = playSound3D ( dzwiek , 0 , 0 , 0 , true ) -- create sound
setSoundMaxDistance ( snd , 350 )
attachElements ( snd , pojazd )
end )
addEvent ( "destroyVehicleSound" , true )
addEventHandler ( "destroyVehicleSound" , root , function( pojazd )
for i , v in ipairs ( getAttachedElements ( pojazd )) do
if getElementType ( v ) == "sound" then
destroyElement ( v )
end
end
end )
to w og?le nie dzia?a czy m?g? by by? kto? tak mi?y i napisac mi albo naprawi? ten skrypt aby by?o mo?na na spokojnie urzywa? go prosz?