Jump to content

SINCRONIZAR MOD


Recommended Posts

Posted (edited)

Olá!
Eu gostaria de fazer um MOD de "CÓDIGO PROMOCIONAL" interagir com o MOD de BANCO.

Esse parece ser o trecho que não está comunicando com o "Bank:Caixa"

function onPlayerEnterCode (code)
    local query = dbQuery(db,"SELECT * FROM codes WHERE code = ?", code)
    local result = dbPoll(query, -1)
	if result and #result ~= 0 then
	    local code, type, quant_code, prise, use = code, result[1]["type"], result[1]["quant_code"], result[1]["prise"], result[1]["use"]
		
		local table_player = fromJSON(result[1]["use"])
		local isPlayerFound = false
		
		for i, serial in ipairs (table_player) do
		    if getPlayerSerial(source) == serial then
			    isPlayerFound = true
			end
		end
		if isPlayerFound == true then 
				outputChatBox("#DCDCDCВы уже #3688B1использовали #DCDCDCданный код!", source, 255, 0, 0, true) 
				-- outputChatBox ("#DCDCDCНа карте #3688B1появился #3688B1кейс, #DCDCDCскорее #3688B1езжай #DCDCDCна метку и зебери #DCDCDCего", root, 215, 215, 215, true)
			return 
		end
		if tonumber(quant_code) <= 0 then 
				outputChatBox("#DCDCDCВсе промо-коды уже #3688B1активированы!", source, 255, 0, 0, true) 
				-- outputChatBox("#DCDCDCВы уже #3688B1использовали #DCDCDCданный код!", source, 255, 0, 0, true) 
			return 
		end
		if type == "Деньги" then
		
			exports.Bank:giveAccountPlayerMoney (getPlayerAccount (source), tonumber(prise), "RUB")
			outputChatBox("Вы использовали промо-код и получили ("..formatNumber(prise)..") рублей на банк", source, 0, 255, 0, true)	
			
			
		elseif type == "Авто" then
		
			r1, g1, b1 = math.random(0,255), math.random(0,255), math.random(0,255)
			r2, g2, b2 = math.random(0,255), math.random(0,255), math.random(0,255)
			region = math.random(1,99)
			exports.car_system:addBase(source, tonumber(prise), r1, g1, b1, r2, g2, b2, region)
	
			outputChatBox("Вы использовали промо-код и получили ("..exports.car_system:getVehicleModName(tonumber(prise))..") ", source, 0, 255, 0, true)
			


		elseif type == "Донат" then
			exports.Bank:giveAccountBankMoney (getPlayerAccount (source), tonumber(prise), "DONATE")
			outputChatBox("Вы использовали код и получили ("..prise..") доната", source, 0, 255, 0, true)	


			
		end
		table.insert(table_player, getPlayerSerial(source))

		
	    dbExec(db, "UPDATE codes SET quant_code = ?, use = ? WHERE code = ? ", quant_code - 1, toJSON(table_player), code)
	else
	    outputChatBox("#DCDCDCПромо-код #3688B1не найден#DCDCDC, проверь правильность промо-кода!", source, 255, 0, 0, true)
	end
end
addEvent("onPlayerEnterCode", true)
addEventHandler("onPlayerEnterCode", getRootElement(), onPlayerEnterCode)
Quote

exports.Bank:giveAccountPlayerMoney (getPlayerAccount (source), tonumber(prise), "RUB")

Tentei modificar essa linha, alterando para: ...Bank:Caixa..., ...Bank_Caixa...,  ...Caixa:..., ...Bank:givePlayerMoney...
Não tive sucesso em nenhuma tentativa!

Essas são as linhas do MOD do Banco que estou usando:

function depositUI()
    local money = convertNumber(getPlayerMoney(localPlayer)) 
    local bankMoney = convertNumber(getElementData(localPlayer, "Bank:Caixa"))
    --exports["[VZR]Blur2"]:dxDrawBluredRectangle(0, 0, screenW, screenH, tocolor(255, 255, 255, 255))
    dxDrawImage(x*0, y*0, x*1360, y*768,"gfx/ui/bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x*0, y*0, x*1360, y*768,"gfx/ui/bgd.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawText(getPlayerName(localPlayer):gsub("#%x%x%x%x%x%x", ""), x*310, y*158, x*406, y*182, tocolor(0, 0, 0, 127), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false)
    dxDrawText("R$ "..money, x*339, y*189, x*426, y*213, tocolor(0, 0, 0, 127), 1.00, dxfont0_fonte, "left", "top", false, false, false, false, false)
    dxDrawText("R$ "..bankMoney, x*340, y*216, x*427, y*240, tocolor(0, 0, 0, 127), 1.00, dxfont0_fonte, "left", "top", false, false, false, false, false)
    dxDrawRectangle(x*402, y*564, x*540, y*56, isCursorOnElement(x*502, y*564, x*320, y*56) and tocolor(0, 84, 131, 255) or tocolor(0, 112, 175, 255), false)
    createEditBox("2", 0.379, 0.443, 0.22, 0.06, true, "", false, 7, "arial", false, 1, {0, 0, 0, 127 }, true, { 0, 0, 0, 55 }, 1, true, 60, true, "Digite o valor", { 0, 0, 0, 127 }, true, 1, "arial", true, true, {0, 0, 0}, false) 
     dxDrawText("   Cancelar", x*619, y*580, x*706, y*441, --[[isCursorOnElement(x*502, y*401, x*320, y*56) and]] tocolor(255, 255, 255, 255)--[[ or tocolor(0, 0, 0, 127)]], 1.00, dxfont1_fonte, "left", "top", false, false, false, false, false)
    dxDrawRectangle(x*402, y*480, x*540, y*56, isCursorOnElement(x*502, y*480, x*320, y*56) and tocolor(0, 84, 131, 255) or tocolor(0, 112, 175, 255), false)
    dxDrawText("   Depositar", x*619, y*497, x*706, y*441, --[[isCursorOnElement(x*502, y*401, x*320, y*56) and]] tocolor(255, 255, 255, 255)--[[ or tocolor(0, 0, 0, 127)]], 1.00, dxfont1_fonte, "left", "top", false, false, false, false, false)
    if getElementData(localPlayer, "Notification") then
        dxDrawText("[Erro] "..getElementData(localPlayer, "Notification"), x*240, y*680, x*706, y*441, tocolor(255, 0, 0, 255), 1.00, dxfont0_fonte, "left", "top", false, false, false, false, false)
    end
    if getElementData(localPlayer, "Notification:S") then
        dxDrawText("[Sucesso] "..getElementData(localPlayer, "Notification:S"), x*240, y*680, x*706, y*441, tocolor(0, 255, 0, 255), 1.00, dxfont0_fonte, "left", "top", false, false, false, false, false)
    end
end

Gostaria de receber um dinheiro do MOD no banco, ou então diretamente na conta do personagem, se possível!
O que devo fazer para receber diretamente na conta do personagem, sem a necessidade de um Banco?
O que devo fazer para receber em um Banco?

Edited by Lord Henry
Códigos convertidos de HTML para Lua.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...