Marcinos651
Wiek: 28 Na forum: 4480 dni Posty: 18
Nick w MP: Marcin651
Siemka podepnie mi ktos przechowalnie pod skrypt pana prezesa daje piwko!
Ja juz probowalem i stwierdzilem ze nie dam rady. Jesli ktos to podepnie to jest naprawte kozakiem
S
-- 2877.96 ,- 1820.72 , 11.16 , 13.2
-- 2870.71 ,- 1814.30 , 12.06 , 40.5
local cs_wydawanie = createColCuboid ( 2870.7 ,- 1820.3 , 10 , 7.2 , 6 , 3 )
local function pojazdNaParkingu ( vid )
local query = string . format ( "SELECT 1 FROM lss_vehicles WHERE id=%d AND przechowalnia=1" , vid )
local wynik = exports . DB : pobierzWyniki ( query )
return ( wynik and true or false )
end
local function czyStrefaWydawaniaWolna ()
local p = getElementsWithinColShape ( cs_wydawanie , "vehicle" )
for i , v in ipairs ( p ) do
setElementFrozen ( v , false )
end
if #p>0 then return false end
return true
end
-- triggerServerEvent ( "doOdbiorPojazdu" , resourceRoot , localPlayer , kid )
addEvent ( "doOdbiorPojazdu" , true )
addEventHandler ( "doOdbiorPojazdu" , resourceRoot , function( plr , vid )
if not vid or not tonumber ( vid ) then
outputChatBox ( "* Na wy?wietlaczu urz?dzenia pojawia si? napis ERROR" , plr )
return
end
if not pojazdNaParkingu ( vid ) then
outputChatBox ( "* Na wy?wietlaczu pojawia si? informacja: tego pojazdu nie ma na parkingu." , plr )
return
end
if not czyStrefaWydawaniaWolna () then
outputChatBox ( "* Na wy?wietlaczu pojawia si? informacja: brak miejsca przed bram?. Nie mo?na wyda? pojazdu." , plr )
return
end
takePlayerMoney ( plr , 500 )
-- no to jedziemy z koksem !
local query = string . format ( "UPDATE lss_vehicles SET przechowalnia=0,frozen=0,loc='2874.10,-1817.74,13.08',rot='0,0,90' WHERE id=%d LIMIT 1" , vid )
exports . DB : zapytanie ( query )
exports [ "lss-vehicles" ]: veh_load ( tonumber ( vid ))
outputChatBox ( "* Na wy?wietlaczu pojawia si? napis: pojazd wydany!" , plr )
triggerClientEvent ( plr , "doHideWindows" , resourceRoot )
end )
local function czyGraczMozeZostawicPojazd ( plr , vid , veh )
-- 1 nie przyjmujemy pojazdow frakcyjnych
if ( getElementData ( veh , "owning_faction" )) then
return false
end
-- 2 policja / sm moze oddac kazdy pojazd
local fid = getElementData ( plr , "faction:id" )
if fid then
if tonumber ( fid )== 2 or tonumber ( fid )== 4 then
return true
end
end
-- 3. tylko wlasciciel moze oddac pojazd
local c = getElementData ( plr , "character" )
if not c then return false end
local cid = tonumber ( c . id )
if not cid then return false end
local query = string . format ( "SELECT 1 FROM lss_vehicles WHERE id=%d AND owning_player=%d" , vid , cid )
local wynik = exports . DB : pobierzWyniki ( query )
if wynik then return true else return false end
end
local function znajdzPojazd ( id )
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
local dbid = getElementData ( v , "dbid" )
if dbid and tonumber ( dbid )== tonumber ( id ) then
return v
end
end
return nil
end
-- triggerServerEvent ( "doZostawieniePojazdu" , resourceRoot , localPlayer , kid )
addEvent ( "doZostawieniePojazdu" , true )
addEventHandler ( "doZostawieniePojazdu" , resourceRoot , function( plr , vid )
vid = tonumber ( vid )
local veh = znajdzPojazd ( vid )
if not veh then
outputChatBox ( "* Na wy?wietlaczu pojawia si? napis: ERROR." , plr )
return
end
if not czyGraczMozeZostawicPojazd ( plr , vid , veh ) then
outputChatBox ( "* Na wy?wietlaczu pojawia si? napis: pojazd moze oddac tylko wlasciciel lub sm/policja" , plr )
return
end
-- zostawiamy
destroyElement ( veh )
local query = string . format ( "UPDATE lss_vehicles SET przechowalnia=1 WHERE id=%d" , vid )
exports . DB : zapytanie ( query )
outputChatBox ( "* Na wy?wietlaczu pojawia si? napis: pojazd zosta? przyj?ty." , plr )
triggerClientEvent ( plr , "doHideWindows" , resourceRoot )
end )
C
-- inne punkty
-- - 1981.51 , 466.79 , 28.98 , 359.1 sf
local cs_automat = createColSphere (- 1949.9822998047 , 1000.6187744141 , 35.175628662109 )
local m = createMarker (- 1949.9822998047 , 1000.6187744141 , 35.175628662109 , "cylinder" , 1 )
local w1 ={}
w1 . win = guiCreateWindow ( 0.7412 , 0.34 , 0.2313 , 0.4133 , "Przechowalnia pojazd?w" , true )
-- w1 . btn_zostaw = guiCreateButton ( 0.0541 , 0.1371 , 0.8919 , 0.379 , "Zostaw pojazd" , true , w1 . win )
w1 . btn_odbierz = guiCreateButton ( 0.0541 , 0.5565 , 0.8919 , 0.379 , "Odbierz pojazd" , true , w1 . win )
guiSetVisible ( w1 . win , false )
local wo ={}
wo . win = guiCreateWindow ( 0.7531 , 0.3479 , 0.2109 , 0.3792 , "Odbi?r auta" , true )
wo . lbl = guiCreateLabel ( 0.037 , 0.1209 , 0.9185 , 0.1352 , "Wska? klucz do pojazdu, kt?ry chcesz odebra?" , true , wo . win )
wo . cmb = guiCreateComboBox ( 0.037 , 0.3 , 0.9185 , 0.6352 , "Klucz" , true , wo . win )
wo . btn = guiCreateButton ( 0.037 , 0.6 , 0.9185 , 0.3 , "Odbierz" , true , wo . win )
guiLabelSetHorizontalAlign ( wo . lbl , "center" , true )
guiSetFont ( wo . lbl , "default-small" )
guiSetVisible ( wo . win , false )
addEventHandler ( "onClientColShapeHit" , cs_automat , function( he , md )
if not md then return end
if he ~= localPlayer then return end
guiSetVisible ( w1 . win , true )
guiSetVisible ( wo . win , false )
showCursor ( true , false )
end )
addEventHandler ( "onClientColShapeLeave" , cs_automat , function( he , md )
if he ~= localPlayer then return end
guiSetVisible ( w1 . win , false )
guiSetVisible ( wo . win , false )
showCursor ( false )
end )
local function pojazdyWStrefieZostawiania ()
local pojazdy = getElementsWithinColShape ( cs_zostawianie , "vehicle" )
local pojazdy2 ={}
for i , v in ipairs ( pojazdy ) do
if ( getElementData ( v , "dbid" ) and not getVehicleController ( v )) then
table . insert ( pojazdy2 , v )
end
end
return pojazdy2
end
-- ODBIERANIE
addEventHandler ( "onClientGUIClick" , w1 . btn_odbierz , function()
-- if ( getPlayerName ( localPlayer )~= "Bob_Euler" ) then
-- outputChatBox ( "* Na wy?wietlaczu automatu pojawia si? migocz?cy napis 'ERROR'." )
-- guiSetVisible ( w1 . win , false )
-- return
-- end
guiSetVisible ( w1 . win , false )
guiSetVisible ( wo . win , true )
guiComboBoxClear ( wo . cmb )
triggerServerEvent ( "fetchStoredVehicles" , resourceRoot )
end , false )
-- triggerClientEvent ( client , "fillStoredVehicles" , resourceRoot , pojazdy )
addEvent ( "fillStoredVehicles" , true )
addEventHandler ( "fillStoredVehicles" , resourceRoot , function( pojazdy )
guiComboBoxClear ( wo . cmb )
for i , v in ipairs ( pojazdy ) do
-- outputDebugString ( v . id )
guiComboBoxAddItem ( wo . cmb , string . format ( "%d %s%s" , v . id , v . gangowe and "gangowe " or "" , getVehicleNameFromModel ( v . model ) ))
end
end )
addEventHandler ( "onClientGUIClick" , wo . btn , function()
local i = guiComboBoxGetSelected ( wo . cmb )
if not i then return end
local kid = tonumber ( string . match ( guiComboBoxGetItemText ( wo . cmb , i ), "^%d+" ))
triggerServerEvent ( "doOdbiorPojazdu" , resourceRoot , localPlayer , kid )
end )
--
-- triggerClientEvent ( plr , "doHideWindows" , resourceRoot )
addEvent ( "doHideWindows" , true )
addEventHandler ( "doHideWindows" , resourceRoot , function()
guiSetVisible ( w1 . win , false )
guiSetVisible ( wo . win , false )
end )
Skrypt pana prezesa- http://gtao.pl/%3Cfont-co...-sq-vt95613.htm