Deniel Posted September 26, 2019 Share Posted September 26, 2019 Server.Lua 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 = exports.dinheirosujo:getPlayerDirty(source) if tonumber(amount) >= 0 then if tonumber(amount) <= dinheiro then playerMoney = getPlayerFromName(selectedDoar) if playerMoney ~= false then exports.dinheirosujo:givePlayerDirty(playerMoney, amount) exports.dinheirosujo:takePlayerDirty(source, amount) name = getPlayerName(source) outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffVoce Enviou #00ff00R$ : " .. amount .. " #FFFFFFPara O Jogador "..selectedDoar, source, 255, 255, 255, true) outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffO Jogador "..name.." #FFFFFFEnviou #00FF00R$ : "..amount, playerMoney, 255, 0, 0, true) else outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffSelecione Um Jogador", source, 255, 0, 0, true) end else outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffVoce Nao Tem Dinheiro Suficiente", source, 255, 0, 0, true) end else outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffUtilize Valores De 1 A 10000", source, 255, 0, 0, true) end end addEvent("onGridClickDoar", true) addEventHandler("onGridClickDoar", getRootElement(), onGridClickDoar) Client.Lua 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, 0, 255, 145) 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 = exports.dinheirosujo:getPlayerDirty(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("Enviar Dinheiro Sujo", 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("Enviar", 773, 376, 864, 402, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Dinheiro SUJO : "..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, 0, 255, 145) 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 ("F6", "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 Como eu disse está tudo funcionando só que quando um player troca o nome dele em jogo não aparece no painel, como estou aprendendo ainda não sei se isso é em relação ao getPlayerFromPartialName e getPlayerName. Link to comment
DNL291 Posted September 29, 2019 Share Posted September 29, 2019 Chame refreshDoar() no evento onClientPlayerChangeNick. Você também pode colocar um timer para atualizar, atualizar quando abrir o painel ou apenas no evento onClientPlayerQuit talvez já será o suficiente. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now