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

Wysłany: 2016-07-25, 20:04


stacker123

LUA/MTA:SA






Wiek: 23
Na forum: 3688 dni
Posty: 31

Piwa: 3408

Respekt: 60

Ostrzeżeń: 100%
Mam problem z bankomatami, wszystko mam pod??czone a i tak nie dzia?aj?.

Oto kod

Kod:

addEvent("onPlayerRequestATMInfo", true)
addEventHandler("onPlayerRequestATMInfo", resourceRoot, function()
local dbid=getElementData(client,"player:uid")
if not dbid then
triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
return
end
local sr=exports["ogrpg-db"]:pobierzWyniki("SELECT bank_money FROM ogrpg_users WHERE id="..(tonumber(dbid) or 0).." LIMIT 1")
if not sr or not sr.bank_money then
triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
return
end
triggerClientEvent(client,"doFillATMInfo", resourceRoot, true, tonumber(sr.bank_money))
end)

addEvent("doATMOperation", true)
addEventHandler("doATMOperation", resourceRoot, function(kwota)
-- kwota dodatnia - wplata
-- kwota ujemna - wyplata
if kwota>0 and kwota>getPlayerMoney(client) then return end -- komunikat bledu po stronie klienta
local dbid=getElementData(client,"player:uid")
if not dbid then return end -- nie powinno sie zdarzyc
if kwota>0 then
if getPlayerMoney(client)<kwota then return end
takePlayerMoney(client, kwota)
exports["ogrpg-db"]:zapytanie("UPDATE ogrpg_users SET bank_money=bank_money+"..(tonumber(kwota) or 0).." WHERE id="..tonumber(dbid).." LIMIT 1")
--triggerEvent("broadcastCaptionedEvent", client, getPlayerName(client).." wp?aca pieni?dze do bankomatu", 3, 20, true)
outputChatBox("Wplaciles pieni?dze", client, 255,0,0)
elseif kwota<0 then
local sr=exports["ogrpg-db"]:pobierzWyniki("SELECT `bank_money` FROM `ogrpg_users` WHERE id="..tonumber(dbid).." LIMIT 1")
if not sr or not sr.bank_money then return end -- nie opwinno sie wydarzyc
sr.bank_money=tonumber(sr.bank_money)
if (sr.bank_money<math.abs(kwota)) then
outputChatBox("Nie masz tyle ?rodk?w na koncie!", client, 255,0,0)
-- triggerClientEvent(client,"onAnnouncement3", root, "Nie masz tyle ?rodk?w na koncie!", 5)
return
end
outputChatBox("Wyplaciles pieni?dze", client, 255,0,0)
exports["ogrpg-db"]:zapytanie("UPDATE ogrpg_users SET bank_money=bank_money-"..math.abs(tonumber(kwota)).." WHERE id="..tonumber(dbid).." LIMIT 1")
givePlayerMoney(client, math.abs(kwota))
end


end)


A tak wygl?da baza danych



Mam nadzieje ze ktos mi pomoze :( [/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-26, 10:23


xHardus







Wiek: 27
Na forum: 4787 dni
Posty: 90
Nick w MP: Harduś

Piwa: 786

Respekt: 15,3

b?edy db3, pod jak? strone da?e? kod?

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
psychol.
Wysłany: 2016-07-27, 16:22


stacker123

LUA/MTA:SA






Wiek: 23
Na forum: 3688 dni
Posty: 31

Piwa: 3408

Respekt: 60

Ostrzeżeń: 100%
"rafox12345" napisał/a:

b?edy db3, pod jak? strone da?e? kod?


S-side

Postaw piwo autorowi tego posta
 

 
Tagi: bankomaty
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