Jump to content

noonbr

Members
  • Posts

    83
  • Joined

  • Last visited

Everything posted by noonbr

  1. function pegarVeiculo(hitElement) if getElementType(hitElement) == "player" then local vehicle = getPedOccupiedVehicle(hitElement) if not vehicle then local account = getPlayerAccount(hitElement) local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName, aclGetGroup("PF")) then if isElement(veh[hitElement]) then destroyElement(veh[hitElement]) end veh[hitElement] = createVehicle(490, 1220.6763916016, -1398.3157958984, 13.185880661011) warpPedIntoVehicle(hitElement, veh[hitElement]) else outputChatBox("Você não é membro da PF.", hitElement, 255,0,0) end end end end Você redefiniu source no seu script, naturalmente em onMarkerHit, source é o próprio elemento marker, e o primeiro parâmetro da função anexada ao evento "onMarkerHit" é o player que de fato entra no marker. Nem sempre source é o player.
  2. Estava eu, com meu FileZilla aberto para criar scripts, uso o Visual Studio Code como editor de código, entrei no MTA e boom! Não consigo entrar no meu servidor de testes para jogar por causa desse erro, o que pode ser? Vídeo: https://youtu.be/AglhRmclHc0 Edit: posted in wrong language, sorry.
  3. noonbr

    Error CC23

    I'm trying log in several servers and with success, but in one server, occured cc23 error. Sorry my english. Pastebin: https://pastebin.mtasa.com/533250378
  4. Se tentou, mostre seu código para vermos o que podemos alterar e te ajudar para conseguir fazer funcionar. Enviar códigos prontos não é um trabalho feito pela maioria.
  5. Você pode verificar a configuração </min_mta_version> no META, ou se preferir, expor o código aqui para verificarmos um possível erro de código. Veja também o console assim que o recurso inicia e o /debugscript 2 ou 3.
  6. Funções: • addCommandHandler • dxDrawText • guiGetScreenSize Evento: • onClientRender
  7. Você pode nomear a função que está no evento "onClientRender", cancelá-lo com removeEventHandler e logo em seguida chamá-lo novamente. Não sei se é a melhor saída. function funcao_nomeada() for i, v in pairs(infos) do if i == tipo then local length = dxGetTextWidth(msg, 1, font) dxDrawRectangle(posRectangle[1][1], posRectangle[1][2], length + screenW/23, posRectangle[1][4], tocolor(10, 10, 10, 220), false) dxDrawImage(posIMG[1][1], posIMG[1][2], posIMG[1][3], posIMG[1][4], infos[i][4], 0, 0, 0, tocolor(infos[i][1], infos[i][2], infos[i][3], 255), false) dxDrawText(msg, posText[1][1], posText[1][2], posText[1][3], posText[1][4], tocolor(255, 255, 255, 255), 1.00, font, "left", "center", false, false, false, false, false) break end end end function adicionar_evento() removeEventHandler("onClientRender", root, funcao_nomeada) addEventHandler("onClientRender", root, funcao_nomeada) end Foi mal, não pensei em nada mais criativo.
  8. Queria fazer um sistema como de abrir caixas parecido com o do CS:GO, com as animações de roll. Tentei com easingFunctions em dgs e dx, não consegui por enquanto. Tem algum método melhor pra fazer?
  9. Tente: setTimer(function(source) setElementFrozen(source, false) toggleAllControls (source, true) end, 5000, 1, source)
  10. O que utilizo para poder colocar uma imagem upada no imgur dentro de um documento como um crachá no MTA? O player iria digitar /imagem <link> e a imagem irá aparecer no crachá dele.
  11. Como eu faço para remover uma informação (elementData, accountData, remover de uma tabela) do player daqui 30 dias?
  12. Consegui! Obrigado a todos que me ajudaram nisso, grato de verdade!
  13. Como faço para resgatar o serial do jogador pelo ID mesmo quando estiver offline? Tentei algumas alternativas e não funciona.
  14. Se ele tiver offline, consigo mesmo assim pegar o serial da conta através do ID?
  15. Quero criar um painel para banir o jogador offline, ou seja, o banimento seria aplicado quando ele digitasse /login, se o ID desse jogador tiver na tabela ele recebe o banimento, não estou conseguindo fazer isso. SERVER-SIDE: function getPlayerID(id) p = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then p = player break end end return p end banList = {} function banirPlayer(ID, Motivo, Tempo, tempoSelecionado) local playerV = getPlayerID(tonumber(ID)) if playerV then if tempoSelecionado == -1 then outputChatBox("Erro: você precisa informar um tipo de tempo.", source, 255,0,0, true) elseif tempoSelecionado == 0 then tempoMulti = 86400 elseif tempoSelecionado == 1 then tempoMulti = 3600 elseif tempoSelecionado == 2 then tempoMulti = 60 end tempoDeBan = Tempo*tempoMulti outputChatBox("[BVO]: "..getPlayerName(playerV).." foi banido por "..getPlayerName(source)..".", root, 255,0,0) outputChatBox(ID) outputChatBox(tostring(playerV)) -- banPlayer(playerV, false, false, true, getPlayerName(source), tostring(Motivo), tempoDeBan) else if tempoSelecionado == -1 then outputChatBox("Erro: você precisa informar um tipo de tempo.", source, 255,0,0, true) elseif tempoSelecionado == 0 then tempoMulti = 86400 elseif tempoSelecionado == 1 then tempoMulti = 3600 elseif tempoSelecionado == 2 then tempoMulti = 60 end tempoDeBan = Tempo*tempoMulti -- Adicionar as informações do ban para a tabela banList. end end addEvent("bannedPlayerOFF", true) addEventHandler("bannedPlayerOFF", getRootElement(), banirPlayer)
  16. Obrigado senhores, mas tem outro problema: o jogador pode alterar o nome quando quiser e pode colocar a cor do nome novamente, como faço para que quando ele tentar colocar a cor do nome, interceptá-lo?
  17. Quero remover a cor do nome dos jogadores que tentarem entrar no servidor, estou usando este código. addEventHandler("onPlayerJoin", getRootElement(), function() local nome = getPlayerName(source) local novoNome = removeHex(nome, 6) if (novoNome ~= nome) then setPlayerName(source, novoNome) end end Infelizmente não tive resultado satisfatório.
  18. Estou iniciando nos scripts e tenho muitas dúvidas de um principiante: activated = false function active() activated = true end addCommandHandler("act", active, false, false) A variável activated vai ser tornar true para todos os jogadores, ou somente para quem digitou o comando?
  19. Source, em comandos, NUNCA se refere a jogador. Você precisa preencher os parâmetros de forma correta. CommandHandler requer ao menos o argumento player em seu parâmetro, no seu caso, pode utilizar source. player playerSource, string commandName [, string arg1, string arg2, ... ]
  20. Você está tentando setá-lo variáveis, talvez isso seja incorreto. Existem duas funções setElementData (para setar a informação) e getElementData (para fazer a verificação), estas servem para você definir uma informação ao jogador e verificar se ele tem essa informação, respectivamente. Parece que é isso que você está querendo fazer. function verificar(player) emprego = setElementData(player, "ifood", true) end addCommandHandler("teste", verificar) function msgverificar(player) if (getElementData(player, "ifood")) then outputChatBox("oi") else outputChatBox("k") end end addCommandHandler("verificar", msgverificar)
  21. Então manos, eu estou fazendo um script de emprego para estudar Lua, etc. Cheguei ao final do script e estou me deparando com um problema: Ao término do emprego era para o jogador que está dentro do veículo ser teleportado para um lugar, porém não está acontecendo. Imagino o que seja mas não consigo resolver talvez por falta de conhecimento ainda, e por isso estou aqui pedindo uma ajuda. SERVER-SIDE function checkPointFinal(thePlayer) if getElementData(thePlayer, "checkpoint3") == true then destroyElement(getPedOccupiedVehicle(thePlayer)) setElementVisibleTo(blip2, thePlayer, false) setElementVisibleTo(blip3, thePlayer, false) setElementVisibleTo(blip4, thePlayer, false) setElementVisibleTo(blip5, thePlayer, false) setElementVisibleTo(job2, thePlayer, false) setElementVisibleTo(job3, thePlayer, false) setElementVisibleTo(job4, thePlayer, false) setElementVisibleTo(job5, thePlayer, false) setElementData(thePlayer, "checkpoint1", false) setElementData(thePlayer, "checkpoint2", false) setElementData(thePlayer, "checkpoint3", false) setElementData(thePlayer, "checkpoint4", false) setElementData(thePlayer, "jobIniciar", false) givePlayerMoney(thePlayer, 500) outputChatBox("Debitados R$500,00.", thePlayer, 0,250,0, true) outputChatBox("Digite /iniciar no marcador para fazer a corrida novamente.", thePlayer, 0,220,0, true) setElementPosition(thePlayer, 1714.3785400391,-1949.0649414063,14.1171875) end end addEventHandler("onMarkerHit", job5, checkPointFinal)
  22. Quero remover o DxDraw quando o comando for executado novamente. CLIENT-SIDE: function f_tabPanel() local screenW, screenH = guiGetScreenSize() linha = dxDrawLine(screenW * 0.3160, screenH * 0.3444, screenW * 0.7694, screenH * 0.3444, tocolor(41, 49, 213, 255), 1, false) end function f_executeTab() addEventHandler("onClientRender", root, f_tabPanel) end addCommandHandler("rectangle", f_executeTab) Estou estudando, por isso é só uma linha :v Obs.: tentei fazer o método de verificação básico. Não funciona porque onClientRender é como um loop, ou seja, quando ele verifica se a variável é igual a false ou nil ele ativa a linha, mas logo destrói ela. function f_tabPanel() local screenW, screenH = guiGetScreenSize() if s_aberto ~= true then linha = dxDrawLine(screenW * 0.3160, screenH * 0.3444, screenW * 0.7694, screenH * 0.3444, tocolor(41, 49, 213, 255), 1, false) s_aberto = true else destroyElement(linha) end end function f_executeTab() addEventHandler("onClientRender", root, f_tabPanel) end addCommandHandler("rectangle", f_executeTab) **Edit: Com GUI é tão simples, basta verificar guiGetVisible ** Edit: Como descobri o loop:
  23. accName deve ser: accName = getAccountName (getPlayerAccount (thePlayer))
  24. Procurei mas não encontrei onde posso achar todos os comandos de atalho do MTA, tipo /cv etc. Alguém pode me ajudar?
  25. O problema é que quando um dos valores é nil a mensagem não é enviada. function soma(thePlayer, commandName, um, dois) local num1 = tonumber(um) local num2 = tonumber(dois) local resultado = um + dois if commandName then if (num1 and num2) >= 0 then outputChatBox("A soma entre "..num1.. "e "..num2.." é igual a "..resultado..".", thePlayer, 255,255,255, true) elseif (num1 or num2) == nil then outputChatBox("Você precisa digitar os dois números para fazer a conta.", thePlayer) end end end addCommandHandler("somar", soma)
×
×
  • Create New...