FeiZzu
Początkujący skrypter
Wiek: 23 Na forum: 3207 dni Posty: 37
Nick w MP: Ventii
Piwa : 8
Witam mam mianowicie problem taki, ?e po przepisaniu auta do organizacji.
( Tak s?ysza?em bo nie widzia?em na oczy ) To potem gracz nie mo?e kupowa? aut,
Nie widzi ich w przechowywalni itd. G??wny problem niby polega w przechowywalni.
Wy?le tutaj lua na przepisywanie i przechowywalni i wy?le co mi si? pokazuje w bazie, je?li gracz wchodzi do blipu.
> Je?li gracz wejdzie do blipu ( ten kt?ry przepisa? auto na org )
[18-10-20 16:00] ERROR: [Skrypty]/pystories-parking/s_parking.lua:32: attempt to get length of local 'result' (a boolean value)
[18-10-20 16:00] WARNING: [pystories]/[Bazydanych]/pystories-db/s_db.lua:18: dbPoll failed; Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
A tutaj jest kod na przecho i urzad.
Przecho >
local marker = createMarker (- 2668.60 , 6.46 , 4.35 - 2 , "cylinder" , 6.4 , 255 , 255 , 255 , 20 )
createBlip (- 2668.60 , 6.46 , 4.35 , 35 , 2 , 0 , 0 , 0 , 0 , 0 , 250 )
local mdestroy = createColCuboid (- 2672.3869628906 , 3.2640442848206 , 3.3535442352295 , 6.25 , 7.25 , 2.5 )
local t = createElement ( "text" )
setElementData ( t , "scale" , 1.5 )
setElementData ( t , "name" , "Pozostawianie pojazd?w" )
setElementPosition ( t ,- 2668.60 , 6.46 , 4.35 )
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 spawn = exports [ "pystories-vehicles" ]: onRespawnVehicles ( _ , id ,{- 2661.19 , 17.96 , 4.08 , 360.0 , 360.0 , 181.2 })
if spawn then
setElementPosition ( el , - 2656.98 , 17.01 , 4.35 )
outputChatBox ( "* Pomy?lnie wyci?gni?to pojazd z przechowalni." , el )
end
end )
Urz?d >
function refreshgui ( element )
local uid = getElementData ( element , "player:sid" )
if not uid then return end
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE ownedPlayer=?" , uid )
triggerClientEvent ( element , "org:refresh" , resourceRoot , result )
end
addEvent ( "org:check" , true )
addEventHandler ( "org:check" , resourceRoot , function( id , name )
-- Pobieramy SID gracza
local uid = getElementData ( client , "player:sid" )
if not uid then return end
-- Sprawdzamy czy jest jeszcze w ? a ? cicielem
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE id=? AND ownedPlayer=?" , id , uid )
if #result < 0 then
outputChatBox ( "* Nie jeste? w?a?cicielem pojazdu." , client , 255 , 0 , 0 )
return
end
local org = getElementData ( client , "player:organization" )
if not org then outputChatBox ( "* Nie jeste? w organizacji !" , client , 255 , 0 , 0 ) return end
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE id=? AND parking=0" , id , org )
if #result > 0 then
outputChatBox ( "* Pojazd nie jest w przechowalni !." , client , 255 , 0 , 0 )
return
end
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE id=? AND ownedPlayer=?" , id , uid )
if #result > 0 then
if result [ 1 ]. ownedGroup ~= "0" then
local query = exports [ "pystories-db" ]: dbSet ( "UPDATE pystories_vehicles SET ownedGroup=0 WHERE id=? AND ownedPlayer=?" , id , uid )
outputChatBox ( "* Zmieni?e?(a?) pojazdowi " .. name .. "(" .. id .. ") przypis na siebie" , client )
refreshgui ( client )
return
end
local query = exports [ "pystories-db" ]: dbSet ( "UPDATE pystories_vehicles SET ownedGroup=? WHERE id=? AND ownedPlayer=?" , org , id , uid )
if query then
outputChatBox ( "* Zmieni?e?(a?) pojazdowi " .. name .. "(" .. id .. ") przypis na organizacje" , client )
refreshgui ( client )
end
end
end )
addEvent ( "org:download" , true )
addEventHandler ( "org:download" , resourceRoot , refreshgui )
2 >
local marker = createMarker ( 358.78 , 166.24 , 1008.38 - 1 , "cylinder" , 1.2 , 255 , 69 , 0 , 93 )
setElementInterior ( marker , 3 )
setElementDimension ( marker , 1 )
local t = createElement ( "text" )
setElementPosition ( t , 358.78 , 166.24 , 1008.38 )
setElementInterior ( t , 3 )
setElementDimension ( t , 1 )
setElementData ( t , "name" , "Przepisywanie pojazd?w" )
local wm ={}
wm . window = guiCreateWindow ( 0.22 , 0.22 , 0.59 , 0.53 , "Przepisanie Pojazd?w" , true )
guiWindowSetSizable ( wm . window , false )
guiWindowSetMovable ( wm . window , false )
guiSetVisible ( wm . window , false )
wm . gridlist = guiCreateGridList ( 0.03 , 0.09 , 0.93 , 0.72 , true , wm . window )
guiGridListAddColumn ( wm . gridlist , "ID" , 0.2 )
guiGridListAddColumn ( wm . gridlist , "Nazwa" , 0.5 )
guiGridListAddColumn ( wm . gridlist , "Organizacja" , 0.5 )
wm . submit = guiCreateButton ( 0.35 , 0.84 , 0.28 , 0.11 , "Przepisz" , true , wm . window )
wm . close = guiCreateButton ( 0.68 , 0.84 , 0.28 , 0.11 , "Zamknij" , true , wm . window )
addEventHandler ( "onClientGUIClick" , root , function( btn , state )
if source == wm . submit then
local selectedRow = guiGridListGetSelectedItem ( wm . gridlist )
if selectedRow < 0 then return end
local id = tostring ( guiGridListGetItemText ( wm . gridlist , selectedRow , 1 ))
local name = tostring ( guiGridListGetItemText ( wm . gridlist , selectedRow , 2 ))
triggerServerEvent ( "org:check" , resourceRoot , id , name )
end
if source == wm . close then
if guiGetVisible ( wm . window ) == true then
showCursor ( false )
guiSetVisible ( wm . window , false )
end
end
end )
addEvent ( "org:refresh" , true )
addEventHandler ( "org:refresh" , resourceRoot , function( result )
guiGridListClear ( wm . gridlist )
for i , v in pairs ( result ) do
if string . len ( v . plateText ) < 1 then v . plateText = "Brak" end
local row = guiGridListAddRow ( wm . gridlist )
if tostring ( v . ownedGroup ) == "0" then v . ownedGroup = "Brak" end
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 . ownedGroup , false , false )
end
end )
addEventHandler ( "onClientMarkerHit" , marker , function( el , md )
if el ~= localPlayer then return end
if not getElementData ( el , "player:organization" ) then outputChatBox ( "* Nie posiadasz organizacji !" ) return end
if not guiGetVisible ( wm . gridlist ) then
showCursor ( true )
guiSetVisible ( wm . window , true )
triggerServerEvent ( "org:download" , resourceRoot , el )
end
end )
Prosze o szybk? pomoc!