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

Wysłany: 2021-05-07, 13:05


popek12







Wiek: 23
Na forum: 3441 dni
Posty: 5
Nick w MP: popek12



Respekt: 50

Witam wszystkich pom?g?by kto? z kodem, jak przerobi? ten kody aby pobiera?o z konta pieni?dz? po sprzeda?y, i dawa?o do bankomatu. Prosze o pomoc, b?d? wdzi?czny kod :



Kod:

local LIMIT=3 -- tylko gracz mo?e kupi? trzy pojazdy

local cmd="sell"
local cmd2="kuppojazd"
local sprzedazPojazdu={}
local marker=nil
local timer=nil

local pozycjeMarkerow={
-- Opis nad markerem, x,y,z, int, dim
{"Gie?da\n\nSprzeda? Pojazd?w", 1175.856, 1249.349, -92.2, 0, 0, 3}, -- urzad san fierro


}

for i,v in pairs(pozycjeMarkerow) do
local mkr=createMarker(v[2], v[3], v[4]-1, "cylinder", v[7], 3, 178, 34, 34)
setElementDimension(mkr, v[6] or 0)
setElementInterior(mkr, v[5] or 0)
setElementData(mkr, "sprzedaz:pojazd?w", true)

marker = mkr

local t=createElement("text")
setElementData(t,"name", v[1])
setElementPosition(t,v[2],v[3],v[4])
setElementDimension(t, v[6] or 0)
setElementInterior(t, v[5] or 0)
addEventHandler ("onMarkerHit", mkr, function(el,md)
outputChatBox("#FF8C00>> #ffffffAby sprzeda? pojazd wpisz /sell <nick/ID> <id pojazdu> <cena> ", el, 0, 0, 0, true)
setElementData(el, "sprzedaz:pojazdow", true)
end)
addEventHandler ("onMarkerLeave", mkr, function(el,md)
setElementData(el, "sprzedaz:pojazdow", false)
end)
end


function checkVehiclePlayer(plr)
-- Pobieramy tabel? i nast?pnie zwracamy j?
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles")
local number=0
-- Uruchamiamy p?tl? spradzaj?c? pojazdy z bazy danych i
-- por?wnujemy w?a?ciciela z UID osoby kt?ra chce zakupi?
for i,v in ipairs(result) do
if result[1].ownedPlayer == getElementData(plr,"player:sid") then
number=number+1
end
end
-- Zwracamy ilo?? pojazd?w gracza je?eli nie ma zwr?ci
-- mu false.
return number
end

local function pokazOperacje(plr)
if not sprzedazPojazdu[plr] then return end
local veh=sprzedazPojazdu[plr][3] -- sprawdzanie tablicy
outputChatBox("#00ff00✔ #ffffffOtrzyma?e?(a?) ofert? sprzeda?y pojazdu "..getVehicleNameFromModel(getVehicleModel(veh)).." za cen? $"..sprzedazPojazdu[plr][4], plr, 255, 255, 0, true)
outputChatBox("#FF8C00>> #ffffffID: "..getElementData(veh,"vehicle:id").." | Przebieg: "..getElementData(veh,"vehicle:mileage").."", plr, 255, 255, 0, true)
outputChatBox("#FF8C00>> #ffffffAby potwierdzi? zakup wpisz /kuppojazd, masz 20 sekund.", plr, 255, 255, 0, true)
timer=setTimer(function()
sprzedazPojazdu[plr]=nil
outputChatBox("Ⓘ #FFFFFFTransakcja zosta?a anulowana.", plr, 255,255,0, true)
removeCommandHandler("akceptuj.pojazd", akceptujTransakcje) -- usuwanie komendy
end, 20000, 1)
addCommandHandler("kuppojazd", akceptujTransakcje) -- tworzenie komendy
end

function akceptujTransakcje(plr,cmd)
if not sprzedazPojazdu[plr] then return end
local veh=sprzedazPojazdu[plr][3]
local cost=sprzedazPojazdu[plr][4]
local target=sprzedazPojazdu[plr][1]
if cost < 0 then
outputChatBox("Ⓘ #FFFFFFCena jest nieprawid?owa.", plr, 255,255,0, true)
return
end
if tonumber(cost) > getPlayerMoney(plr) then
outputChatBox("Ⓘ #FFFFFFNie posiadasz tyle got?wki!", plr, 255,255,0, true)
return
end
takePlayerMoney(plr, cost)
givePlayerMoney(target, cost)
killTimer(timer)
outputChatBox("#00ff00✔ #ffffffSprzeda? przeprowadzona pomy?lnie.", plr, 0, 0, 0, true)
outputChatBox("#00ff00✔ #ffffffSprzeda? przeprowadzona pomy?lnie.", target, 0, 0, 0, true)
removeCommandHandler("akceptuj.pojazd", akceptujTransakcje) -- usuwanie komendy
wykonajZapytanie(veh,plr,target) -- do bazy danych ustawiamy od razu
end

function wykonajZapytanie(veh,plr,target)
setElementData(veh,"vehicle:ownedGroup", 0)
setElementData(veh,"vehicle:rent", 0)
setElementData(veh,"vehicle:ownedPlayer",getElementData(plr,"player:sid"))
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET ownedPlayer=? AND ownedGroup=0 AND rent=0 WHERE id=?", getElementData(plr,"player:sid"), getElementData(veh,"vehicle:id"))
local text = string.format("[SELL-CAR] Gracz "..getPlayerName(plr).."("..getElementData(plr,"player:sid")..") sprzeda? pojazd "..getElementData(veh,"vehicle:id").." dla "..getPlayerName(target).."("..getElementData(target,"player:sid")..")")
triggerEvent("admin:logs", root, text)
--triggerEvent("admin:addText", resourceRoot, text:gsub("#%x%x%x%x%x%x",""))
-- triggerClientEvent(root, "admin:addText", root, pm_text)
triggerClientEvent("onDebugMessage", resourceRoot, text,5, "Sprzeda? pojazdu")
-- triggerClientEvent(root, "admin:addText", root, )
end

addCommandHandler(cmd, function(plr,_,cel,id,cost)
if getElementData(plr, "sprzedaz:pojazdow")== false then
outputChatBox("#ff0000✘ #ffffffKupiec r?wnie? musi znajdowa? si? w blipie.", plr, 255, 0, 0, true)
return
end
costt=tonumber(cost)
if not cel or not costt then
outputChatBox("#ff0000✘ #ffffffU?ycie: /sell <nick/ID> <id pojazdu> <cena>", plr, 0, 0, 0, true)
return
end
local target=exports["pystories-core"]:findPlayer(plr,cel)
if not target then
outputChatBox("#ff0000✘ #ffffffNie znaleziono podanego gracza.", plr, 255, 0, 0, true)
return
end
if getElementData(target, "sprzedaz:pojazdow")== false then
outputChatBox("#ff0000✘ #ffffffKupiec r?wnie? musi znajdowa? si? w blipie.", plr, 255, 0, 0, true)
return
end
if tonumber(costt) < 0 then
outputChatBox("#ff0000✘ #ffffffPoda?e?(a?) nieprawid?ow? warto??.", plr, 255, 0, 0, true)
return
end
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND parking=1 LIMIT 1;", id)
if result and #result > 0 then
outputChatBox("#ff0000✘ #ffffffPojazd znajduje si? na parkingu policyjnym, b?d? w przechowalni, nie mo?esz go sprzeda?.", plr, 255, 0, 0, true)
return
end
for _,vehicle in ipairs(getElementsByType("vehicle")) do
if tonumber(getElementData(vehicle,"vehicle:id")) == tonumber(id) then
if tonumber(getElementData(vehicle,"vehicle:ownedPlayer")) ~= tonumber(getElementData(plr,"player:sid")) then
outputChatBox("✘ #FFFFFFNie jeste? w?a?cicielem.", plr, 255, 0, 0, true)
return
end
sprzedazPojazdu[target]={plr,target,vehicle,costt}
end
end
-- Warunek sprawdzaj?ca ile gracz ma pojazd?w, je?eli bedzie mia?
-- wi?cej ni? LIMIT na g?rze to wy?wietli mu si? komunikat.
--[[if getElementData(target,"player:premium")==false then
if checkVehiclePlayer(target) and checkVehiclePlayer(target) >= LIMIT then
--outputChatBox("* Maksymalnie ten gracz mo?e mie?: "..LIMIT.." pojazd?w", plr, 255, 0, 0)
return
end
end]]--
pokazOperacje(target)
outputChatBox("Ⓘ #FFFFFFWys?ano ofert?.", plr, 255,255,0, true)

end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-07, 13:29


NoNamik







Wiek: 35
Na forum: 2185 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

Kod:

local LIMIT=3 -- tylko gracz mo?e kupi? trzy pojazdy

local cmd="sell"
local cmd2="kuppojazd"
local sprzedazPojazdu={}
local marker=nil
local timer=nil

local pozycjeMarkerow={
-- Opis nad markerem, x,y,z, int, dim
{"Gie?da\n\nSprzeda? Pojazd?w", 1175.856, 1249.349, -92.2, 0, 0, 3}, -- urzad san fierro


}

for i,v in pairs(pozycjeMarkerow) do
local mkr=createMarker(v[2], v[3], v[4]-1, "cylinder", v[7], 3, 178, 34, 34)
setElementDimension(mkr, v[6] or 0)
setElementInterior(mkr, v[5] or 0)
setElementData(mkr, "sprzedaz:pojazd?w", true)

marker = mkr

local t=createElement("text")
setElementData(t,"name", v[1])
setElementPosition(t,v[2],v[3],v[4])
setElementDimension(t, v[6] or 0)
setElementInterior(t, v[5] or 0)
addEventHandler ("onMarkerHit", mkr, function(el,md)
outputChatBox("#FF8C00>> #ffffffAby sprzeda? pojazd wpisz /sell <nick/ID> <id pojazdu> <cena> ", el, 0, 0, 0, true)
setElementData(el, "sprzedaz:pojazdow", true)
end)
addEventHandler ("onMarkerLeave", mkr, function(el,md)
setElementData(el, "sprzedaz:pojazdow", false)
end)
end


function checkVehiclePlayer(plr)
-- Pobieramy tabel? i nast?pnie zwracamy j?
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles")
local number=0
-- Uruchamiamy p?tl? spradzaj?c? pojazdy z bazy danych i
-- por?wnujemy w?a?ciciela z UID osoby kt?ra chce zakupi?
for i,v in ipairs(result) do
if result[1].ownedPlayer == getElementData(plr,"player:sid") then
number=number+1
end
end
-- Zwracamy ilo?? pojazd?w gracza je?eli nie ma zwr?ci
-- mu false.
return number
end

local function pokazOperacje(plr)
if not sprzedazPojazdu[plr] then return end
local veh=sprzedazPojazdu[plr][3] -- sprawdzanie tablicy
outputChatBox("#00ff00✔ #ffffffOtrzyma?e?(a?) ofert? sprzeda?y pojazdu "..getVehicleNameFromModel(getVehicleModel(veh)).." za cen? $"..sprzedazPojazdu[plr][4], plr, 255, 255, 0, true)
outputChatBox("#FF8C00>> #ffffffID: "..getElementData(veh,"vehicle:id").." | Przebieg: "..getElementData(veh,"vehicle:mileage").."", plr, 255, 255, 0, true)
outputChatBox("#FF8C00>> #ffffffAby potwierdzi? zakup wpisz /kuppojazd, masz 20 sekund.", plr, 255, 255, 0, true)
timer=setTimer(function()
sprzedazPojazdu[plr]=nil
outputChatBox("Ⓘ #FFFFFFTransakcja zosta?a anulowana.", plr, 255,255,0, true)
removeCommandHandler("akceptuj.pojazd", akceptujTransakcje) -- usuwanie komendy
end, 20000, 1)
addCommandHandler("kuppojazd", akceptujTransakcje) -- tworzenie komendy
end

function akceptujTransakcje(plr,cmd)
if not sprzedazPojazdu[plr] then return end
local veh=sprzedazPojazdu[plr][3]
local cost=sprzedazPojazdu[plr][4]
local target=sprzedazPojazdu[plr][1]
if cost < 0 then
outputChatBox("Ⓘ #FFFFFFCena jest nieprawid?owa.", plr, 255,255,0, true)
return
end
if tonumber(cost) > exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=? LIMIT 1",getElementData(plr,"player:sid")) then
outputChatBox("Ⓘ #FFFFFFNie posiadasz tyle got?wki!", plr, 255,255,0, true)
return
end
exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money-" .. cost .. " WHERE id=" .. getElementData(plr, "player:sid"))
exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money+" .. cost .. " WHERE id=" .. getElementData(target, "player:sid"))
killTimer(timer)
outputChatBox("#00ff00✔ #ffffffSprzeda? przeprowadzona pomy?lnie.", plr, 0, 0, 0, true)
outputChatBox("#00ff00✔ #ffffffSprzeda? przeprowadzona pomy?lnie.", target, 0, 0, 0, true)
removeCommandHandler("akceptuj.pojazd", akceptujTransakcje) -- usuwanie komendy
wykonajZapytanie(veh,plr,target) -- do bazy danych ustawiamy od razu
end

function wykonajZapytanie(veh,plr,target)
setElementData(veh,"vehicle:ownedGroup", 0)
setElementData(veh,"vehicle:rent", 0)
setElementData(veh,"vehicle:ownedPlayer",getElementData(plr,"player:sid"))
exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET ownedPlayer=? AND ownedGroup=0 AND rent=0 WHERE id=?", getElementData(plr,"player:sid"), getElementData(veh,"vehicle:id"))
local text = string.format("[SELL-CAR] Gracz "..getPlayerName(plr).."("..getElementData(plr,"player:sid")..") sprzeda? pojazd "..getElementData(veh,"vehicle:id").." dla "..getPlayerName(target).."("..getElementData(target,"player:sid")..")")
triggerEvent("admin:logs", root, text)
--triggerEvent("admin:addText", resourceRoot, text:gsub("#%x%x%x%x%x%x",""))
-- triggerClientEvent(root, "admin:addText", root, pm_text)
triggerClientEvent("onDebugMessage", resourceRoot, text,5, "Sprzeda? pojazdu")
-- triggerClientEvent(root, "admin:addText", root, )
end

addCommandHandler(cmd, function(plr,_,cel,id,cost)
if getElementData(plr, "sprzedaz:pojazdow")== false then
outputChatBox("#ff0000✘ #ffffffKupiec r?wnie? musi znajdowa? si? w blipie.", plr, 255, 0, 0, true)
return
end
costt=tonumber(cost)
if not cel or not costt then
outputChatBox("#ff0000✘ #ffffffU?ycie: /sell <nick/ID> <id pojazdu> <cena>", plr, 0, 0, 0, true)
return
end
local target=exports["pystories-core"]:findPlayer(plr,cel)
if not target then
outputChatBox("#ff0000✘ #ffffffNie znaleziono podanego gracza.", plr, 255, 0, 0, true)
return
end
if getElementData(target, "sprzedaz:pojazdow")== false then
outputChatBox("#ff0000✘ #ffffffKupiec r?wnie? musi znajdowa? si? w blipie.", plr, 255, 0, 0, true)
return
end
if tonumber(costt) < 0 then
outputChatBox("#ff0000✘ #ffffffPoda?e?(a?) nieprawid?ow? warto??.", plr, 255, 0, 0, true)
return
end
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND parking=1 LIMIT 1;", id)
if result and #result > 0 then
outputChatBox("#ff0000✘ #ffffffPojazd znajduje si? na parkingu policyjnym, b?d? w przechowalni, nie mo?esz go sprzeda?.", plr, 255, 0, 0, true)
return
end
for _,vehicle in ipairs(getElementsByType("vehicle")) do
if tonumber(getElementData(vehicle,"vehicle:id")) == tonumber(id) then
if tonumber(getElementData(vehicle,"vehicle:ownedPlayer")) ~= tonumber(getElementData(plr,"player:sid")) then
outputChatBox("✘ #FFFFFFNie jeste? w?a?cicielem.", plr, 255, 0, 0, true)
return
end
sprzedazPojazdu[target]={plr,target,vehicle,costt}
end
end
-- Warunek sprawdzaj?ca ile gracz ma pojazd?w, je?eli bedzie mia?
-- wi?cej ni? LIMIT na g?rze to wy?wietli mu si? komunikat.
--[[if getElementData(target,"player:premium")==false then
if checkVehiclePlayer(target) and checkVehiclePlayer(target) >= LIMIT then
--outputChatBox("* Maksymalnie ten gracz mo?e mie?: "..LIMIT.." pojazd?w", plr, 255, 0, 0)
return
end
end]]--
pokazOperacje(target)
outputChatBox("Ⓘ #FFFFFFWys?ano ofert?.", plr, 255,255,0, true)

end)


jezeli pomoglem to licze na :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-07, 13:51


popek12







Wiek: 23
Na forum: 3441 dni
Posty: 5
Nick w MP: popek12



Respekt: 50



Wywala b??d w debugscript 3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-07, 15: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%
spr?buj zamieni? cost na tonumber(cost)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-07, 15:42


popek12







Wiek: 23
Na forum: 3441 dni
Posty: 5
Nick w MP: popek12



Respekt: 50

No w?a?nie jest tonumber(cost)

[ Dodano: 2021-05-07, 16:12 ]
Ma kto? jaki? pomys??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-07, 18:07


NoNamik







Wiek: 35
Na forum: 2185 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

popek12, to na odwrot

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-08-06, 16:44


_jvneczek







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

Piwa: 3949

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

Czy problem dalej wystepuje?

Postaw piwo autorowi tego posta
 

 
Tagi: pieniądzę :: giełdy :: pobiera :: bankomatu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Pieniądzę z giełdy pobiera do bankomatu 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