function getVehicleKey(plr,veh)
if plr and veh then
local uid=getElementData(plr,"user:uid")
if not uid then return end
if getElementData(plr,"user:duty") or uid == getElementData(veh,"veh:owner") then
return true
else
return false
end
end
end
local categoryL={[592] = true,[553] = true,[577] = true,[488] = true,[511] = true,[497] = true,[548] = true,[563] = true,[512] = true,[476] = true,[593] = true,[447] =
true,[425] = true,[519] = true,[520] = true,[460] = true,[417] = true,[469] = true,[487] = true,[513] = true}
addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
if getElementHealth(source) < 302 then
setElementHealth(source,302)
end
end)
function jestwtabeli(***,truj)
for k,v in pairs(***) do
if v == truj then
return true
end
end
return false
end
addCommandHandler("vdodaj",function(plr,cmd,target)
local veh = getPedOccupiedVehicle(plr)
if not veh then outputChatBox("* Nie siedzisz w aucie!",plr,255,0,0) return end
if getElementData(veh,"veh:owner") ~= getElementData(plr,"user:uid") then outputChatBox("* Ten pojazd nie nalezy od ciebie!",plr,255,0,0) return end
if not target then
outputChatBox("* Zabrano dostep wszystkim gracz?!",plr,255,0,0)
setElementData(veh,"veh:owner",0)
else
local target=findPlayer(plr, target)
if not target then
outputChatBox("* Nie znaleziono gracza online!",plr,255,0,0)
return
end
local rent = getElementData(veh,"veh:uid")
if (type(rent) ~= "table") then
local tabelka = {}
table.insert(tabelka,getElementData(target,"user:uid"))
setElementData(veh,"veh:uid",tabelka)
outputChatBox(string.format("* Dodano gracza "..getPlayerName(target).."(UID: "..getElementData(target,"user:uid")..") do wypo?ycze?"),plr)
else
local tabelka = rent
if jestwtabeli(tabelka,getElementData(target,"user:uid")) then outputChatBox("* Ten gracz aktualnie posiada kluczyki do twojego pojazdu!",plr) return end
if #tabelka > 2 then outputChatBox("* Mo?esz wypo?yczy? maksymalnie 2 gracz?!",plr) return end
table.insert(tabelka,getElementData(target,"veh:uid"))
setElementData(veh,"veh:uid",tabelka)
outputChatBox(string.format("* Dodano gracza "..getPlayerName(target).."(UID: "..getElementData(target,"user:uid")..") do wypo?ycze?"),plr)
end
end
end)