Wysłany: 2018-10-17, 21:45
FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3208 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
Wi?c. Chodzi o to ?e potrzebuje na serwer zrobi? 2 przecho, a nie wiem jak skrypt przerobi? bo wszystko dziala, ale jak respie pojazd ( klikam w przycisk wyciagnij ) To pojawia mi sie w starej przechowywalni.. Og?lnie to jest nowy skrypt bo myslalem ze lepiej aby przecho kazde bylo oddzielne wiec, tego starego nie podam. Ale jak przerobi? to, aby nie respilo pojazdu w tamtym starym! ( Zmienia?em kordy respu ).
local screenW , screenH = guiGetScreenSize ()
local marker = createMarker (- 2244.82 , 2382.45 , 5.07 - 0.9 , "cylinder" , 2 , 255 , 255 , 255 , 50 )
local sphere = createColCuboid (- 1966.6160888672 , 613.84454345703 , 33.78190612793 , 14.4 , 7.3 , 6.2 )
local t = createElement ( "text" )
setElementData ( t , "scale" , 1.5 )
setElementData ( t , "name" , "Odbi?r pojazd?w" )
setElementPosition ( t ,- 2244.82 , 2382.45 , 5.07 )
local wm ={}
wm . window = guiCreateWindow ( 0.25 , 0.26 , 0.51 , 0.42 , "Odbieranie pojazd?w" , true )
guiWindowSetSizable ( wm . window , false )
guiWindowSetMovable ( wm . window , false )
guiSetVisible ( wm . window , false )
wm . gridlist = guiCreateGridList ( 0.04 , 0.09 , 0.92 , 0.65 , true , wm . window )
guiGridListAddColumn ( wm . gridlist , "ID" , 0.2 )
guiGridListAddColumn ( wm . gridlist , "Model" , 0.55 )
guiGridListAddColumn ( wm . gridlist , "Zarejestrowany" , 0.2 )
wm . submit = guiCreateButton ( 0.04 , 0.76 , 0.47 , 0.19 , "Wyjmij pojazd" , true , wm . window )
wm . close = guiCreateButton ( 0.57 , 0.75 , 0.39 , 0.20 , "Zamknij" , true , wm . window )
addEvent ( "onParkingGetVehicles" , true )
addEventHandler ( "onParkingGetVehicles" , root , function( result )
guiGridListClear ( wm . gridlist )
if not result then return end
for i , v in pairs ( result ) do
if v [ "registered" ] == "false" then
v [ "registered" ] = "NIE"
else
v [ "registered" ] = "TAK"
end
local row = guiGridListAddRow ( wm . gridlist )
guiGridListSetItemText ( wm . gridlist , row , 1 , v [ "id" ], false , false )
guiGridListSetItemText ( wm . gridlist , row , 2 , getVehicleNameFromModel ( v [ "model" ]), false , false )
guiGridListSetItemText ( wm . gridlist , row , 3 , v [ "registered" ], false , false )
end
end )
addEventHandler ( "onClientMarkerHit" , marker , function( el , md )
if el ~= localPlayer then return end
if isPedInVehicle ( el ) then return end
if guiGetVisible ( wm . window ) == false then
showCursor ( true )
guiSetVisible ( wm . window , true )
triggerServerEvent ( "onParkingGetRekords" , localPlayer )
-- etCameraMatrix (- 2056.26 , 468.77 , 38.49 , - 2048.08 , 467.73 , 35.17 )
end
end )
addEventHandler ( "onClientGUIClick" , resourceRoot , function()
if source == wm . close then
if guiGetVisible ( wm . window ) == true then
showCursor ( false )
guiSetVisible ( wm . window , false )
setCameraTarget ( localPlayer , localPlayer )
end
end
if source == wm . submit then
local selectedRow = guiGridListGetSelectedItem ( wm . gridlist ) or - 1
if selectedRow < 0 then return end
local vehicles = getElementsWithinColShape ( sphere , "vehicle" )
if #vehicles > 0 then
outputChatBox ( "* Nie ma miejsca aby wyci?gn?? pojazd !" , localPlayer )
return
end
local id = guiGridListGetItemText ( wm . gridlist , selectedRow , 1 )
local register = guiGridListGetItemText ( wm . gridlist , selectedRow , 3 )
if register == "NIE" then
outputChatBox ( "* Zarejestruj pojazd w urz?dzie! Jego ID to " .. id , 255 , 0 , 0 )
return end
guiGridListRemoveRow ( wm . gridlist , selectedRow )
triggerServerEvent ( "onParkingVehicleSpawn" , localPlayer , tonumber ( id ))
end
end )
Wy?ej jest C_parking
Ni?ej jest S_parking
local marker = createMarker (- 2245.48 , 2372.41 , 5.00 - 2 , "cylinder" , 6.4 , 255 , 255 , 255 , 20 )
createBlip (- 2244.80 , 2382.52 , 5.07 , 35 , 2 , 0 , 0 , 0 , 0 , 0 , 250 )
local mdestroy = createColCuboid (- 2246.80078125 , 2370.4921875 , 3.7982120513916 , 5.5 , 6 , 2.25 )
local t = createElement ( "text" )
setElementData ( t , "scale" , 1.5 )
setElementData ( t , "name" , "Pozostawianie pojazd?w" )
setElementPosition ( t ,- 2245.48 , 2372.41 , 5.00 )
addEvent ( "onParkingGetRekords" , true )
addEventHandler ( "onParkingGetRekords" , root , function()
local sid = getElementData ( source , "player:sid" )
if not sid then return end
local org = getElementData ( source , "player:organization" )
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE (ownedPlayer=? OR ownedGroup=?) AND parking=1" , sid , org or "Brak" )
if #result > 0 then
triggerClientEvent ( source , "onParkingGetVehicles" , source , result )
end
end )
addEventHandler ( "onColShapeHit" , mdestroy , function( el , md )
if getElementType ( el ) == "player" then
local veh = getPedOccupiedVehicle ( el )
if not veh then return end
if getVehicleController ( veh ) ~= el then return end
local id = getElementData ( veh , "vehicle:id" )
if not id then return end
if isTimer ( timeroddania ) then return end
setElementFrozen ( veh , true )
outputChatBox ( "* Trwa zapisywanie pojazdu..." , el )
toggleControl ( el , "enter_exit" , false )
timeroddania = setTimer (function()
setElementFrozen ( veh , false )
local id = getElementData ( veh , "vehicle:id" )
if not id then return end
exports [ "pystories-vehicles" ]: onSaveVehicle ( veh )
destroyElement ( veh )
exports [ "pystories-db" ]: dbSet ( "UPDATE pystories_vehicles SET parking=1 WHERE id=?" , id )
toggleControl ( el , "enter_exit" , true )
outputChatBox ( "* Pomy?lnie zapisano pojazd." , el )
end , 3000 , 1 )
elseif getElementType ( el ) == "vehicle" then
local peds = getVehicleOccupants ( el )
if #peds > 0 then return end
local id = getElementData ( el , "vehicle:id" )
if not id then return end
if isTimer ( timeroddania ) then return end
timeroddania = setTimer (function()
setElementFrozen ( el , false )
local id = getElementData ( el , "vehicle:id" )
if not id then return end
exports [ "pystories-vehicles" ]: onSaveVehicle ( el )
destroyElement ( el )
exports [ "pystories-db" ]: dbSet ( "UPDATE pystories_vehicles SET parking=1 WHERE id=?" , id )
outputChatBox ( "* Pomy?lnie zapisano pojazd." , el , 255 , 255 , 255 , true )
end , 3000 , 1 )
setElementFrozen ( el , true )
setVehicleLocked ( el , true )
end
end )
addEvent ( "onParkingVehicleSpawn" , true )
addEventHandler ( "onParkingVehicleSpawn" , root , function( id )
if not id then return end
local spawn2 = exports [ "pystories-vehicles" ]: onRespawnVehicles ( _ , id ,{- 2260.22 , 2386.84 , 4.71 , 359.8 , 359.9 , 46.2 })
if spawn2 then
-- addEventHandler ( "onClientRender" , root , render1 )
outputChatBox ( "* Pomy?lnie wyci?gni?to pojazd z przechowalni." , el )
end
end )
Wysłany: 2018-10-17, 21:51
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
local spawn2 = exports [ "pystories-vehicles" ]: onRespawnVehicles ( _ , id ,{- 2260.22 , 2386.84 , 4.71 , 359.8 , 359.9 , 46.2 })
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2018-10-17, 22:13
FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3208 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
"BarteQ03" napisał/a : local spawn2 = exports [ "pystories-vehicles" ]: onRespawnVehicles ( _ , id ,{- 2260.22 , 2386.84 , 4.71 , 359.8 , 359.9 , 46.2 })
Takie co? ju? jest.
Wysłany: 2018-10-17, 22:29
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
No wklei?em Ci to poniewa? tutaj ustawiasz pozycj? respienia si? pojazdu.. fuck logic
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2018-10-17, 22:35
FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3208 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
"BarteQ03" napisał/a :No wklei?em Ci to poniewa? tutaj ustawiasz pozycj? respienia si? pojazdu.. fuck logic
Napisalem ?e o tym wiem, ale auto respi sie i tak w tym pierwszym przecho..
Wysłany: 2018-10-17, 23:00
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
No to zmie? pozycj? tworzenia pojazdu
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2018-10-17, 23:30
FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3208 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
"BarteQ03" napisał/a :No to zmie? pozycj? tworzenia pojazdu
Te? zmieniona
Wysłany: 2018-10-18, 08:02
Hemoglobina
Tylko Hema
Wiek: 29 Na forum: 3397 dni Posty: 89
Nick w MP: Answer
Piwa : 1386
Sprawd? czy oba skrypty korzystaj? z eventu o tej samej nazwie. Je?eli tak to zmie? nazwe w jednym z nich.
Wysłany: 2018-10-18, 21:38
FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3208 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
"Hemoglobina" napisał/a :Sprawd? czy oba skrypty korzystaj? z eventu o tej samej nazwie. Je?eli tak to zmie? nazwe w jednym z nich.
Daj jaki? przyk?ad.
Wysłany: 2018-10-18, 22:27
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
addEventHandler ( "onParkingGetRekords" , root , function()
to triggerujesz na wszystko czyli 'root' zmie? na resourceRoot
addEventHandler ( "onParkingVehicleSpawn" , root , function( id )
tu tak samo
resourceRoot znaczy ?e tylko w obr?bie tego zasobu b?dzie dzia?o si? to
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2018-10-20, 01:13
FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3208 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
"BarteQ03" napisał/a : addEventHandler ( "onParkingGetRekords" , root , function()
to triggerujesz na wszystko czyli 'root' zmie? na resourceRoot
addEventHandler ( "onParkingVehicleSpawn" , root , function( id )
tu tak samo
resourceRoot znaczy ?e tylko w obr?bie tego zasobu b?dzie dzia?o si? to
Teraz to mi nie pokazuje ?adnego auta kt?re mog? odebra? ( w Gui )
Wysłany: 2018-10-20, 01:24
DomineQ
lua mejster
Wiek: 22 Na forum: 3960 dni Posty: 309
Nick w MP: EZ3N
Piwa : 5186
Zamiast kombinowac z nowymi eventami itd, to zr?b po prostu elementdaty np. "przecho1", "przecho2"
i wtedy robisz event onmarkerhit, pobierasz edate i jezeli wszedl do np. "przecho1" to pojazd respi si? w tamtym miejscu. O.o nic trudnego
Wysłany: 2018-10-20, 01:29
FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3208 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
"DomineQ" napisał/a :Zamiast kombinowac z nowymi eventami itd, to zr?b po prostu elementdaty np. "przecho1", "przecho2"
i wtedy robisz event onmarkerhit, pobierasz edate i jezeli wszedl do np. "przecho1" to pojazd respi si? w tamtym miejscu. O.o nic trudnego
Daj przyk?ad. Albo lepiej napisz. Je?li masz czas
Wysłany: 2018-10-21, 16:03
Hemoglobina
Tylko Hema
Wiek: 29 Na forum: 3397 dni Posty: 89
Nick w MP: Answer
Piwa : 1386
Napisa?e?, ?e jest to nowy skrypt czyli posiadasz dwa osobne z t? sam? zawarto?ci?.
Event odpowiadaj?cy za wyciaganie to
addEvent ( "onParkingVehicleSpawn" , true )
addEventHandler ( "onParkingVehicleSpawn" , root , function( id )
Sprawd? czy w tym drugim skrypcie event ma nazwe "onParkingVehicleSpawn", je?eli tak to zmie? nazw? w jednym ze skrypt?w i pami?taj, ?eby to zrobi? po stronie serwera jak i klienta.
Tagi: przecho
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: