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

Wysłany: 2021-01-28, 15:57


GiorgioUlani

JesteśNoobem






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

Piwa: 6

Respekt: 50

Witam mam problem poniewa? po zamontowaniu neon?w one nie zapisuj? sie one w pojezdzie

kod
c.lua


Kod:

local marker = createMarker(-2115.63, -23.55, 35.32, "cylinder", 2)
local pileczka=createElement("text")
setElementData(pileczka,"name", "Testowe Neony")
setElementPosition(pileczka,-2115.63, -23.55, 35.32)
screen = Vector2(guiGetScreenSize())

function scale_x(value)
if not value then return nil end

return (value / 1920) * screen['x']
end

function scale_y(value)
if not value then return nil end

return (value / 1080) * screen['y']
end

local font = dxCreateFont("font.ttf", scale_x(15))

local k = 1
local n = 5
local m = 5

local okno = false

local neon = {
{5000000, 255, 0, 0}, -- czerwone
{5000000, 0, 255, 0}, -- zielone
{5000000, 0, 0, 255}, -- niebieskie
{5000000, 0, 255, 255}, -- b??kitne
{5000000, 255, 255, 255}, -- bia?e
{5000000, 255, 0, 255}, -- niebieskie
{5000000, 255, 255, 0}, -- niebieskie
}

function gui()
dxDrawImage(scale_x(757), scale_y(328), scale_x(407), scale_y(424), ":pystories-sklepkas/shop_casino.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
shadowText("Monta? neon?w", scale_x(757), scale_y(328), scale_x(1164), scale_y(385), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
local x = 0
for i, v in ipairs(neon) do
if i >= k and i <= n then
x = x+1
local addY = (scale_y(58))*(x-1)
dxDrawImage(scale_x(767), scale_y(395)+addY, scale_x(387), scale_y(56), ":pystories-montaz-liczniki/images/button.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
shadowText(v[1].."$", scale_x(900), scale_y(395)+(addY*2), scale_x(1092), scale_y(451), tocolor(255, 255, 255, 255), 1.00, font, "left", "center", false, false, false, false, false)
dxDrawRectangle(scale_x(777), scale_y(401)+addY, scale_x(94), scale_y(44), tocolor(v[2], v[3], v[4], 255), false)
end
end
shadowText("Kliknij na pasek aby zamontowa? neon", 757, 708, 1164, 746, tocolor(255, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
end

addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" and okno == true then
local x = 0
for i, v in ipairs(neon) do
if i >= k and i <= n then
x = x+1
local addY = (scale_y(58))*(x-1)
if isMouseIn(scale_x(767), scale_y(395)+addY, scale_x(387), scale_y(56)) then
if getPlayerMoney(localPlayer) > v[1] then
triggerServerEvent("zamontujNeon", localPlayer, v[1], getElementData(getPedOccupiedVehicle(localPlayer), "vehicle:id"), v[2]..","..v[3]..","..v[4])
setElementData(getPedOccupiedVehicle(localPlayer), "neon", v[2]..","..v[3]..","..v[4])
else
outputChatBox("Nie masz tyle pieni?dzy", 255, 0, 0)
end
end
end
end
end
end)


bindKey("mouse_wheel_down", "both", function()
if okno ~= true then return end
scrollUp()
end)

bindKey("mouse_wheel_up", "both", function()
if okno ~= true then return end
scrollDown()
end)


function scrollDown()
if n == m then return end
k = k-1
n = n-1
end

function scrollUp()
if n >= #neon then return end
k = k+1
n = n+1
end


addEventHandler("onClientMarkerHit", marker, function(gracz)
if localPlayer ~= gracz then return end
if not getPedOccupiedVehicle(localPlayer) then return end
--if not getPlayerOccupiedVehicle(localPlayer) ~= 0 then return end
if not getElementData(getPedOccupiedVehicle(localPlayer), "vehicle:id") then return end
showCursor(true, false)
okno = true
addEventHandler("onClientRender", root, gui)
end)

addEventHandler("onClientMarkerLeave", marker, function(gracz)
if gracz ~= localPlayer then return end
if okno == false then return end
showCursor(false)
okno = false
removeEventHandler("onClientRender", root, gui)
end)

function shadowText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
dxDrawText(text,x+1,y+1,w+1,h+1,tocolor(0,0,0),size,font,xx,yy,x1,x2,x3,x4,x5)
dxDrawText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
end

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*screen["x"],cy*screen["y"]
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end

function przecinkiAdd(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end



s.lua




Kod:

addEvent("zamontujNeon", true)
addEventHandler("zamontujNeon", root, function(ilosc, id, rgb)
takePlayerMoney(client, ilosc)
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET neon=? WHERE id=?", rgb, id)
triggerClientEvent(client, "onClientAddNotification", client, "Pomy?lnie zamontowano Neon", "success")
takePlayerMoney(source, cena)
else
triggerClientEvent(client, "onClientAddNotification", client, "To nie jest tw?j pojazd!", "warning")
end
end)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-28, 17:20


Matikmontana

Modern Stories






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

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
B??dy db? Nie zapisuje si? do bazy danych tak ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-28, 17:29


GiorgioUlani

JesteśNoobem






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

Piwa: 6

Respekt: 50

"Matikmontana" napisał/a:

B??dy db? Nie zapisuje si? do bazy danych tak ?


Po kupieniu ich dzia?aj? ale jak sie schowa do przecho to znikaj? z auta (

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-29, 10:29


Matikmontana

Modern Stories






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

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Masz zrobiony zapis oraz wczytywanie przy respie tych neon?w

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-30, 19:48


_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

Nic dziwnego ?e znikaj?, zapewne nie masz zapisu albo masz zapis a brak wczytywania.

Postaw piwo autorowi tego posta
 

 
Tagi: neony
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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