jg2aviva1
Rusek :D
Wiek: 25 Na forum: 4134 dni Posty: 445
Nick w MP: _Wolfenstei[N]^.^
Piwa : 1033
Siema. Znowu mam problem, tym razem z fotoradarami. Tak si? bawi?em t? komend? "/showcol 1" i zauwa?y?em ?e fotoradary nie maj? swojego "pola" skanowania. Nawet jest b??d w db3:
Kod: Bad argument @ 'createColSphere' [Expected number at argument 4, got nil]
A oto kod lua:
local function utworzObiekty ( x , y , z )
local o1 = createObject ( 1622 , x , y , z , 0.9 )
local o2 = createObject ( 16101 , x + 0.3 , y - 0.1 , z - 0.8 , 180 )
-- attachElements ( o1 , o2 )
-- return o1
end
local fotoradary = {
{ - 193.26 , 1125.50 , 19.80 , 15 , limit = 80 }, -- fort carson
{ 1009.43 , 2547.59 , 10.76 , 25 , limit = 165 }, -- lv autostrada
{ - 854.88 , 1498.50 , 19.37 , 15 , limit = 80 }, -- las barancas
{ 1217.44 , 1827.65 , 7.62 , 15 , limit = 165 }, -- lv obwodnica
{ 87.39 , 2701.56 , 53.17 , 15 , limit = 120 }, -- lv <> payasadas
{- 2000.49 , 2612.68 , 51.30 , 15 , limit = 120 }, -- tunel bayside <> pustynia
{- 2645.31 , 2484.64 , 32.54 , 30 , limit = 890 }, -- zjazd do bayside
{- 1664.31 , 377.64 , 7.54 , 14 , limit = 100 }, -- sf stacja przy pd
{- 1999.0087890625 , 244.00500488281 , 29.55846786499 , 14 , limit = 100 },
{ 1494.15 ,- 1726.67 , 14 , limit = 60 }, -- spawn Los Santos
{ 1966.98 ,- 2042.16 , 14 , limit = 80 }, -- Droga na Lot LS
}
local sw , sh = guiGetScreenSize ()
local screen = dxCreateScreenSource ( sw / 3 , sh / 3 );
local screenRot = math . random (- 15 , 15 )
function pokazFotke ()
dxDrawImage ( sw / 20 , sh * 5 / 14 , sw / 3 , sh / 3 , screen , screenRot )
end
function niePokazuj ()
removeEventHandler ( "onClientRender" , getRootElement (), pokazFotke )
end
local lu = getTickCount ()
function fotoradarKomorka ( theElement , matchingDimension )
for k , v in pairs ( fotoradary ) do
if ( source == fotoradary [ k ]. cs ) then
if getTickCount ()- lu < 500 then return end
if ( theElement == getLocalPlayer () and isPedInVehicle ( getLocalPlayer () ) ) then
local veh = getPedOccupiedVehicle ( theElement )
if getVehicleController ( veh )~= localPlayer then return end
local vm = getElementModel ( veh )
if getVehicleSirensOn ( veh ) then
-- pojazdowi na sygnale nic ine robimy
else
speedx , speedy , speedz = getElementVelocity ( veh )
actualspeed = ( speedx ^ 2 + speedy ^ 2 + speedz ^ 2 )^( 0.5 )
kmh = actualspeed * 180
if ( kmh > fotoradary [ k ]. limit ) then
outputChatBox ( "Przekroczyles dopuszczalna predkosc!!" , 255 , 0 , 0 )
fadeCamera ( false , 0.1 , 255 , 255 , 255 )
setSoundMaxDistance ( playSound3D ( "fx-fotoradar.ogg" , fotoradary [ k ][ 1 ], fotoradary [ k ][ 2 ], fotoradary [ k ][ 3 ], false ), 31337 )
if ( screen ) then
local x , y , z = getElementPosition ( veh )
dxUpdateScreenSource ( screen )
addEventHandler ( "onClientRender" , getRootElement (), pokazFotke )
setTimer ( niePokazuj , 1000 , 1 )
end
triggerServerEvent ( "onWykroczenie" , localPlayer , math . floor ( kmh ), fotoradary [ k ]. limit , "Przekroczenie pr?dko?ci-" .. math . floor ( kmh ).. "/" .. fotoradary [ k ]. limit .. "kmh" )
lu = getTickCount ()
-- setTimer ( fadeCamera , 800 , 1 , false , 0.1 , 255 , 255 , 255 )
setTimer ( playSound3D , 900 , 1 , "fx-fotoradar.ogg" , fotoradary [ k ][ 1 ], fotoradary [ k ][ 2 ], fotoradary [ k ][ 3 ], false )
setTimer ( fadeCamera , 100 , 1 , true , 1.2 ) -- plynny powrot z bialego ekranu
end
end
end
return
end
end
end
for k , v in pairs ( fotoradary ) do
fotoradary [ k ]. cs = createColSphere ( fotoradary [ k ][ 1 ], fotoradary [ k ][ 2 ], fotoradary [ k ][ 3 ], fotoradary [ k ][ 4 ])
local o = utworzObiekty ( fotoradary [ k ][ 1 ], fotoradary [ k ][ 2 ], fotoradary [ k ][ 3 ]+ 3 )
-- setElementPosition ( o , fotoradary [ k ][ 1 ], fotoradary [ k ][ 2 ], fotoradary [ k ][ 3 ])
-- attachElements ( o , fotoradary [ k ]. cs )
end
addEventHandler ( "onClientColShapeHit" , resourceRoot , fotoradarKomorka )
Podpis
GTAO Member: 2015-08-23, 14:26