Jump to content

Me ajudem! ( Transferidor de dinheiro )


Recommended Posts

7 minutes ago, #Horus said:

Posso mandar o link de download pra facilitar ?

Use a ferramenta do fórum lua code para facilitar, não é necessário enviar link de download.

Se seu script tiver os 2 lados CLIENT-SIDE e SERVER-SIDE

Poste ambos separados para facilitar.

Segue a screenshot abaixo:

 

xn9sfEX.png

 

 

 

Link to comment
7 hours ago, OverKILL said:

Use a ferramenta do fórum lua code para facilitar, não é necessário enviar link de download.

Se seu script tiver os 2 lados CLIENT-SIDE e SERVER-SIDE

Poste ambos separados para facilitar.

Segue a screenshot abaixo:

 

xn9sfEX.png

 

 

 

function onGridClick(player)
	if (not isElement(player)) then
		return
	end
	triggerClientEvent(source, "setPlayerDetails", getRootElement(), player)
end
addEvent("onGridClick", true)
addEventHandler("onGridClick", getRootElement(), onGridClick)

local t = {}

function checkValues(source, arg1, arg2)
	if (arg2 >= 60) then
		t[source]['min'] = tonumber(t[source]['min'] or 0) + 1
		t[source]['sec'] = 0
	end
	if (arg1 >= 60) then
		t[source]['min'] = 0
		t[source]['hour'] = tonumber(t[source]['hour'] or 0) + 1
	end
	return arg1, arg2
end


function onGridClickDoar(selectedDoar, amount)
	local dinheiro = getPlayerMoney(source)
	if tonumber(amount) >= 0 then
		if tonumber(amount) <= dinheiro then
			playerMoney = getPlayerFromName(selectedDoar)
			if playerMoney ~= false then
				givePlayerMoney(playerMoney, amount)
				takePlayerMoney(source, amount)
				name = getPlayerName(source)
				outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffVoce Enviou #00ff00R$ : " .. amount .. " #FFFFFFPara O Jogador "..selectedDoar, source, 255, 255, 255, true)
				outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffO Jogador "..name.." #FFFFFFEnviou #00FF00R$ : "..amount, playerMoney, 255, 0, 0, true)
			else
				outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffSelecione Um Jogador", source, 255, 0, 0, true)
			end
		else
			outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffVoce Nao Tem Dinheiro Suficiente", source, 255, 0, 0, true)
		end
	else
		outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffUtilize Valores De 1 A 99999999", source, 255, 0, 0, true)
	end
end
addEvent("onGridClickDoar", true)
addEventHandler("onGridClickDoar", getRootElement(), onGridClickDoar)








esSE E O SERVER

 

local screenH, screenW = guiGetScreenSize()
local x, y = (screenH/1366), (screenW/768)
local font2 = dxCreateFont("gfx/Blix-Black.ttf", 19)
local dxfont1_font = dxCreateFont("gfx/font.ttf", 11)
local dxfont2_font = dxCreateFont("gfx/font.ttf", 10)

gridListDoar = guiCreateGridList(495, 302, 176, 257, false)
colunaDoar = guiGridListAddColumn(gridListDoar, "Jogadores", 0.9)
guiGridListSetSelectionMode(gridListDoar, 2)
guiSetAlpha(gridListDoar, 0.50)
guiSetVisible(gridListDoar, false)
editBoxDoar = guiCreateEdit(724, 343, 184, 23, tonumber("0"), false)
guiSetVisible(editBoxDoar, false)
guiSetAlpha(editBoxDoar, 0.50)
guiEditSetMaxLength(editBoxDoar, 85555)

for _, player in ipairs(getElementsByType("player")) do
	local rowDoar = guiGridListAddRow(gridListDoar)
	guiGridListSetItemText(gridListDoar, rowDoar, colunaDoar, getPlayerName(player), false, false)
	guiGridListSetItemColor(gridListDoar, rowDoar, colunaDoar, 255, 165, 0)
end

function SetAll()
	if (trans == true) then
		if tonumber(guiGetText(editBoxDoar)) ~= nil then
			totalDoar = tonumber(guiGetText(editBoxDoar))
		end
	end
end
setTimer(SetAll, 50, 0)
cor = {}
totalDoar = 0
trans = false
function server()
	local dinheiro = getPlayerMoney(getLocalPlayer())
  cor[1] = tocolor(255,255,255,255)
  cor[2] = tocolor(0, 0, 0, 140)
   if cursorPosition(x*948,y*259,x*962,y*288) then cor[1] = tocolor(255,0,0,255) end
   if cursorPosition(x*774,y*376,x*91,y*27) then cor[2] = tocolor(247, 142, 7, 200) end
        dxDrawRectangle(474, 265, 498, 323, tocolor(0, 0, 0, 226), false)
        dxDrawRectangle(474, 265, 498, 26, tocolor(0, 0, 0, 187), false)
		dxDrawText("Transferidor De Dinheiro", 473, 265, 972, 292, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawRectangle(x*774,y*376,x*91,y*27,cor[2], false)
        dxDrawText("Transferir", 773, 376, 864, 402, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Seu Dinheiro : "..dinheiro,x*756,y*413,x*1040,y*430, tocolor(255, 255, 255, 255), 1.00, dxfont2_font, "left", "top", false, false, false, false, false)    
    end

function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end


function getGridlistPlayer()
	local player = getPlayerFromName(guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1))
	if (player) then
		return player
	end
end

function dxDrawXeets(absX, absY, sizeX, sizeY, color, ancho)
	dxDrawRectangle(absX, absY, sizeX, ancho, color)
	dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color)
	dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color)
	dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho * 2, color)
end

function onGridClick()
	local player = getGridlistPlayer()
	if (player == "" or player == nil) then
		return
	else
		triggerServerEvent("onGridClick", getLocalPlayer(), player)
	end
end

function refreshDoar()
	guiGridListClear(gridListDoar)
	if coluna then
		for _, playeritem in ipairs(getElementsByType("player")) do
			local rowDoar = guiGridListAddRow(gridListDoar)
			setTimer(guiGridListSetItemText, 2000, 1, gridListDoar, rowDoar, colunaDoar, getPlayerName(playeritem), false, false)
			setTimer(guiGridListSetItemColor, 2000, 1, gridListDoar, rowDoar, colunaDoar, 255, 165, 0)
		end
	end
end
function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end

function convertNumber(number)
	local formated = number
	while true do
		formated, k = string.gsub(formated, "^(-?%d+)(%d%d%d)", "%1,%2")
		if (k == 0) then
			break
		end
	end
	return formated
end

local componentes = {"armour", "wanted", "weapon", "money", "health", "clock", "breath", "ammo"}
local tableSkins = {1, 2, 7, 9, 10, 11, 12, 14, 15, 16, 18, 28, 310, 311, 312}

function enviar(_,state)
if trans == true then
if state == "down" then
if cursorPosition(x*774,y*376,x*91,y*27) then
selectedDoar = guiGridListGetItemText(gridListDoar, guiGridListGetSelectedItem(gridListDoar), 1)
amount = guiGetText(editBoxDoar)
triggerServerEvent("onGridClickDoar", getLocalPlayer(), selectedDoar, amount)
end
end
end
end
addEventHandler ("onClientClick", root, enviar)

function OpenTrasf()
	if trans == false then
		showCursor (true)
		addEventHandler ("onClientRender", root, server)
		trans = true
		guiSetVisible (gridListDoar,true)
		guiSetVisible (editBoxDoar,true)
		guiSetVisible (coluna,true)
	else
		showCursor (false)
		removeEventHandler ("onClientRender", root,server)
		trans = false
		guiSetVisible (gridListDoar,false)
		guiSetVisible (editBoxDoar,false)
		guiSetVisible (colunaDoar,false)
	end
end
bindKey ("F10", "down", OpenTrasf)

function cursorPosition(x, y, w, h)
	if (not isCursorShowing()) then
		return false
	end
	local mx, my = getCursorPosition()
	local fullx, fully = guiGetScreenSize()
	cursorx, cursory = mx*fullx, my*fully
	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
		return true
	else
		return false
	end
end








esse é o client

 

Link to comment
  • Other Languages Moderators

Você deve preencher a lista ao abri-la e limpá-la ao fechar a lista.

Dessa forma, no client:

local screenH, screenW = guiGetScreenSize()
local x, y = (screenH/1366), (screenW/768)
local font2 = dxCreateFont("gfx/Blix-Black.ttf", 19)
local dxfont1_font = dxCreateFont("gfx/font.ttf", 11)
local dxfont2_font = dxCreateFont("gfx/font.ttf", 10)

gridListDoar = guiCreateGridList(495, 302, 176, 257, false)
colunaDoar = guiGridListAddColumn(gridListDoar, "Jogadores", 0.9)
guiGridListSetSelectionMode(gridListDoar, 2)
guiSetAlpha(gridListDoar, 0.50)
guiSetVisible(gridListDoar, false)
editBoxDoar = guiCreateEdit(724, 343, 184, 23, tonumber("0"), false)
guiSetVisible(editBoxDoar, false)
guiSetAlpha(editBoxDoar, 0.50)
guiEditSetMaxLength(editBoxDoar, 8) -- 85555

function SetAll()
	if (trans == true) then
		if tonumber(guiGetText(editBoxDoar)) ~= nil then
			totalDoar = tonumber(guiGetText(editBoxDoar))
		end
	end
end

setTimer(SetAll, 50, 0)
cor = {}
totalDoar = 0
trans = false

function server()
	local dinheiro = getPlayerMoney(getLocalPlayer())
	cor[1] = tocolor(255,255,255,255)
	cor[2] = tocolor(0, 0, 0, 140)
	if cursorPosition(x*948,y*259,x*962,y*288) then
		cor[1] = tocolor(255,0,0,255)
	end
	if cursorPosition(x*774,y*376,x*91,y*27) then
		cor[2] = tocolor(247, 142, 7, 200)
	end
	dxDrawRectangle(474, 265, 498, 323, tocolor(0, 0, 0, 226), false)
	dxDrawRectangle(474, 265, 498, 26, tocolor(0, 0, 0, 187), false)
	dxDrawText("Transferidor De Dinheiro", 473, 265, 972, 292, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawRectangle(x*774,y*376,x*91,y*27,cor[2], false)
	dxDrawText("Transferir", 773, 376, 864, 402, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawText("Seu Dinheiro : "..dinheiro,x*756,y*413,x*1040,y*430, tocolor(255, 255, 255, 255), 1.00, dxfont2_font, "left", "top", false, false, false, false, false)    
end

function getPlayerFromPartialName(name)
	local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
	if name then
		for _, player in ipairs(getElementsByType("player")) do
			local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
			if name_:find(name, 1, true) then
				return player
			end
		end
	end
end


function getGridlistPlayer()
	local player = getPlayerFromName(guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1))
	if (player) then
		return player
	end
end

function dxDrawXeets(absX, absY, sizeX, sizeY, color, ancho)
	dxDrawRectangle(absX, absY, sizeX, ancho, color)
	dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color)
	dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color)
	dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho * 2, color)
end

function onGridClick()
	local player = getGridlistPlayer()
	if (player == "" or player == nil) then
		return
	else
		triggerServerEvent("onGridClick", getLocalPlayer(), player)
	end
end

function convertNumber(number)
	local formated = number
	while true do
		formated, k = string.gsub(formated, "^(-?%d+)(%d%d%d)", "%1,%2")
		if (k == 0) then
			break
		end
	end
	return formated
end

local componentes = {"armour", "wanted", "weapon", "money", "health", "clock", "breath", "ammo"}
local tableSkins = {1, 2, 7, 9, 10, 11, 12, 14, 15, 16, 18, 28, 310, 311, 312}

function enviar(_,state)
	if trans == true then
		if state == "down" then
			if cursorPosition(x*774,y*376,x*91,y*27) then
				selectedDoar = guiGridListGetItemText(gridListDoar, guiGridListGetSelectedItem(gridListDoar), 1)
				amount = guiGetText(editBoxDoar)
				triggerServerEvent("onGridClickDoar", getLocalPlayer(), selectedDoar, amount)
			end
		end
	end
end
addEventHandler ("onClientClick", root, enviar)

function OpenTrasf()
	if trans == false then -- Se o painel não está visível, então:
		for _, player in ipairs(getElementsByType("player")) do -- Atualiza a lista, preenchendo com os jogadores online.
			local rowDoar = guiGridListAddRow(gridListDoar)
			guiGridListSetItemText(gridListDoar, rowDoar, colunaDoar, getPlayerName(player), false, false)
			guiGridListSetItemColor(gridListDoar, rowDoar, colunaDoar, 255, 165, 0)
		end
		showCursor (true)
		addEventHandler ("onClientRender", root, server)
		trans = true
		guiSetVisible (gridListDoar,true) -- Torna o painel visível.
		guiSetVisible (editBoxDoar,true)
		guiSetVisible (coluna,true)
	else -- Se o painel está visível, então:
		showCursor (false)
		removeEventHandler ("onClientRender", root, server)
		trans = false
		guiGridListClear (gridListDoar) -- Limpa a lista, deixando ela vazia.
		guiSetVisible (gridListDoar,false) -- Torna o painel invisível.
		guiSetVisible (editBoxDoar,false)
		guiSetVisible (colunaDoar,false)
	end
end
bindKey ("F10", "down", OpenTrasf)

function cursorPosition(x, y, w, h)
	if (not isCursorShowing()) then
		return false
	end
	local mx, my = getCursorPosition()
	local fullx, fully = guiGetScreenSize()
	cursorx, cursory = mx*fullx, my*fully
	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
		return true
	else
		return false
	end
end

Não mexi no server.lua, mas já detectei problema de lógica na linha 27 em relação a linha 43. Além disso você pode usar acentos nos textos do outputChatBox.

Link to comment
10 hours ago, #Horus said:

function onGridClick(player)
	if (not isElement(player)) then
		return
	end
	triggerClientEvent(source, "setPlayerDetails", getRootElement(), player)
end
addEvent("onGridClick", true)
addEventHandler("onGridClick", getRootElement(), onGridClick)

local t = {}

function checkValues(source, arg1, arg2)
	if (arg2 >= 60) then
		t[source]['min'] = tonumber(t[source]['min'] or 0) + 1
		t[source]['sec'] = 0
	end
	if (arg1 >= 60) then
		t[source]['min'] = 0
		t[source]['hour'] = tonumber(t[source]['hour'] or 0) + 1
	end
	return arg1, arg2
end


function onGridClickDoar(selectedDoar, amount)
	local dinheiro = getPlayerMoney(source)
	if tonumber(amount) >= 0 then
		if tonumber(amount) <= dinheiro then
			playerMoney = getPlayerFromName(selectedDoar)
			if playerMoney ~= false then
				givePlayerMoney(playerMoney, amount)
				takePlayerMoney(source, amount)
				name = getPlayerName(source)
				outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffVoce Enviou #00ff00R$ : " .. amount .. " #FFFFFFPara O Jogador "..selectedDoar, source, 255, 255, 255, true)
				outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffO Jogador "..name.." #FFFFFFEnviou #00FF00R$ : "..amount, playerMoney, 255, 0, 0, true)
			else
				outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffSelecione Um Jogador", source, 255, 0, 0, true)
			end
		else
			outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffVoce Nao Tem Dinheiro Suficiente", source, 255, 0, 0, true)
		end
	else
		outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffUtilize Valores De 1 A 99999999", source, 255, 0, 0, true)
	end
end
addEvent("onGridClickDoar", true)
addEventHandler("onGridClickDoar", getRootElement(), onGridClickDoar)








esSE E O SERVER

 


local screenH, screenW = guiGetScreenSize()
local x, y = (screenH/1366), (screenW/768)
local font2 = dxCreateFont("gfx/Blix-Black.ttf", 19)
local dxfont1_font = dxCreateFont("gfx/font.ttf", 11)
local dxfont2_font = dxCreateFont("gfx/font.ttf", 10)

gridListDoar = guiCreateGridList(495, 302, 176, 257, false)
colunaDoar = guiGridListAddColumn(gridListDoar, "Jogadores", 0.9)
guiGridListSetSelectionMode(gridListDoar, 2)
guiSetAlpha(gridListDoar, 0.50)
guiSetVisible(gridListDoar, false)
editBoxDoar = guiCreateEdit(724, 343, 184, 23, tonumber("0"), false)
guiSetVisible(editBoxDoar, false)
guiSetAlpha(editBoxDoar, 0.50)
guiEditSetMaxLength(editBoxDoar, 85555)

for _, player in ipairs(getElementsByType("player")) do
	local rowDoar = guiGridListAddRow(gridListDoar)
	guiGridListSetItemText(gridListDoar, rowDoar, colunaDoar, getPlayerName(player), false, false)
	guiGridListSetItemColor(gridListDoar, rowDoar, colunaDoar, 255, 165, 0)
end

function SetAll()
	if (trans == true) then
		if tonumber(guiGetText(editBoxDoar)) ~= nil then
			totalDoar = tonumber(guiGetText(editBoxDoar))
		end
	end
end
setTimer(SetAll, 50, 0)
cor = {}
totalDoar = 0
trans = false
function server()
	local dinheiro = getPlayerMoney(getLocalPlayer())
  cor[1] = tocolor(255,255,255,255)
  cor[2] = tocolor(0, 0, 0, 140)
   if cursorPosition(x*948,y*259,x*962,y*288) then cor[1] = tocolor(255,0,0,255) end
   if cursorPosition(x*774,y*376,x*91,y*27) then cor[2] = tocolor(247, 142, 7, 200) end
        dxDrawRectangle(474, 265, 498, 323, tocolor(0, 0, 0, 226), false)
        dxDrawRectangle(474, 265, 498, 26, tocolor(0, 0, 0, 187), false)
		dxDrawText("Transferidor De Dinheiro", 473, 265, 972, 292, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawRectangle(x*774,y*376,x*91,y*27,cor[2], false)
        dxDrawText("Transferir", 773, 376, 864, 402, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Seu Dinheiro : "..dinheiro,x*756,y*413,x*1040,y*430, tocolor(255, 255, 255, 255), 1.00, dxfont2_font, "left", "top", false, false, false, false, false)    
    end

function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end


function getGridlistPlayer()
	local player = getPlayerFromName(guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1))
	if (player) then
		return player
	end
end

function dxDrawXeets(absX, absY, sizeX, sizeY, color, ancho)
	dxDrawRectangle(absX, absY, sizeX, ancho, color)
	dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color)
	dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color)
	dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho * 2, color)
end

function onGridClick()
	local player = getGridlistPlayer()
	if (player == "" or player == nil) then
		return
	else
		triggerServerEvent("onGridClick", getLocalPlayer(), player)
	end
end

function refreshDoar()
	guiGridListClear(gridListDoar)
	if coluna then
		for _, playeritem in ipairs(getElementsByType("player")) do
			local rowDoar = guiGridListAddRow(gridListDoar)
			setTimer(guiGridListSetItemText, 2000, 1, gridListDoar, rowDoar, colunaDoar, getPlayerName(playeritem), false, false)
			setTimer(guiGridListSetItemColor, 2000, 1, gridListDoar, rowDoar, colunaDoar, 255, 165, 0)
		end
	end
end
function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end

function convertNumber(number)
	local formated = number
	while true do
		formated, k = string.gsub(formated, "^(-?%d+)(%d%d%d)", "%1,%2")
		if (k == 0) then
			break
		end
	end
	return formated
end

local componentes = {"armour", "wanted", "weapon", "money", "health", "clock", "breath", "ammo"}
local tableSkins = {1, 2, 7, 9, 10, 11, 12, 14, 15, 16, 18, 28, 310, 311, 312}

function enviar(_,state)
if trans == true then
if state == "down" then
if cursorPosition(x*774,y*376,x*91,y*27) then
selectedDoar = guiGridListGetItemText(gridListDoar, guiGridListGetSelectedItem(gridListDoar), 1)
amount = guiGetText(editBoxDoar)
triggerServerEvent("onGridClickDoar", getLocalPlayer(), selectedDoar, amount)
end
end
end
end
addEventHandler ("onClientClick", root, enviar)

function OpenTrasf()
	if trans == false then
		showCursor (true)
		addEventHandler ("onClientRender", root, server)
		trans = true
		guiSetVisible (gridListDoar,true)
		guiSetVisible (editBoxDoar,true)
		guiSetVisible (coluna,true)
	else
		showCursor (false)
		removeEventHandler ("onClientRender", root,server)
		trans = false
		guiSetVisible (gridListDoar,false)
		guiSetVisible (editBoxDoar,false)
		guiSetVisible (colunaDoar,false)
	end
end
bindKey ("F10", "down", OpenTrasf)

function cursorPosition(x, y, w, h)
	if (not isCursorShowing()) then
		return false
	end
	local mx, my = getCursorPosition()
	local fullx, fully = guiGetScreenSize()
	cursorx, cursory = mx*fullx, my*fully
	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
		return true
	else
		return false
	end
end








esse é o client

 

Você deveria organizar este código, as suas output estão cheia de cores, por exemplo: o começo você usou a cor #HEX #FFFFFF sendo que você poderia ter definido 255, 255 , 255, assim evitando usar uma #hex de cara e utilizando os 2 parâmetros, desta forma você esta usando:

outputChatBox("#ffffff♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffO Jogador "..name.." #FFFFFFEnviou #00FF00R$ : "..amount, playerMoney, 255, 0, 0, true)

Poderia utilizar assim:

outputChatBox("♦ #FF7F00- #ffffff「 #FF7F00INFO #ffffff」 - #ffffffO Jogador "..name:gsub("#%x%x%x%x%x%x","").." #FFFFFFEnviou #00FF00R$ : "..amount, playerMoney, 255, 255, 255, true)

OBS: Fiz uma adição a mais, quando um jogador estiver com cor no nick e enviar dinheiro para alguém a cor vai ser a que você definiu e não a que o jogador usar no nick.

Siga o exemplo e faça nos demais outputChatBox

Edited by OverKILL
Link to comment
14 hours ago, Lord Henry said:

Você deve preencher a lista ao abri-la e limpá-la ao fechar a lista.

Dessa forma, no client:


local screenH, screenW = guiGetScreenSize()local x, y = (screenH/1366), (screenW/768)local font2 = dxCreateFont("gfx/Blix-Black.ttf", 19)local dxfont1_font = dxCreateFont("gfx/font.ttf", 11)local dxfont2_font = dxCreateFont("gfx/font.ttf", 10)gridListDoar = guiCreateGridList(495, 302, 176, 257, false)colunaDoar = guiGridListAddColumn(gridListDoar, "Jogadores", 0.9)guiGridListSetSelectionMode(gridListDoar, 2)guiSetAlpha(gridListDoar, 0.50)guiSetVisible(gridListDoar, false)editBoxDoar = guiCreateEdit(724, 343, 184, 23, tonumber("0"), false)guiSetVisible(editBoxDoar, false)guiSetAlpha(editBoxDoar, 0.50)guiEditSetMaxLength(editBoxDoar, 8) -- 85555function SetAll()	if (trans == true) then		if tonumber(guiGetText(editBoxDoar)) ~= nil then			totalDoar = tonumber(guiGetText(editBoxDoar))		end	endendsetTimer(SetAll, 50, 0)cor = {}totalDoar = 0trans = falsefunction server()	local dinheiro = getPlayerMoney(getLocalPlayer())	cor[1] = tocolor(255,255,255,255)	cor[2] = tocolor(0, 0, 0, 140)	if cursorPosition(x*948,y*259,x*962,y*288) then		cor[1] = tocolor(255,0,0,255)	end	if cursorPosition(x*774,y*376,x*91,y*27) then		cor[2] = tocolor(247, 142, 7, 200)	end	dxDrawRectangle(474, 265, 498, 323, tocolor(0, 0, 0, 226), false)	dxDrawRectangle(474, 265, 498, 26, tocolor(0, 0, 0, 187), false)	dxDrawText("Transferidor De Dinheiro", 473, 265, 972, 292, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)	dxDrawRectangle(x*774,y*376,x*91,y*27,cor[2], false)	dxDrawText("Transferir", 773, 376, 864, 402, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)	dxDrawText("Seu Dinheiro : "..dinheiro,x*756,y*413,x*1040,y*430, tocolor(255, 255, 255, 255), 1.00, dxfont2_font, "left", "top", false, false, false, false, false)    endfunction getPlayerFromPartialName(name)	local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil	if name then		for _, player in ipairs(getElementsByType("player")) do			local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()			if name_:find(name, 1, true) then				return player			end		end	endendfunction getGridlistPlayer()	local player = getPlayerFromName(guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1))	if (player) then		return player	endendfunction dxDrawXeets(absX, absY, sizeX, sizeY, color, ancho)	dxDrawRectangle(absX, absY, sizeX, ancho, color)	dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color)	dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color)	dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho * 2, color)endfunction onGridClick()	local player = getGridlistPlayer()	if (player == "" or player == nil) then		return	else		triggerServerEvent("onGridClick", getLocalPlayer(), player)	endendfunction convertNumber(number)	local formated = number	while true do		formated, k = string.gsub(formated, "^(-?%d+)(%d%d%d)", "%1,%2")		if (k == 0) then			break		end	end	return formatedendlocal componentes = {"armour", "wanted", "weapon", "money", "health", "clock", "breath", "ammo"}local tableSkins = {1, 2, 7, 9, 10, 11, 12, 14, 15, 16, 18, 28, 310, 311, 312}function enviar(_,state)	if trans == true then		if state == "down" then			if cursorPosition(x*774,y*376,x*91,y*27) then				selectedDoar = guiGridListGetItemText(gridListDoar, guiGridListGetSelectedItem(gridListDoar), 1)				amount = guiGetText(editBoxDoar)				triggerServerEvent("onGridClickDoar", getLocalPlayer(), selectedDoar, amount)			end		end	endendaddEventHandler ("onClientClick", root, enviar)function OpenTrasf()	if trans == false then -- Se o painel não está visível, então:		for _, player in ipairs(getElementsByType("player")) do -- Atualiza a lista, preenchendo com os jogadores online.			local rowDoar = guiGridListAddRow(gridListDoar)			guiGridListSetItemText(gridListDoar, rowDoar, colunaDoar, getPlayerName(player), false, false)			guiGridListSetItemColor(gridListDoar, rowDoar, colunaDoar, 255, 165, 0)		end		showCursor (true)		addEventHandler ("onClientRender", root, server)		trans = true		guiSetVisible (gridListDoar,true) -- Torna o painel visível.		guiSetVisible (editBoxDoar,true)		guiSetVisible (coluna,true)	else -- Se o painel está visível, então:		showCursor (false)		removeEventHandler ("onClientRender", root, server)		trans = false		guiGridListClear (gridListDoar) -- Limpa a lista, deixando ela vazia.		guiSetVisible (gridListDoar,false) -- Torna o painel invisível.		guiSetVisible (editBoxDoar,false)		guiSetVisible (colunaDoar,false)	endendbindKey ("F10", "down", OpenTrasf)function cursorPosition(x, y, w, h)	if (not isCursorShowing()) then		return false	end	local mx, my = getCursorPosition()	local fullx, fully = guiGetScreenSize()	cursorx, cursory = mx*fullx, my*fully	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then		return true	else		return false	endend

Não mexi no server.lua, mas já detectei problema de lógica na linha 27 em relação a linha 43. Além disso você pode usar acentos nos textos do outputChatBox.

tipo amigo, quando entra algum player, ele aparece no painel, mais quando ele sai do servidor, o nome dele ainda continua no painel, eu queria que tipo quando algum player saísse, o nome dele sumisse do pa

Link to comment
  • Other Languages Moderators
10 hours ago, #Horus said:

tipo amigo, quando entra algum player, ele aparece no painel, mais quando ele sai do servidor, o nome dele ainda continua no painel, eu queria que tipo quando algum player saísse, o nome dele sumisse do pa

Fecha o painel e abre de novo. E coloque uma condição que verifica se o jogador existe. Se não existir, envia um outputChatBox avisando que o player não foi encontrado.

Link to comment

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...