Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2021-08-15, 17:15


GiorgioUlani

JesteśNoobem






Wiek: 26
Na forum: 2037 dni
Posty: 26
Nick w MP: ANONIM

Piwa: 6

Respekt: 50

Witam mam Pytanie czy da?o by sie zablokowa? mo?liwo?? Wy?wietlania/wyci?gania pojazd?w lotniczych z Przechowywalni z nitroRPG?

s.lua
Kod:

local strefa = createColCuboid(-2538.10, -25.98, 15.43, 9.66, 4.59, 7.44)
setElementData(strefa, "blockStrefa", false)

theTimer = setTimer( function()
setElementData(strefa, "blockStrefa", false)
end, 15000, 0)

local blip = createBlip(-2534.78, -27.87, 16.44, 35,2,0,0,0,0,0,250)


local categoryA={[463] = true,[462] = true,[461] = true,[581] = true,[448] = true,[468] = true,[471] = true,[521] = true,[522] = true,[523] = true}

local categoryB={[602] = true,[545] = true,[496] = true,[517] = true,[585] = true,[410] = true,[518] = true,[600] = true,[506] = true,[436] = true,[589] = true,[580] = true,[419] = true,[506] = true,[533] = true,[549] = true,[526] = true,[491] = true,[474] = true,[445] = true,[467] = true,[604] = true,[426] = true,[507] = true,[547] = true,[585] = true,[405] = true,[587] = true,[409] = true,[466] = true,[550] = true,[492] = true,[566] = true,[546] = true,[540] = true,[551] = true,[421] = true,[516] = true,[529] = true,[488] = true,[460] = true,
[469] = true,[487] = true,[510] = true,[509] = true,[481] = true,[586] = true,[472] = true,[473] = true,[493] = true,[595] = true,[484] = true,[430] = true,[453] = true,[452] = true,[446] = true,[454] = true,[485] = true,[552] = true,
[438] = true,[574] = true,[420] = true,[525] = true,[408] = true,[596] = true,[597] = true,[427] = true,[599] = true,[490] = true,[432] = true,[528] = true,[601] = true,[407] = true,[544] = true,[470] = true,[598] = true,[588] = true,
[532] = true,[443] = true,[486] = true,[531] = true,[543] = true,[422] = true,[583] = true,[478] = true,[605] = true,[554] = true,[530] = true,[418] = true,[572] = true,[582] = true,[536] = true,[575] = true,[534] = true,
[567] = true,[535] = true,[576] = true,[412] = true,[402] = true,[542] = true,[603] = true,[475] = true,[449] = true,[537] = true,[570] = true,[441] = true,[464] = true,[501] = true,[465] = true,[564] = true,[568] = true,[557] = true,[424] = true,[504] = true,[495] = true,[457] = true,[539] = true,[483] = true,[571] = true,[500] = true,
[444] = true,[556] = true,[429] = true,[411] = true,[541] = true,[559] = true,[415] = true,[561] = true,[480] = true,[560] = true,[562] = true,[506] = true,[565] = true,[451] = true,[434] = true,[558] = true,[494] = true,[535] = true,[502] = true,[477] = true,[503] = true,[579] = true,[400] = true,[404] = true,[489] = true,[505] = true,[479] = true,[442] = true,[458] = true,
[606] = true,[607] = true,[610] = true,[590] = true,[569] = true,[611] = true,[584] = true,[608] = true,[435] = true,[450] = true,[591] = true,[594] = true}

local categoryC={[403] = true,[406] = true,[413] = true,[414] = true,[416] = true,[423] = true,[428] = true,[431] = true,[433] = true,[437] = true,[440] = true,[455] = true,[456] = true,[459] = true,[482] = true,[498] = true,[499] = true,[508] = true,[514] = true,[515] = true,[524] = true,[538] = true,[573] = true}



addEvent("showParkVehicles", true)
addEventHandler("showParkVehicles", root, function(type)
local sid = getElementData(client, "player:sid")
local org = getElementData(client, "player:organization") or "----------------------------------------------------------------------"

if type == "org" then
result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (ownedGroup=?) AND parking=1 AND police=0", org)
if #result > 0 then
triggerClientEvent(client, "showVehiclesGUI", root, result)
end
elseif type == "priv" then
result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (ownedPlayer=?) AND parking=1 AND police=0", sid)
if #result > 0 then
triggerClientEvent(client, "showVehiclesGUI", root, result)
end
elseif type == "rent" then
result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (rent=?) AND parking=1 AND police=0", sid)
if #result > 0 then
triggerClientEvent(client, "showVehiclesGUI", root, result)
end
elseif type == "all" then
if org then
result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (ownedGroup=? or ownedPlayer=? or rent=?) AND parking=1 AND police=0", org, sid, sid)
if #result > 0 then
triggerClientEvent(client, "showVehiclesGUI", root, result)
end
else
result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (ownedPlayer=?) AND parking=1 AND police=0", sid)
if #result > 0 then
triggerClientEvent(client, "showVehiclesGUI", root, result)
end
end
else
result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (ownedPlayer=?) AND parking=1 AND police=0", sid)
if #result > 0 then
triggerClientEvent(client, "showVehiclesGUI", root, result)
end
end
end)


addEvent("getVehicleFromPark", true)
addEventHandler("getVehicleFromPark", root, function(plr, id, miejsce)
if not id then return end
if not miejsce then return end

remaining, executesRemaining, totalExecutes = getTimerDetails(theTimer)
if getElementData(strefa, "blockStrefa") == true then exports.nrpg_interface:showPlayerNotification(plr, "Pojazd mo?esz wyj?? za "..math.floor(remaining/1000).." sek.", "error") return end
vehicleInfo = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE id=?", id)

if categoryA[vehicleInfo[1].model] then
if exports["pystories-ustawienia-praca"]:getVehicleLicense(plr,"A") then
return
end
elseif categoryB[vehicleInfo[1].model] then
if exports["pystories-ustawienia-praca"]:getVehicleLicense(plr,"B") then
return
end
elseif categoryC[vehicleInfo[1].model] then
if exports["pystories-ustawienia-praca"]:getVehicleLicense(plr,"C") then
return
end
end

local vehicles_get = getElementsWithinColShape(strefa, "vehicle")
if #vehicles_get > 0 then
for i,v in ipairs(vehicles_get) do
if getVehicleController(v) then
exports["pystories-vehicles"]:onSaveVehicle(v, getVehicleController(v))
else
exports["pystories-vehicles"]:onSaveVehicle(v, plr)
end

local query = exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1, tp_to_parking=? WHERE id=?", "Przechowalnia", getElementData(v, "vehicle:id"))
if query then
destroyElement(v)
setElementData(strefa, "blockStrefa", true)
end
end
end

local spawn = exports["pystories-vehicles"]:onRespawnVehicles(_, id, miejsce)
exports.nrpg_interface:showPlayerNotification(plr, "Pomy?lnie wyjmujesz pojazd ID "..id.." z przechowalni", "success")

local car = findCar(plr, id)
if car then
setTimer( function()
warpPedIntoVehicle(plr, car)
setVehicleEngineState(car, true)
end, 100, 1)
end
end)


addEvent("parkVehicle", true)
addEventHandler("parkVehicle", root, function(plr)
local veh = getPedOccupiedVehicle(plr)

if veh then
local id = getElementData(veh, "vehicle:id")
if not id then return end

exports["pystories-vehicles"]:onSaveVehicle(veh)
local query = exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1, tp_to_parking=?, driver=? WHERE id=?", "Przechowalnia", getPlayerName(plr), id)

if query then
destroyElement(veh)
exports.nrpg_interface:showPlayerNotification(plr, "Pojazd zosta? przeniesiony do przechowalni", "success")


triggerClientEvent(plr, "wylaczlatanie", root)
triggerClientEvent(plr, "wylaczplywanie", root)
end
end
end)


function findCar(player, toCar)
for i,v in ipairs(getElementsByType("vehicle")) do
if tonumber(toCar) then
if getElementData(v, "vehicle:id") == tonumber(toCar) then
return v
end
end
end
end



Dam piweczko za pomoc bo my?la?em nad zastosowaniem If ale nwm jak sie za to zabra?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-15, 22:06


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
U?yj if i sprawdz funkcj?
Więcej informacji znajdziesz w Wikipedii MTA:

getVehicleType
czy to Automobile,Boat,Plane itp

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-16, 00:14


GiorgioUlani

JesteśNoobem






Wiek: 26
Na forum: 2037 dni
Posty: 26
Nick w MP: ANONIM

Piwa: 6

Respekt: 50

"Matikmontana" napisał/a:

U?yj if i sprawdz funkcj?
Więcej informacji znajdziesz w Wikipedii MTA:

getVehicleType
czy to Automobile,Boat,Plane itp


W?asnie chcia?em u?y? if ale nie wiem jak si? za to zabra? mimo i? poda?e? mi stronke a jest to dosy? wa?ne

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-16, 14:05


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Dodaj to po stronie clienta do listy gdzie s? auta...
tu masz przyk?ad

for i,v in pairs(result) do
       if getVehicleType(v.model] == "Automobile" then 
            ...
       end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-16, 18:25


GiorgioUlani

JesteśNoobem






Wiek: 26
Na forum: 2037 dni
Posty: 26
Nick w MP: ANONIM

Piwa: 6

Respekt: 50

"Matikmontana" napisał/a:

Dodaj to po stronie clienta do listy gdzie s? auta...
tu masz przyk?ad

for i,v in pairs(result) do
       if getVehicleType(v.model] == "Automobile" then 
            ...
       end
end



Dopisa?em co c.lua

https://imgur.com/BxtJ4bG b??d kt?ry wyskakuje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-17, 14:31


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Oj wkrad?a si? liter?wka zamie? ] na )

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-17, 19:25


_jvneczek







Wiek: 22
Na forum: 4326 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5


for i,v in pairs(result) do
       if getVehicleType(v.model) == "Automobile" then 
       end
end



Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-18, 10:46


GiorgioUlani

JesteśNoobem






Wiek: 26
Na forum: 2037 dni
Posty: 26
Nick w MP: ANONIM

Piwa: 6

Respekt: 50

"Matikmontana" napisał/a:

Oj wkrad?a si? liter?wka zamie? ] na )


Nadal pokazuje Helki i da sie je wyci?gn?? :c

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-19, 15:34


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Poka? cze?? kodu od tego

Postaw piwo autorowi tego posta
 

 
Tagi: przechowywalnia :: nitrorpg
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku