Jump to content

czarsight

Members
  • Posts

    29
  • Joined

  • Last visited

Recent Profile Visitors

286 profile views

czarsight's Achievements

Advanced Member

Advanced Member (8/54)

5

Reputation

  1. Utilize a seguinte função para arredondar o número. math.floor()
  2. Você vai precisar de: addEventHandler('OnPlayerWasted') spawnPlayer
  3. Sim. addEventHandler('onPlayerWasted', root, function() local x,y,z = getElementPosition(source) local skin = getElementModel(source) corpo = createPed(skin, x,y,z) setTimer(function() setPedAnimation(corpo, 'ped', 'ko_shot_front', -1, false, false, false, true) end, 100, 1) end)
  4. Com isso percebi que a animação só se aplica normalmente quando o ped já está criado. Eu estava tentando criar e ao mesmo tempo já setar a anim. Usei um setTimer para executar somente depois de alguns milissegundos e funcionou. Porém acabo tendo mais um problema, quando relogo no servidor ele volta a ficar em pé, ou até mesmo quando eu tomo distância e volto ao local.
  5. Não. Ele fica em pé. Se eu altero o parâmetro loop para true, até funciona porém ele fica caindo e levantando. Eu gostaria que ele ficasse deitado no chão.
  6. Sua suposição não falhou. . Valeu!
  7. Então, eu tentei colocar a animação em mim mesmo e deu certo. No entanto gostaria de colocar em um NPC.
  8. Estranho. Você tentou com o código acima? Vou tentar novamente.
  9. setPedAnimation(corpo, 'ped', 'ko_shot_front', -1, false, false, false, true) Tentei isso mas não funcionou, ele fica de pé.
  10. Como posso usar essas animações sem loop? Gostaria que o ped ficasse deitado no chão. Já tentei algo, mas tenho que ficar atualizando a todo instante com setPedAnimationProgress e setTimer. Acredito que essa não é a melhor forma de fazer isso.
  11. Alguém sabe o "ID" da animação para deitar no chão? Aquela quando você morre.
  12. local x,y,z = guiGetScreenSize() local largura, altura = 300, 30 --local time = getRealTime() function notificao() local msg = "Você ficou inconsciente..." local larguratexto = dxGetTextWidth(msg) local alturatexto = dxGetFontHeight() dxDrawRectangle(0, y/2-altura/2, largura, altura, tocolor(0,0,0,200)) dxDrawText(msg, largura/2-larguratexto/2, y/2-alturatexto/2, larguratexto, alturatexto, tocolor(255, 255, 255, 200)) end function notificao2() local msg = "Gravemente ferido" local larguratexto = dxGetTextWidth(msg) local alturatexto = dxGetFontHeight() dxDrawRectangle(0, y/2-altura/2, largura, altura, tocolor(0,0,0,200)) dxDrawText(msg, largura/2-larguratexto/2, y/2-alturatexto/2, larguratexto, alturatexto, tocolor(255, 100,100,255)) end function damaged(inimigo, inimigo_arma, corpo_parte, dano) local thePlayer = source local vidaPlayer = getElementHealth(thePlayer) if getElementData(thePlayer, "Inconsciente") ~= "true" and vidaPlayer <= 15 or dano >= 50 then cancelEvent() setElementData(thePlayer, "Inconsciente", "true") setElementFrozen(thePlayer, true) setElementHealth(thePlayer, 10) triggerServerEvent('animacao:Inconsciente', thePlayer) addEventHandler("onClientRender", root, notificao) playSoundFrontEnd (4) fadeCamera(false, 0) setTimer(function() fadeCamera(true, 10) removeEventHandler("onClientRender", root, notificao) end, 10000, 1) local random = math.random(0, 100) if random >= 0 and random <= 50 then setTimer(function() addEventHandler("onClientRender", root, notificao2) end, 15000, 1) setTimer(function() if getElementData(thePlayer, "Inconsciente") and getElementHealth(thePlayer) <= 15 then setElementData(thePlayer, "Inconsciente", "false") setElementHealth(thePlayer, 0) removeEventHandler("onClientRender", root, notificao2) end end, 50000, 1) else setTimer(function() removeEventHandler("onClientRender", root, notificao2) triggerServerEvent('animacao:Levantar', thePlayer) setElementData(thePlayer, "Inconsciente", "false") setElementFrozen(thePlayer, false) end, 15000, 1) end end end addEventHandler ("onClientPlayerDamage", getLocalPlayer(), damaged) Meu código funciona, porém estou tendo problemas com um Bug. Trata-se de um sistema de inconsciência que quando o player toma um dano considerável, ele não morre, perde a consciência e há uma probabilidade dele ficar no chão até a morte ou se levantar. No entanto, às vezes o player simplesmente quebra o fluxo e acaba levantando e morrendo ao mesmo tempo, como se estivesse entrado no IF e ELSE ao mesmo tempo e a "notificao2" não desaparece da tela. Me refiro a linha 43 por diante. Quem puder ajudar, ficarei grato.
  13. if getElementModel(jogador) == ID_SKIN then FicarInvisivel() end
×
×
  • Create New...