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

Wysłany: 2016-11-02, 20:43


VVrongVVay







Wiek: 37
Na forum: 4486 dni
Posty: 47
Nick w MP: VVrongVVay

Piwa: 1

Respekt: 50

Ostrzeżeń: 40%
Witam mam na serwerze bankomaty i jest problem w tym, ?e wp?acaj?c do banku 0.5$ na konto wp?ywa 1$. To samo przy wymianie przedmiot?w.. Jak wpiszemy 0.5 to daje 0.5 danego przedmiotu i w ten spos?b da si? bugowa?.. Jak to zablokowa? by mo?na by?o wpisywa? tylko 1$?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-02, 21:12


Kibol1908.

Good Boy






Wiek: 27
Na forum: 4111 dni
Posty: 69
Nick w MP: Hello_Boy

Piwa: 99

Respekt: 65,3

Ostrzeżeń: 60%
Podaj kod.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-02, 21:16


VVrongVVay







Wiek: 37
Na forum: 4486 dni
Posty: 47
Nick w MP: VVrongVVay

Piwa: 1

Respekt: 50

Ostrzeżeń: 40%
Kod:

--[[
@author Lukasz Biegaj <wielebny@bestplay.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
@license Dual GPLv2/MIT
@todo przerobic z zasobu DB na DB2
]]--


local function getPlayerID(plr)
local c=getElementData(client,"character")
if not c or not c.id then return nil end
return tonumber(c.id)
end

addEvent("onPlayerRequestATMInfo", true)
addEventHandler("onPlayerRequestATMInfo", resourceRoot, function()
local c=getElementData(client,"character")
if not c or not c.id then
triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
return
end
local dbid=tonumber(c.id)
if not dbid then
triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
return
end
local sr=exports.DB:pobierzWyniki("SELECT bank_money FROM lss_characters 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=getPlayerID(client)
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.DB:zapytanie("UPDATE lss_characters SET bank_money=bank_money+"..(tonumber(kwota) or 0).." WHERE id="..tonumber(dbid).." LIMIT 1")
exports["lss-admin"]:gameView_add("BANK wplata "..getPlayerName(client).."/"..dbid.." kwota "..kwota.."$")
triggerEvent("broadcastCaptionedEvent", client, getPlayerName(client).." wp?aca pieni?dze do bankomatu", 3, 20, true)
elseif kwota<0 then
local sr=exports.DB:pobierzWyniki("SELECT `bank_money` FROM `lss_characters` 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
triggerEvent("broadcastCaptionedEvent", client, getPlayerName(client).." wyp?aca pieni?dze z bankomatu", 3, 20, true)
exports.DB:zapytanie("UPDATE lss_characters SET bank_money=bank_money-"..math.abs(tonumber(kwota)).." WHERE id="..tonumber(dbid).." LIMIT 1")
exports["lss-admin"]:gameView_add("BANK wyplata "..getPlayerName(client).."/"..dbid.." kwota "..kwota.."$")
givePlayerMoney(client, math.abs(kwota))
end


end)

addEvent("doATMOperationFraction", true)
addEventHandler("doATMOperationFraction", resourceRoot, function(kwota,frakcja,tytul)
local dbid=getPlayerID(client)
if not dbid then return end -- nie powinno sie zdarzyc

local sr=exports.DB:pobierzWyniki("SELECT `bank_money` FROM `lss_characters` 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)
return
end

exports.DB:zapytanie("UPDATE lss_characters SET bank_money=bank_money-"..(tonumber(kwota) or 0).." WHERE id="..tonumber(dbid).." LIMIT 1") --zabieramy kase z konta gracza
exports.DB2:zapytanie(string.format("INSERT INTO `lss_faction_wplaty` (`char_id`, `faction_id`, `kwota`, `tytul`) VALUES ('%f', '%f', '%f', '%s')", tonumber(dbid), tonumber(frakcja), tonumber(kwota), tytul))

local sr=exports.DB:pobierzWyniki("SELECT `id` FROM `lss_containers` WHERE owning_faction="..tonumber(frakcja).." LIMIT 1")
-- exports["lss-pojemniki"]:insertItemToContainer(sr.id, -1, tonumber(kwota*0.75), 0, "Got?wka") --75% dla firmy

exports["lss-pojemniki"]:insertItemToContainer(1533, -1, tonumber(kwota*0.75), 0, "Got?wka") --25% dla urzedu

exports["lss-admin"]:gameView_add("BANK-FRAKCJA wplata "..getPlayerName(client).."/"..dbid.." kwota "..kwota.."$ NA KONTO "..frakcja.." TYTULEM "..tytul)
triggerEvent("broadcastCaptionedEvent", client, getPlayerName(client).." przelewa ?rodki na konto frakcyjne", 3, 20, true)


end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-04, 14:17


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64


    if value == or value 0 then

tam sobie pozmieniaj

Postaw piwo autorowi tego posta
 

 
Tagi: bug :: bankomacie.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Bug w bankomacie. 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