Jump to content

[M]ister

Members
  • Posts

    444
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by [M]ister

  1. O evento onMarketHit já está anexado ao marker (arrumar1), o que torna a verificação isElementWithinMarker desnecessária.

    Eficiencia, a vida de veículos vai de 0-1000 e não 0-100 (como dos peds), e o seu consertar, na realidade tá consertando todos os veículos

  2. function damagersgDayZPlayer(attacker, damagens)
      	local victim = client
        outputChatBox("Ok",victim)
    	    outputChatBox("[INFO] Voce deu Dano de: "..damagens,attacker,255,0,0,true)
    end
    addEvent("damagersgDayZPlayer",true)
    addEventHandler("damagersgDayZPlayer",getRootElement(),damagersgDayZPlayer)

    victim = player que sofreu dano
    attacker = player que causou dano

     

  3. 2 hours ago, #DeltaSCR said:

    Ai pra exibir a tela de mensagens pros dois players, no onClientRender, eu teria que colocar o argumento do player obtido na Grid?

    
    function createCEGUI()
    	theWindow = guiCreateWindow(0.27, 0.23, 0.45, 0.53, "Companhia Telefonica TSB", true)
    	guiWindowSetMovable(theWindow, false)
    	guiWindowSetSizable(theWindow, false)
    	--// EDITS
    	memoChat = guiCreateMemo(0.02, 0.08, 0.96, 0.78, "\n", true, theWindow)
    	editText = guiCreateEdit(0.02, 0.89, 0.97, 0.08, "Digite sua mensagem aqui...", true, theWindow)
    end
    
    function DeltaSCR_Click(button, state, absoluteX, absoluteY)
    	if button ~= "left" then
    		return
    	end
    	if state == "down" then
    		local namePlayer = guiGridListGetItemText(playersList, row, column)
    		local thePlayer = getPlayerFromName(namePlayer)
    	end
    end
    addEventHandler("onClientGUIClick", playerList, DeltaSCR_Click, false)
    

     

    Você não usou guiGridListGetSelectedItem para identificar qual linha/coluna foi selecionada.

    Dica: Tente fazer tudo com gui que é mais fácil, e se der certo, você muda e coloca algumas frescuras de dx.

    • Haha 1
  4. On 30/05/2019 at 13:10, brunob22 said:

    resource admin, complexa? paida kkkkk 

    "paida" = piada ??

    Sim, complexo! Errado quem pensa o contrário... o código ali é Lua, não tem nada de outro mundo, mas a grandeza da codificação/ligações já o torna complexo.

    6 hours ago, Jonas^ said:

    Sim claro que é complexo, concordo totalmente com você, porém pelo que vi aqui os resources que ele posta na página dele, ele tem capacidade pra desmembrar esse sistema de admin todo. não entendi o porque da dificuldade, quero entender como ele mostra resources mais complexas que um simples sistema de chat e não consegue nem começar a parte mais básica.

    Ai já não sei, sugeri com base no perfil/dúvida.
    Na real tem muita gente que fica criando = (copiando/editando) uns painéis por ai, mas mal sabem lógica de programação... então se for o caso, não quer dizer nada.

  5. Sim, é que ele duplicava os resources, porém os eventos e triggers como estavam iriam interferir em todos, ai se ele muda-se a música em um, ela alterava em outro também.
    É, o melhor seria adaptar o mesmo resource para suportar essas variações.

  6. Teste lá, duplique os resources (não é o melhor jeito) e mude as posições, acho que agora os eventos/triggers de um não influenciarão no outro.

    Audio = {}
    
    local abrirpainel = createMarker(299.12530517578, -1816.7014160156, 4.3,"cylinder", 2, 0, 255, 0, 100) --- PRAIA
    function mostrarpainel(thePlayer)
        triggerClientEvent(thePlayer, "Dj", resourceRoot )
    end
    addEventHandler("onMarkerHit", abrirpainel, mostrarpainel)
    
    addEvent ( "CrioDJ", true )
    addEventHandler ( "CrioDJ", root, function ( Link ) 
        if ( Link ) then
            if ( isElement ( Audio [ client ] ) ) then
                local x, y, z = getElementPosition ( Audio [ client ] ) 
                destroyElement ( Audio [ client ] )
            end
            local x, y, z = getElementPosition ( client )
            Audio [ client ] = createMarker(x-0.5, y+0.5, z - 1,"cylinder", 1, 0, 255, 255, 0)
            triggerClientEvent ( root, "CrioDJ", resourceRoot, client, Link )
            triggerClientEvent(root, "Djay", resourceRoot, getPlayerName( client ) )
        end
    end)
    
    addEvent ( "VolumealteradoDJ", true ) 
    addEventHandler ( "VolumealteradoDJ", root, function ( to )
        triggerClientEvent ( root, "VolumeDJ", resourceRoot, client, to )
    end )
    
    addEvent ( "DestruiDJ", true )
    addEventHandler ( "DestruiDJ", root, function ( )
        if ( isElement ( Audio [ client ] ) ) then
            destroyElement ( Audio [ client ] )
            triggerClientEvent ( root, "DestruiDJ", resourceRoot, client )
        end
    end )
    local screenW,screenH = guiGetScreenSize()
    local resW, resH = 1280, 1024
    local x, y =  (screenW/resW), (screenH/resH)
    local root = getRootElement()
    local volume_menos = 0.1
    local volume_mais = 0.1
    
    stream = {}
    dj = false
    animON = false
    info = false
    
    addEventHandler("onClientResourceStart", resourceRoot,
        function()
            Link = guiCreateEdit(x*411, y*374, x*408, y*46, "Cole o link aqui...", false)    
            guiSetVisible ( Link, false )
        end
    )
    
    function dx ()
        local alpha,alpha2,alpha3= interpolateBetween(0, 0, 0, 255, 136, 200, ((getTickCount() - djt) / 2000), "Linear")
        local meta = getSoundMetaTags(stream)
        
        dxDrawRectangle(x*346, y*198, x*537, y*550, tocolor(0, 0, 0, alpha2), false)
        dxDrawRectangle(x*346, y*198, x*537, y*74, tocolor(5, 239, 5, alpha2), false)
        dxDrawText("PAINEL DJ", x*500, y*220, x*732, y*252, tocolor(255, 255, 255, alpha), x*2.00, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("X", x*831, y*220, x*864, y*252, tocolor(255, 255, 255, alpha), 2.00, "default-bold", "center", "center", false, false, false, false, false)    
        
        if ismouseinposition (x*411, y*435, x*88, y*35) then
        dxDrawRectangle(x*411, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false)
        else
        dxDrawRectangle(x*411, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false)
        end
        
        if ismouseinposition (x*518, y*435, x*88, y*35) then
        dxDrawRectangle(x*518, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false)
        else
        dxDrawRectangle(x*518, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false)
        end
        
        if ismouseinposition (x*624, y*435, x*88, y*35) then
        dxDrawRectangle(x*624, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false)
        else
        dxDrawRectangle(x*624, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false)
        end    
        
        if ismouseinposition (x*731, y*435, x*88, y*35) then
        dxDrawRectangle(x*731, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false)
        else
        dxDrawRectangle(x*731, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false)    
        end
        
        dxDrawText("Volume -", x*411, y*435, x*499, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Volume +", x*518, y*435, x*606, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Tocar", x*624, y*435, x*712, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Parar", x*731, y*435, x*819, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawRectangle(x*411, y*496, x*408, y*230, tocolor(0, 0, 0, alpha2), false)
        
        if not meta then
        dxDrawText("Duração: N/A", x*411, y*336, x*615, y*364, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false)
        dxDrawText("Tocando agora: N/A", x*411, y*283, x*819, y*308, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false)    
        dxDrawText("Adicionado por: N/A", x*411, y*308, x*615, y*336, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false)        
        dxDrawText("Volume: 00%", x*615, y*336, x*819, y*364, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false)    
        end
        
    end
    
    function dx_2 ()
        local meta = getSoundMetaTags(stream)
        if not meta then return end
        
        local duracao_musica = getSoundLength(stream)
        local anim = getSoundFFTData(stream, 8192, 30)
        local titulo = meta.title or meta.stream_title or "N/A"         
        local msecs = duracao_musica*1000
        local secs = msecs/1000
        local duracao = string.format("%.2d:%.2d:%.2d",secs/(60*60),secs/60%60,secs%60)
        local volume = math.round ( getSoundVolume ( stream ), 2 )
        
        if animON == true then
        dxDrawText("Tocando agora: "..titulo, x*411, y*283, x*819, y*308, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", true, false, false, false, false)    
        dxDrawText("Duração: "..duracao, x*411, y*336, x*615, y*364, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", false, false, false, false, false)
        dxDrawText("Adicionado por: "..nome, x*411, y*308, x*615, y*336, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", false, false, false, true, false)                
        dxDrawText("Volume: "..math.floor ( volume * 100 ).."%", x*615, y*336, x*819, y*364, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", false, false, false, false, false)
        
        for i,v in pairs(anim) do
        tamanho = math.round((v*320),0)>100 and 100 or math.round((v*320),0)
        largura = 13
        dxDrawRectangle(x*418+(i*x*largura), y*720, x*largura-1, y*2*tamanho*-1, tocolor(5, 239, 5, 136), false)
        end
        end
    end        
    
    -------------------------------- PLAYSOUND 3D
    addEvent ( "DestruiDJ", true )
    addEventHandler ( "DestruiDJ", resourceRoot, function ( who ) 
        if ( isElement ( stream ) ) then 
            destroyElement ( stream  ) 
        end
    end )
    
    addEvent ( "VolumeDJ", true )
    addEventHandler ( "VolumeDJ", resourceRoot, function ( who, vol ) 
        if ( isElement ( stream ) ) then
            setSoundVolume ( stream, tonumber ( vol ) )
        end
    end )
    
    addEvent ( "CrioDJ", true )
    addEventHandler ( "CrioDJ", resourceRoot, function ( who, Link, isCar )
        if ( isElement ( stream ) ) then destroyElement ( stream ) end
        local x, y, z = getElementPosition ( who )
        stream  = playSound3D ( Link, x, y, z, true )
        setSoundVolume ( stream, 1 )
        setSoundMinDistance (stream, 50 )
        setSoundMaxDistance ( stream, 50 )
    end )
    
    function tocar(_,estado)
    if dj == true then
    if estado == "down" then
    if ismouseinposition(x*624, y*435, x*88, y*35) then
    setTimer ( function()
    local meta = getSoundMetaTags(stream)
    local duracao_musica = getSoundLength(stream)
    local titulo = meta.title or meta.stream_title or "N/A"         
    local msecs = duracao_musica*1000
    local secs = msecs/1000
    local duracao = string.format("%.2d:%.2d:%.2d",secs/(60*60),secs/60%60,secs%60)
    outputChatBox ( "#FFFFFF==> #00FF00Música#FFFFFF: "..titulo.." = #00FF00Duração: #FFFFFF"..duracao..".", 255, 255, 255 ,true)
    end, 2000, 1 )
    triggerServerEvent ( "CrioDJ", resourceRoot, guiGetText ( Link ))
    addEventHandler("onClientRender",root,dx_2)
    playSoundFrontEnd(1)
    isSound = true
    animON = true
    end
    end
    end
    end
    addEventHandler("onClientClick",root,tocar)
    
    function Parar(_,estado)
    if dj == true then
    if estado == "down" then
    if ismouseinposition(x*731, y*435, x*88, y*35) then 
    triggerServerEvent ( "DestruiDJ", resourceRoot )
    outputChatBox ( "#FFFFFF==> #00FF00Você cancelo a repodrução da musica atual.", 255, 255, 255 ,true)
    removeEventHandler ("onClientRender", root, dx_2)
    playSoundFrontEnd(2)
    isSound = false
    animON = false
    end
    end
    end
    end
    addEventHandler("onClientClick",root,Parar)
    
    function Volumemenos(_,estado)
    if dj == true then
    if estado == "down" then
    if ismouseinposition(x*411, y*435, x*88, y*35) then 
    playSoundFrontEnd(3)
    if ( isSound ) then
    local volume = math.round ( getSoundVolume ( stream ) - volume_menos, 2 )
    if ( volume > 0.0 ) then
    triggerServerEvent ( "VolumealteradoDJ", resourceRoot, volume )
    --outputChatBox ( "#FFFFFF==> #00FF00Volume alterado para "..math.floor ( volume * 100 ).."%.", 0, 255, 255 ,true)
    else
    outputChatBox ( "#FFFFFF==> #00FF00DJ está no volume minimo.", 0, 255, 255 ,true)
    end
    end
    end
    end
    end
    end
    addEventHandler("onClientClick",root,Volumemenos)
    
    function Volumemais(_,estado)
    if dj == true then
    if estado == "down" then
    if ismouseinposition(x*518, y*435, x*88, y*35) then 
    playSoundFrontEnd(3)
    if ( isSound ) then
    local volume = math.round ( getSoundVolume ( stream ) + volume_mais, 2 )
    if ( volume < 1.1 ) then
    triggerServerEvent ( "VolumealteradoDJ", resourceRoot, volume )
    --outputChatBox ( "#FFFFFF==> #00FF00Volume alterado para "..math.floor ( volume * 100 ).."%.", 0, 255, 255 ,true)
    else
    outputChatBox ( "#FFFFFF==> #00FF00DJ está no volume maximo.", 0, 255, 255 ,true)
    end
    end
    end
    end
    end
    end
    addEventHandler("onClientClick",root,Volumemais)
    
    function fechar(_,estado)
    if dj == true then
    if estado == "down" then
    if ismouseinposition(x*831, y*220, x*53, y*37) then 
    playSoundFrontEnd(5)
    showCursor(false)
    removeEventHandler("onClientRender",root,dx)
    removeEventHandler ("onClientRender", root, dx_2)
    guiSetVisible ( Link, false )
    dj = false
    animON = false
    end
    end
    end
    end
    addEventHandler("onClientClick",root,fechar)
    
    function dj_add (djay_painel)
    nome=djay_painel;
    end
    addEvent ("Djay",true) 
    addEventHandler ("Djay",resourceRoot,dj_add)
    
    function mostrarpainelDJ ()
    if dj == false then
    addEventHandler ("onClientRender", root, dx)
    djt = getTickCount()
    guiSetVisible ( Link, true )
    addEventHandler("onClientRender",root,dx_2)
    animON = true
    showCursor (true)
    dj = true
    else
    removeEventHandler ("onClientRender", root, dx)
    guiSetVisible ( Link, false )
    showCursor (false)
    dj = false
    animON = false
    end
    end
    addEvent ("Dj",true) 
    addEventHandler ("Dj",resourceRoot,mostrarpainelDJ)
    
    function math.round(number, decimals, method)
        decimals = decimals or 0
        local factor = 10 ^ decimals
        if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
        else return tonumber(("%."..decimals.."f"):format(number)) end
    end
    
    function ismouseinposition ( 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 )
        if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
            return true
        else
            return false
    end
    end

     

    • Like 1
  7. Sim, eu também não sabia o real significado, só consegui pegar a referência com base no time de futebol Portuguesa que também é conhecida como Lusa, e nas minha aulas de Língua Portuguesa, sobre países lusófonos.

  8. 22 minutes ago, MaligNos said:
    
    if not (alvo) then
    	return outputChatBox("[Aviso] Jogador ' "..alvo.name.." ' não encontrado!", player,255,255,255)
    end

     

    Na realidade seria:

    if not (alvo) then
    	return outputChatBox("[Aviso] Jogador ' "..playerid.." ' não encontrado!", player,255,255,255)
    end

    Mas se o seu "alvo" existe, nem entraria nessa verificação. Então não é a causa de não funcionar.

  9. Certo, não apresenta mais erros, mas você está agindo de acordo com as verificações do script ?

    • Está no grupo da ACL ComandosCorporacoes ?
    • Essa função exportada de ID realmente funciona e retorna um player ?
    • Está digitando um ID existente ? Ex: /arrastar 1
    • O player alvo possui o elementdata “Algemado” ?
    • Você estava a uma distância menor ou igual a 6 unidades do player alvo ?
    • Você estava em um veículo quando usou o comando ?
  10. 43 minutes ago, Renazz said:

    não apresenta nenhum erro. 

    Como chegou a tal conclusão ? certamente se tivesse usado o /debugscript 3 diversos erros apareceriam, você precisa executar o trecho para que os erros aparecessem: /arrastar

    Tem um trecho POO incorreto, troque por:

    if not (alvo) then
    	return outputChatBox("[Aviso] Jogador ' "..alvo.name.." ' não encontrado!", player,255,255,255)
    end

     

  11. function seguirComando(player, commandName, playerid)
    	if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount (player)), aclGetGroup ("ComandosCorporacoes")) then 
    
    		if not (playerid) then return end
    		
    		local alvo = exports["ID_System"]:getPlayerID(tonumber(playerid))
    		if not (alvo) then
    			return player:outputChatBox("[Aviso] Jogador ' "..alvo.name.." ' não encontrado!", player,255,255,255)
    		end
    		
    		if getElementData(alvo,"Algemado") then
    			alvox,alvoy,alvoz = getElementPosition (alvo)
    			playerx,playery,playerz = getElementPosition (player)
    			local dist = getDistanceBetweenPoints3D(alvox,alvoy,alvoz,playerx,playery,playerz)
    			if (dist <=5) then
    				local vehicle = getPedOccupiedVehicle(player)
    				if vehicle then
    					warpPedIntoVehicle (alvo , vehicle , 2)
    				end
    			end
    		end
    		
    	end
    end
    addCommandHandler("arrastar", seguirComando)

     

  12. Se eu fosse você, adaptaria o script para ao invés de utilizar MySQL usar o SQLite do MTA

    Troque sua primeira linha por isso:

    dbhandler = dbConnect ("sqlite", "whitelist.db")

    Em relação ao seu arquivo database.sql, provavelmente existe a criação da tabela do whitelist, copie o código dele e rode com dbExec

    Exemplo:

    dbExec (dbhandler, "CREATE TABLE IF NOT EXISTS WHITELIST …")

     

    @LeeaF você deveria ter criado um tópico novo com sua dúvida, pois o assunto não se relaciona com o tutorial deste tópico.

  13. Então executará em outros horários além daquele 17:08 ? É possível também, mas creio que a codificação não será tão trivial quanto para apenas um horário definido. Pensando rapidamente aqui, eu criaria uma tabela com tais horários, percorreria e obteria o getTimestamp* para cada um deles, e com isso faria o cálculo dos milissegundos para criar os setTimers (cada um para um horário).

    *O trabalho seria verificar se o horário que você ativou o script já é maior, menor ou igual à tais horários definidos, e talvez até precisar verificar quantos dias possui no mês, se o ano é bissexto, para poder mandar valores válidos ao getTimestamp.

    Caso não queira trabalho, aumente o tempo do seu setTimer de 1000ms, para 60000ms, mas apenas se a verificação dos horários não envolver segundos.

    • Like 1
  14. 6 hours ago, LucasMTA said:

    Mais tipo meu guiGetScreenSize não funciona no server-side

    eu to querendo fazer uma barra de progresso taligado mano

    Painéis devem ser criados no lado cliente, o interpolateBetween pode ser utilizado em ambos pois não é uma função exclusivamente para fazer efeitos em painéis, basicamente a função serve para variar um valor x até um valor y. Ou seja, não vai ter como criar sua barra de progresso no lado servidor.

  15. 37 minutes ago, MainSCR said:

    No client-side retornaria a hora do client né?

    Exato!

    Você quer executar uma ação quando for x horas ? Caso sim, mantenha o código no lado servidor, mas ao invés de ficar verificando a hora todo instante, basta calcular os milissegundos que possuem do momento que ativar o script até a hora/dia desejado, ai só criar o setTimer com tal valor.

    Talvez ajude: https://forum.multitheftauto.com/topic/76253-usando-timestamp/

     

    • Like 1
  16. Como ficou a precedência de execução ? Declarou o script “malicioso” antes do outro no meta ?

    Cada resource fica em um “ambiente”, sendo assim, se tu usar o _G, ele não vai pegar funções/variáveis criadas por outros resources.

  17. Muito provavelmente getPlayerID recebe como argumento o player e retorna o ID, e ali você está passando a variável playerid, que inclusive nem foi declarada... era apenas trocar por thePlayer:

    local playerID = exports["[PRS]ID_System"]:getPlayerID(thePlayer)

    Mas como já mencionado pelo @Jonas^, como seu sistema de ID já armazena com setElementData, a chamada na função exportada pode ser evitada.

    • Thanks 1
×
×
  • Create New...