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

Wysłany: 2022-01-16, 21:12


Blatpek







Wiek: 26
Na forum: 1948 dni
Posty: 18
Nick w MP: Blatpek

Piwa: 4

Respekt: 50

https://imgur.com/a/8y2NmtO taki blad w db 3
kod:
Kod:


pojazdy_dozwolone = {

[567] = true,
[575] = true,
[483] = true,
[534] = true,

}

addEvent("onVehicleTuningMontage", true)
addEventHandler("onVehicleTuningMontage", root, function(plr,veh,czesc,kwota,data)
if getElementData(veh, "vehicle:ownedPlayer") ~= getElementData(plr, "player:sid") then exports.nrpg_interface:showPlayerNotification(plr, "To nie jest tw?j pojazd!", "error", 15000) return end
montuj(plr,veh,czesc,kwota,data)
end)


function montuj(plr,veh,czesc,cena,data)
local id = getElementData(veh, "vehicle:id")
if not id then return end
if getElementData(veh, "vehicle:ownedPlayer") ~= getElementData(plr, "player:sid") then exports.nrpg_interface:showPlayerNotification(plr, "To nie jest tw?j pojazd!", "error", 15000) return end
local result = exports["pystories-db"]:dbSet("SELECT * FROM pystories_vehicles WHERE id=?", id)
if czesc == "MK1" then
if result[1].mk1 ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET mk1=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano MK1. Pobrano "..cena.." PLN", "success")
respawn(plr)
end

elseif czesc == "MK2" then
if result[1].mk2 ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET mk2=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano MK2. Pobrano "..cena.." PLN", "success")
respawn(plr)
end

elseif czesc == "RH" then
if result[1].rh ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET rh=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano RH. Pobrano "..cena.." PLN", "success")
setElementData(veh, "vehicle:rh", true)
end

elseif czesc == "Neony" then
if result[1].neon ~= 0 then
exorts.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET neon=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano Neony. Pobrano "..cena.." PLN", "success")
setElementData(veh, "vehicle:neon", 1)
end

elseif czesc == "Butla LPG" then
if result[1].lpg ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET lpg=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano Instalacj? LPG . Pobrano "..cena.." PLN", "success")
setElementData(veh, "vehicle:lpg", 1)
setElementData(veh, "vehicle:fuellpg", 100)
end

elseif czesc == "Wspomaganie zap?onu" then
if result[1].zaplon ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET zaplon=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano Wspomaganie zap?onu. Pobrano "..cena.." PLN", "success")
setElementData(veh, "vehicle:wspomaganieZaplonu", 1)
end

elseif czesc == "Szerokie opony" then
if result[1].opony ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET opony=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano Szerokie opony. Pobrano "..cena.." PLN", "success")
setVehicleHandling(veh, "handlingFlags", 0x8000)
respawn(plr)
end

elseif czesc == "Zmienny nap?d" then
if result[1].naped ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET naped=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano Zmienny Nap?d. Pobrano "..cena.." PLN", "success")
setElementData(veh, "vehicle:chgDrive", true)
end

elseif czesc == "ChipTuning" then
if result[1].chip ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET chip=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano ChipTuning. Pobrano "..cena.." PLN", "success")
respawn(plr)
end

elseif czesc == "Turbo" then
if result[1].turbo ~= 0 then
exports.nrpg_interface:showPlayerNotification(plr, "Posiadasz to ulepszenie", "error")
else
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET turbo=? WHERE id=?", 1, id)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Zamontowano Turbo. Pobrano "..cena.." PLN", "success")
respawn(plr)
end

elseif czesc == "Cofanie przebiegu" then
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET mileage=? WHERE id=?", 0, id)
setElementData(veh, "vehicle:mileage", 0)
takePlayerMoney(plr, cena)
exports.nrpg_interface:showPlayerNotification(plr, "Przebieg zosta? cofni?ty. Pobrano "..cena.." PLN", "success")
end
end


addEvent("tuningCapacity", true)
addEventHandler("tuningCapacity", getRootElement(), function()
local money = getPlayerMoney(source)
local vehicle = getPedOccupiedVehicle(source)
local cost = 35000
if getElementData(vehicle, "vehicle:ownedPlayer") == getElementData(client, "player:sid") then
local id = getElementData(vehicle, "vehicle:id")
if not id then exports.nrpg_interface:showPlayerNotification(client, "To nie jest pojazd prywatny!", "error", 15000) return end
if getElementData(vehicle, "Pojemnosc:silnika") == "1.4" then
setElementData(vehicle, "Pojemnosc:silnika", "1.6")
cancelEvent()
elseif getElementData(vehicle, "Pojemnosc:silnika") == "1.6" then
setElementData(vehicle, "Pojemnosc:silnika", "1.8")
cancelEvent()
elseif getElementData(vehicle, "Pojemnosc:silnika") == "1.8" then
setElementData(vehicle, "Pojemnosc:silnika", "2.0")
cancelEvent()
elseif getElementData(vehicle, "Pojemnosc:silnika") == "2.0" then
setElementData(vehicle, "Pojemnosc:silnika", "2.2")
cancelEvent()
elseif getElementData(vehicle, "Pojemnosc:silnika") == "2.2" then
if getElementData(vehicle, "vehicle:sport") == 1 then
setElementData(vehicle, "Pojemnosc:silnika", "2.4")
else
exports.nrpg_interface:showPlayerNotification(client, "Posiadasz maksymaln? pojemno?? silnika!", "error", 15000)
cancelEvent()
return
end
elseif getElementData(vehicle, "Pojemnosc:silnika") == "2.4" then
exports.nrpg_interface:showPlayerNotification(client, "Posiadasz maksymaln? pojemno?? silnika!", "error", 15000)
cancelEvent()
return end
exports.nrpg_interface:showPlayerNotification(client, "Pomy?lnie ulepszono silnik do pojemno?ci "..getElementData(vehicle, "Pojemnosc:silnika").." dm3", "success", 15000)
exports["pystories-vehicles"]:onSaveVehicle(vehicle)
takePlayerMoney(source, cost)
else
exports.nrpg_interface:showPlayerNotification(client, "To nie jest tw?j pojazd!", "error", 15000)
end
end)


function respawn(plr)
exports.nrpg_interface:showPlayerNotification(plr, "Aby zobaczy? zmiany schowaj pojazd do przechowalni", "info")
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-17, 15:58


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

115 linijka zwraca nil/false/brak zmiennej

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-18, 15:29


Blatpek







Wiek: 26
Na forum: 1948 dni
Posty: 18
Nick w MP: Blatpek

Piwa: 4

Respekt: 50

"kamison" napisał/a:

115 linijka zwraca nil/false/brak zmiennej


no dobra, ale to wyskakuje jak klikam zamontuj mk1 inna linijka mk2 inna itd , ulepszenie sie nei montuje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-18, 16:14


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

Zobacz czy na pewno masz po??czenie z baz? danych

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-18, 18:38


Blatpek







Wiek: 26
Na forum: 1948 dni
Posty: 18
Nick w MP: Blatpek

Piwa: 4

Respekt: 50

"kamison" napisał/a:

Zobacz czy na pewno masz po??czenie z baz? danych

Mam po??czenie zresetowa?em nawet wszystkie skrypty db

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-18, 20:14


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

Jak wygl?da struktura w bazie? Jest tam jaki? rekord?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-18, 20:36


Blatpek







Wiek: 26
Na forum: 1948 dni
Posty: 18
Nick w MP: Blatpek

Piwa: 4

Respekt: 50

"kamison" napisał/a:

Jak wygl?da struktura w bazie? Jest tam jaki? rekord?

jaki rekord?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-19, 15:45


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-19, 18:02


Blatpek







Wiek: 26
Na forum: 1948 dni
Posty: 18
Nick w MP: Blatpek

Piwa: 4

Respekt: 50

"kamison" napisał/a:

https://www.google.com/search?q=rekord+baza+danych&oq=rekord+baza+&aqs=chrome.0.0i512j69i57j0i512l2j0i22i30l3.2415j0j7&sourceid=chrome&ie=UTF-8

https://imgur.com/a/q864cLw masz tam

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-19, 19:34


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

No struktura jest ALE CZY JEST WPISANE TAM DLA KA?DEGO GRACZA TUNING? Zr?b ss tego i poka?


Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-19, 19:48


Blatpek







Wiek: 26
Na forum: 1948 dni
Posty: 18
Nick w MP: Blatpek

Piwa: 4

Respekt: 50

"kamison" napisał/a:

No struktura jest ALE CZY JEST WPISANE TAM DLA KA?DEGO GRACZA TUNING? Zr?b ss tego i poka?
Obrazek


https://imgur.com/a/pyjKnxA o to chodzi?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-20, 07:13


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

Zmie? to:
Kod:

local result = exports["pystories-db"]:dbSet("SELECT * FROM pystories_vehicles WHERE id=?", id)


na

Kod:

local result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE id=?", id)


[ Dodano: 2022-01-20, 07:14 ]
W 6 linijce od funkcji "montuj"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-01-20, 10:06


Blatpek







Wiek: 26
Na forum: 1948 dni
Posty: 18
Nick w MP: Blatpek

Piwa: 4

Respekt: 50

"kamison" napisał/a:

Zmie? to:
Kod:

local result = exports["pystories-db"]:dbSet("SELECT * FROM pystories_vehicles WHERE id=?", id)


na

Kod:

local result = exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE id=?", id)


[ Dodano: 2022-01-20, 07:14 ]
W 6 linijce od funkcji "montuj"

Dzia?a dzi?ki ziom

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: moge :: zamontowac :: tuningu
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