-
Posts
343 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Doongogar
-
bem, eu tava fazendo isso só pra estudo mesmo ja que mexi pouco com painel, mas realmente faz sentido, eu vou trocar essa função, mas a minha duvida permanece, e errada utilizar loop em client dessa forma, como exemplo, fazer um loop com todos os veiculos para destruir os que estão desocupados, por que em teoria os carros sumiriam somente para o localPlayer, ou estou errado? você disse que eu até consigo puxar todos os players utilizando o loop no client, porém não entendi se pode ocorrer algum erro por estar no client
-
Editbox aparecer por cima do dx com postgui no "true"
Doongogar replied to Doongogar's topic in Programação em Lua
local screenW, screenH = guiGetScreenSize() local states = false function DX_Global() dxDrawRectangle(screenW * 0.7331, screenH * 0.4033, screenW * 0.2081, screenH * 0.0356, tocolor(33, 33, 33, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.4389, screenW * 0.2081, screenH * 0.0044, tocolor(143, 9, 237, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267, tocolor(21, 21, 21, 255), false) -- Dinheiro dxDrawRectangle(screenW * 0.7331, screenH * 0.4700, screenW * 0.2081, screenH * 0.0044, tocolor(12, 12, 12, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.4744, screenW * 0.2081, screenH * 0.0267, tocolor(21, 21, 21, 255), false) -- Veiculo dxDrawRectangle(screenW * 0.7331, screenH * 0.5011, screenW * 0.2081, screenH * 0.0044, tocolor(12, 12, 12, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.5056, screenW * 0.2081, screenH * 0.0267, tocolor(21, 21, 21, 255), false) -- Puxar dxDrawRectangle(screenW * 0.7331, screenH * 0.5322, screenW * 0.2081, screenH * 0.0044, tocolor(12, 12, 12, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.5367, screenW * 0.2081, screenH * 0.0267, tocolor(21, 21, 21, 255), false) -- Mensagem dxDrawRectangle(screenW * 0.7331, screenH * 0.5633, screenW * 0.2081, screenH * 0.0044, tocolor(12, 12, 12, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.5678, screenW * 0.2081, screenH * 0.0267, tocolor(21, 21, 21, 255), false) -- Destruir Veiculos dxDrawRectangle(screenW * 0.7331, screenH * 0.5944, screenW * 0.2081, screenH * 0.0044, tocolor(12, 12, 12, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.5989, screenW * 0.2081, screenH * 0.0267, tocolor(21, 21, 21, 255), false) -- Players dxDrawText("Dinheiro:", screenW * 0.8219, screenH * 0.4500, screenW * 0.9550, screenH * 0.4744, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Veiculo:", screenW * 0.8244, screenH * 0.4811, screenW * 0.9575, screenH * 0.5056, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Puxar", screenW * 0.8275, screenH * 0.5122, screenW * 0.9606, screenH * 0.5367, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Destruir Todos os Veiculos", screenW * 0.7919, screenH * 0.5744, screenW * 0.9250, screenH * 0.5989, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Painel Global", 1261, 365, 1441, 399, tocolor(255, 255, 255, 255), 2.20, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Mensagem:", screenW * 0.8175, screenH * 0.5433, screenW * 0.9506, screenH * 0.5678, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Players", screenW * 0.8237, screenH * 0.6056, screenW * 0.9569, screenH * 0.6300, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawRectangle(screenW * 0.7331, screenH * 0.6300, screenW * 0.2081, screenH * 0.0356, tocolor(33, 33, 33, 255), false) dxDrawRectangle(screenW * 0.7331, screenH * 0.6256, screenW * 0.2081, screenH * 0.0044, tocolor(143, 9, 237, 255), false) end addEvent("Open:Global", true) addEventHandler("Open:Global", root, function() if states then removeEventHandler("onClientRender", root, DX_Global) else addEventHandler("onClientRender", root, DX_Global) end states = not states showCursor(states) end) function OpenPainel() if states == false then addEventHandler("onClientRender", root, DX_Global) states = true showCursor(true) else removeEventHandler("onClientRender", root, DX_Global) states = false showCursor(false) end end bindKey("num_5", "down", OpenPainel) bindKey("backspace", "down", function(key, keyState) if states and isCursorShowing() then removeEventHandler("onClientRender", root, DX_Global) showCursor(false) states = not states end end) addEventHandler("onClientRender", root, function() if isEventHandlerAdded("onClientRender", root, DX_Global) then if isCursorInPosition(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267) then dxDrawRectangle(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267, tocolor(80, 0, 135, 255), true) -- Dinheiro elseif isCursorInPosition(screenW * 0.7331, screenH * 0.4744, screenW * 0.2081, screenH * 0.0267) then dxDrawRectangle(screenW * 0.7331, screenH * 0.4744, screenW * 0.2081, screenH * 0.0267, tocolor(80, 0, 135, 255), true) -- Veiculo elseif isCursorInPosition(screenW * 0.7331, screenH * 0.5056, screenW * 0.2081, screenH * 0.0267) then dxDrawRectangle(screenW * 0.7331, screenH * 0.5056, screenW * 0.2081, screenH * 0.0267, tocolor(80, 0, 135, 255), true) -- Puxar elseif isCursorInPosition(screenW * 0.7331, screenH * 0.5367, screenW * 0.2081, screenH * 0.0267) then dxDrawRectangle(screenW * 0.7331, screenH * 0.5367, screenW * 0.2081, screenH * 0.0267, tocolor(80, 0, 135, 255), true) -- Mensagem elseif isCursorInPosition(screenW * 0.7331, screenH * 0.5678, screenW * 0.2081, screenH * 0.0267) then dxDrawRectangle(screenW * 0.7331, screenH * 0.5678, screenW * 0.2081, screenH * 0.0267, tocolor(80, 0, 135, 255), true) -- Destruir Veiculos elseif isCursorInPosition(screenW * 0.7331, screenH * 0.5989, screenW * 0.2081, screenH * 0.0267) then dxDrawRectangle(screenW * 0.7331, screenH * 0.5989, screenW * 0.2081, screenH * 0.0267, tocolor(80, 0, 135, 255), true) -- Players end end end) addEventHandler("onClientClick", root, function(button, state) if states and isCursorShowing() then if button == "left" and state == "down" then if isCursorInPosition(screenW * 0.7331, screenH * 0.5056, screenW * 0.2081, screenH * 0.0267) then -- Puxar triggerServerEvent("PuxarTodos", resourceRoot, localPlayer) elseif isCursorInPosition(screenW * 0.7331, screenH * 0.5678, screenW * 0.2081, screenH * 0.0267) then -- Destruir Veiculos triggerServerEvent("DestruirVeiculos", resourceRoot) elseif isCursorInPosition(screenW * 0.7331, screenH * 0.5989, screenW * 0.2081, screenH * 0.0267) then -- Players local contador = 0 for _, player in pairs(getElementsByType("player")) do if player then contador = contador + 1 end end outputChatBox("Existem: #00ff00"..contador.." #ffffffplayers online.", 255, 255, 255, true) elseif isCursorInPosition(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267) then -- Dinheiro local editBox = guiCreateEdit(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267, "", false) end end end end ) function isCursorInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end -
Mudar a cor do DX quando o mouse estiver em cima
Doongogar replied to Doongogar's topic in Programação em Lua
poise ta funcionando, nao sei talvez eu tenha esquecido de salvar ou de restartar o mod, obrigado a todos -
Editbox aparecer por cima do dx com postgui no "true"
Doongogar posted a topic in Programação em Lua
então eu tive que setar o postgui do da dx em true na hora que passa o mouse por cima para trocar o dx de cor porém agora que o dx esta em true quando a editbox e criada ela fica por tras do retangulo da dx, como eu sobre ponho a editbox sob o dx? -
eu posso utilizar um loop para puxar todos os players para meu jogador no client sem usar triggerServerEvento, ou isso pode ocasionar algum erro?
-
Player Clicka no Botão e Cria um Editbox
Doongogar replied to Doongogar's topic in Programação em Lua
mas o edit box ja tem a função de quando da enter executar determinada ação?, como eu faço isso, e como faço para quando o player fechar o painel tambem fechar a editbox?, e limitar os caracteres para somente numeros? -
Mudar a cor do DX quando o mouse estiver em cima
Doongogar replied to Doongogar's topic in Programação em Lua
bem, quando eu passo o mouse por cima nao acontece nada, nem da erros... -
Mudar a cor do DX quando o mouse estiver em cima
Doongogar replied to Doongogar's topic in Programação em Lua
eu quero que mude quando estiver dentro do retangulo e que volte ao normal ao sair do retangulo -
Mudar a cor do DX quando o mouse estiver em cima
Doongogar replied to Doongogar's topic in Programação em Lua
function render_DX() if isCursorOnElement(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267) then dxDrawRectangle(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267, tocolor(143, 9, 237, 255), false) -- Dinheiro else dxDrawRectangle(screenW * 0.7331, screenH * 0.4433, screenW * 0.2081, screenH * 0.0267, tocolor(21, 21, 21, 255), false) -- Dinheiro end end function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end porque não ta funcionando? -
AJUDA PELO AMOR DE DEUS
Doongogar replied to 10fps.net's topic in Ajudas relacionadas ao MTA:SA (Cliente/Servidor)
eu não sei se posso mandar o link... -
eu to fazendo um painel que quando o player clickar no botão criar uma editbox do lado do botão para que o player possa digitar numeros la e quando ele apertasse enter executar a ação de acordo com o numero que o player colocou la, a ação é o de menos queria saber só do enter e o de criar a editbox, porque nunca mexi com essas funções de gui antes
-
AJUDA PELO AMOR DE DEUS
Doongogar replied to 10fps.net's topic in Ajudas relacionadas ao MTA:SA (Cliente/Servidor)
se não me engano a 1.0 -
pode me indicar algum lugar para aprender lua
Doongogar replied to _gbbs.7's topic in Programação em Lua
acho que teria que criar outro topico com esse assunto para nao descomprir as regras do forum... -
Erro ao entra no mta
Doongogar replied to linux22a's topic in Ajudas relacionadas ao MTA:SA (Cliente/Servidor)
tenta reeinstalar o MTA -
AJUDA PELO AMOR DE DEUS
Doongogar replied to 10fps.net's topic in Ajudas relacionadas ao MTA:SA (Cliente/Servidor)
você pode estar baixando o gta na versão errada no executor do mta diz que tem que ser uma versão especifica(não lembro qual) ou o windows que você esta baixando esta vindo com configurações/drivers faltando ou pode ser outra coisa também... -
como eu faço para verificar se exitem carro num raio de 5 metros e se tiver mais de 1 apenas pegaro mais perto dentro desse raio de 5 metros?
-
brigado, o argumento posgui do dxdrawtext e o 13 mudei la certinho tambem tudo certo
-
pode me indicar algum lugar para aprender lua
Doongogar replied to _gbbs.7's topic in Programação em Lua
então se você ta focado so no MTA, eu acho uma boa olhar a wiki do proprio MTA lá explica bastante as funções e tal tambem existe um topico ensinando um pouco sobre lua: Informações Úteis Lua tem um canal no youtube que fez uma mini serie explicando o básico tambem: JP - MTA(introdução) uma boa também ler tópicos de problemas sendo resolvidos aqui no forum, mesmo que você não tenha um problema relacionado ao tópico em si, os moderadores explicão bem as soluções dos problemas -
MarkCoords = { {x, y, z}, {x, y, z}, {x, y, z}, } Markers = {} Markers = createMarker(MarkCoords[i][1], MarkCoords[i][2], MarkCoords[i][3], "cylinder", 1.1, 255, 255, 255, 100) cara não tenho certeza, mas acho que e mais ou menos assim
-
bem eu não estava ciente desse evento nem pensei nisso, como eu verifico se o elemento carro tem um "Owner"?
-
function guardarveiculo (player) local id = getElementData(player, "ID") local accName = getAccountName(getPlayerAccount(player)) local carro = getPedOccupiedVehicle(player) local nomecarro = getElementData(carro, "Nome") local donocarro = getElementData(carro, "Owner") local saude = getElementHealth(carro) local gasolina = getElementData(carro, "MD:Gasolina") or 50 local multas = getElementData(carro, "Multas") or 0 local r1, g1, b1, r2, g2, b2, r3, g3, b3 = getVehicleColor(carro, true) local result = dbPoll(dbQuery(db, "SELECT * FROM player WHERE Login = ? AND Veiculo = ?", accName, nomecarro), -1) if donocarro == id then if #result > 0 then if result[1]["Status"] == "Em Rua" then dbExec(db, "UPDATE player SET Status = ? WHERE Login = ? AND Veiculo = ?", "Guardado", accName, nomecarro) dbExec(db, "UPDATE player SET Saude = ? WHERE Login = ? AND Veiculo = ?", saude, accName, nomecarro) dbExec(db, "UPDATE player SET R = ? WHERE Login = ? AND Veiculo = ?", r1, accName, nomecarro) dbExec(db, "UPDATE player SET G = ? WHERE Login = ? AND Veiculo = ?", g1, accName, nomecarro) dbExec(db, "UPDATE player SET B = ? WHERE Login = ? AND Veiculo = ?", b1, accName, nomecarro) dbExec(db, "UPDATE player SET Gas = ? WHERE Login = ? AND Veiculo = ?", gasolina, accName, nomecarro) dbExec(db, "UPDATE player SET Multas = ? WHERE Login = ? AND Veiculo = ?", multas, accName, nomecarro) destroyElement(carro) exports._infobox:addNotification(player, "Você guardou seu veiculo!", "success") end end end end addEvent("H3>GuardarVeiculo", true) addEventHandler("H3>GuardarVeiculo", root, guardarveiculo) addCommandHandler("dv", function(playerSource,commandName,id) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup ("Staff")) then if (id) then local playerID = tonumber(id) if(playerID) then local targetPlayer, targetPlayerName = getPlayerID(playerID) if targetPlayer then local veh = getPedOccupiedVehicle(targetPlayer) if veh then destroyElement(veh) end end end end end end )