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

Wysłany: 2021-01-16, 17:41


!ryzee

rebornMTA






Wiek: 19
Na forum: 2253 dni
Posty: 111
Nick w MP: drakovskyy

Piwa: 55

Respekt: 60

Siemka! Mam problem, i? zmappowa?em sobie przechowywalnie i przenios?em j? w skrypcie, wszystko git odbi?r pojazd?w dzia?a. Nie dzia?a mi Pozostawienie pojazd?w, nie wiem pewnie ?le cuboida ustawi?em.. Je?li trzeba dorzuc? te? po stronie servera.



Client:

Kod:

local dxfont0_f = dxCreateFont(":buttons/f.ttf", 18)
local screenW, screenH = guiGetScreenSize()
local sx, sy = guiGetScreenSize()
local w, h = (sx/1280),(sy/720)
local sx, sy = guiGetScreenSize ()

przecho = false

function mysz(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end

local vehiclesNames = {
["Hotring Racer"] = "Deluxo",
["Hotring Racer 3"] = "Mercedes Benz c63",
["Intruder"] = "Audi A4",
["Hotring Racer 2"] = "Nissan GTR",
["Buffalo"] = "Mustang",
}

function changeName(name)
local changedName = vehiclesNames[name]
if changedName then
return changedName
else
return name
end
end

przechowalnie = {
{{-1754.16, 961.66, 24.88},setElementData(createMarker(-1754.16, 961.66, 24.88-1, "cylinder", 1.2, 0,64,255, 50),"przecho:id",1),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle",createColCuboid(-1754.16, 963.66, 24.88-2, 8.66, 5.68, 5.18),{-2533.17, -23.48, 16.13, 359.7, 360.0, 88.8}},
{{1902.83, -1871.01, 13.55},setElementData(createMarker(1902.83, -1871.01, 13.55-1, "cylinder", 1.2, 0,64,255, 50),"przecho:id",2),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle",createColCuboid(1902.13, -1865.73, 12.57, 10.57, 5.25, 1.90),{1907.26, -1863.16, 13.29, 360.0, 360.0, 271.0}},
}

for i,p in pairs(przechowalnie) do
local t=createElement("text")
setElementData(t,"scale",1.0)
setElementData(t,"name",("(#007EFF%s#ffffff)\nOdbi?r pojazd?w"):format(p[4]))
setElementPosition(t,p[1][1],p[1][2],p[1][3])

end

ID_PRZECHO_DO_JAKIEJ_WLAZLES = nil
ID_222 = nil

gridlist_przecho = guiCreateGridList(129*w, 140*h, 684*w, 439*h, false)
guiSetAlpha(gridlist_przecho, 0.70)
guiGridListAddColumn(gridlist_przecho, "ID", 0.14)
guiGridListAddColumn(gridlist_przecho, "Model", 0.15)
guiGridListAddColumn(gridlist_przecho, "Przebieg(KM)", 0.15)
guiGridListAddColumn(gridlist_przecho, "Ostatni kierowca", 0.20)
guiGridListAddColumn(gridlist_przecho, "Pojemnosc", 0.14)
guiSetVisible(gridlist_przecho, false)
guiSetFont(gridlist_przecho, "default-bold-small")

local dxfont0_normal = "default"
local dxfont1_bold = "default-bold"

function GUI_Przechowalnia()
dxDrawRectangle(124*w, 135*h, 1032*w, 450*h, tocolor(61, 61, 61, 255), false)

if isMouseIn(837*w, 286*h, 319*w, 43*h) then
dxDrawImage(837*w, 286*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(0, 144, 255, 155), false)
else
dxDrawImage(837*w, 286*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(155,155,155, 155), false)
end

if getElementData(localPlayer, "player:organization") then
if isMouseIn(837*w, 334*h, 319*w, 43*h) then
dxDrawImage(837*w, 334*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(0, 144, 255, 155), false)
else
dxDrawImage(837*w, 334*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(155,155,155, 155), false)
end
end

dxDrawText("Prywatne", 900*w, 286*h, 1146*w, 329*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_normal, "right", "center", false, false, false, false, false)
if getElementData(localPlayer, "player:organization") then
dxDrawText("Organizacja - "..getElementData(localPlayer, "player:organization").."", 900*w, 334*h, 1146*w, 377*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_normal, "right", "center", false, false, false, false, false)
end
dxDrawText("Przechowalnia Pojazd?w", 823*w, 150*h, 1146*w, 192*h, tocolor(255, 255, 255, 255), 1.00, dxfont1_bold, "center", "center", false, false, false, false, false)
dxDrawText("Wybierz kategori?", 824*w, 194*h, 1146*w, 225*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_normal, "center", "top", false, false, false, false, false)

if isMouseIn(837*w, 484*h, 319*w, 43*h) then
dxDrawImage(837*w, 484*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(0, 144, 255, 155), false)
else
dxDrawImage(837*w, 484*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(155,155,155, 155), false)
end

if isMouseIn(837*w, 532*h, 319*w, 43*h) then
dxDrawImage(837*w, 532*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(0, 144, 255, 155), false)
else
dxDrawImage(837*w, 532*h, 319*w, 43*h, "btn.png", 0, 0, 0, tocolor(155,155,155, 155), false)
end

dxDrawText("Wybierz", 900*w, 484*h, 1146*w, 527*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_normal, "right", "center", false, false, false, false, false)
dxDrawText("Zamknij", 900*w, 532*h, 1146*w, 575*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_normal, "right", "center", false, false, false, false, false)
end

function getVehicleLicense(plr,type)
if getElementData(plr,"player:license:pj"..type.."") ~= 1 then
outputChatBox("✖ #FFFFFFNie posiadasz prawa jazdy kategorii "..type..", zdaj je w OSK", plr, 255, 0, 0, true)
return true
end
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_punish WHERE serial=? AND type=? AND active=1 AND time>NOW()", getPlayerSerial(plr), tostring(type))
if result and #result > 0 then
v=result[1]
outputChatBox("✔#FFFFFF Posiadasz zawieszone prawo jazdy do "..v.time.." za "..v.reason, plr, 0, 255, 0, true)
return true
else
exports["pystories-db"]:dbSet("DELETE FROM pystories_punish WHERE serial=? AND type=? AND active=1 AND time<NOW()", getPlayerSerial(plr), tostring(type))
return false
end
end

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end

addEvent("onParkingGetVehicles", true)
addEventHandler("onParkingGetVehicles", root, function(result, id)
guiGridListClear(gridlist_przecho)
if not result then return end
for i,v in pairs(result) do
local row=guiGridListAddRow(gridlist_przecho)
if przechowalnie[id][3][getVehicleType(v["model"])] then
kierowcaa = v["driver"]:gsub("#%x%x%x%x%x%x","")

if v["ownedGroup"] then
organizacja = v["ownedGroup"]
else
organizacja = "BRAK"
end

guiGridListSetItemText(gridlist_przecho, row, 1, v["id"], false, false)
guiGridListSetItemText(gridlist_przecho, row, 2, changeName(getVehicleNameFromModel(v["model"])), false, false)
guiGridListSetItemText(gridlist_przecho, row, 3, v["mileage"], false, false)
guiGridListSetItemText(gridlist_przecho, row, 4, kierowcaa, false, false)
guiGridListSetItemText(gridlist_przecho, row, 5, ""..v["silnik"].." dm3", false, false)
end
end
end)

addEventHandler("onClientMarkerHit", root, function(el,md)
local id = getElementData(source, "przecho:id")
if not id then return end
if el~=localPlayer then return end
if isPedInVehicle(el) then return end
if guiGetVisible(gridlist_przecho) == false then
if przecho == false then
przecho = true
showCursor(true)
showChat(false)
guiSetVisible(gridlist_przecho, true)
addEventHandler("onClientRender", root, GUI_Przechowalnia)
triggerServerEvent("onParkingGetRekords:priv", root, id)
ID_PRZECHO_DO_JAKIEJ_WLAZLES = id
ID_222 = id
end
end
end)

addEventHandler("onClientMarkerLeave", root, function(el,md)
local id = getElementData(source, "przecho:id")
if not id then return end
if el~=localPlayer then return end
if isPedInVehicle(el) then return end
if przecho == true then
showCursor(false)
showChat(true)
guiSetVisible(gridlist_przecho, false)
przecho = false
removeEventHandler("onClientRender", root, GUI_Przechowalnia)
end
end)

addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
if przecho == true then
if mysz(837*w, 532*h, 319*w, 43*h) then
if guiGetVisible(gridlist_przecho) == true then
showCursor(false)
showChat(true)
guiSetVisible(gridlist_przecho, false)
removeEventHandler("onClientRender", root, GUI_Przechowalnia)
przecho = false
setCameraTarget(localPlayer, localPlayer)
end
end
if przecho == true then
if mysz(837*w, 484*h, 319*w, 43*h) then
local selectedRow=guiGridListGetSelectedItem(gridlist_przecho) or -1
if selectedRow < 0 then return end
local vehicles=getElementsWithinColShape(przechowalnie[ID_PRZECHO_DO_JAKIEJ_WLAZLES][5],"vehicle")
if #vehicles > 0 then
return
end
local id=guiGridListGetItemText(gridlist_przecho, selectedRow, 1)
local register=guiGridListGetItemText(gridlist_przecho, selectedRow, 3)
if register == "NIE" then
return end
guiGridListRemoveRow(gridlist_przecho, selectedRow)
guiSetVisible(gridlist_przecho, false)
removeEventHandler("onClientRender", root, GUI_Przechowalnia)
showCursor(false)
showChat(true)
przecho = false
triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id), przechowalnie[ID_PRZECHO_DO_JAKIEJ_WLAZLES][6])
end
end
end
end
end)

addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
if przecho == true then
if mysz(837*w, 286*h, 319*w, 43*h) then
if guiGetVisible(gridlist_przecho) == true then
triggerServerEvent("onParkingGetRekords:priv", root, ID_PRZECHO_DO_JAKIEJ_WLAZLES)
end
elseif mysz(837*w, 334*h, 319*w, 43*h) then
if getElementData(localPlayer, "player:organization") then
if guiGetVisible(gridlist_przecho) == true then
triggerServerEvent("onParkingGetRekords:org", root, ID_PRZECHO_DO_JAKIEJ_WLAZLES)
end
end
end
end
end
end)



Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 2 piw(a):
fasolkajj123, Dem00n
Wysłany: 2021-01-16, 21:14


vFasteeQ







Wiek: 25
Na forum: 2342 dni
Posty: 4

Piwa: 1

Respekt: 50

Pobierz zasob "Cuboid" wgraj go, odpal i wpisz /showcol po czym /cuboid zrob tam gdzie chcesz oddawanie i zapisz go wyswietli sie w okienku wklej go tam gdzie masz kod: "createColCuboid(-1754.16, 963.66, 24.88-2, 8.66, 5.68, 5.18)," lub ten drugi cuboid od drugiego pozostawiania :)

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
!ryzee
Wysłany: 2021-01-17, 11:50


AmLotte.







Wiek: 21
Na forum: 2183 dni
Posty: 134
Nick w MP: AmLotte

Piwa: 443

Respekt: 50

W miejscu cuboidu wpisz kordynaty
Kod:

x,y,z, 5


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
!ryzee
Tagi: przechowywalnia
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