Jump to content

SOU NOVO NA PROGRAMAÇÃO E ESTOU COM UMA DIVIDA ALGUME PODERIA ME AJUDAR


Recommended Posts

EU TENHO UM SISTEMA DE CAIR NO CHÃO E CURAR COM A MACA MAIS DPS QUE A PESSOA CAI ELA PODE SER FINALIZADA EU QUERIA CRIAR UMA SCRIPT PRA QUANDO A PESSOA CHEGAR A 10 DE VIDA ELA NN MORRER ATE O TEMPO ACABAR AGUEM SABE COMO EU POSSO FAZER ESSA SCRIPT 

SOU BEM NOVATO NA SCRIPT 

Edited by JULIUUUUUUUUU
Link to comment
1 hour ago, JULIUUUUUUUUU said:

EU TENHO UM SISTEMA DE CAIR NO CHÃO E CURAR COM A MACA MAIS DPS QUE A PESSOA CAI ELA PODE SER FINALIZADA EU QUERIA CRIAR UMA SCRIPT PRA QUANDO A PESSOA CHEGAR A 10 DE VIDA ELA NN MORRER ATE O TEMPO ACABAR AGUEM SABE COMO EU POSSO FAZER ESSA SCRIPT 

SOU BEM NOVATO NA SCRIPT 

Mostre seu código para podermos ajuda-lo!

 

Possivelmente sera usado:

 onPlayerDamage

setElementHealth

Link to comment

Opa calma ai eu mandei de forma errada

KKKKK Estou com dificuldade pra poder enviar eu tenho que copiar e colar

hpMin = 10
Tempo = {}
ColMedic = {}

Tempo2 = {}
Tempo3 = {}
function ChecarVida()
    for i, player in pairs (getElementsByType("player")) do
        if not getElementData(player, "PlayerCaido") then
            local conta = getAccountName(getPlayerAccount(player))
                if getElementHealth(player) >= 1 then
                    if getElementHealth(player) <= hpMin then 
                        removePedFromVehicle(player)
                        setElementData(player, "PlayerCaido", true)
                        setElementFrozen(player, true)
                        setPedAnimation(player, "CRACK", "crckdeth2", -1, false, true, false)
                        setTimer(function()
                            if getElementData(player, "PlayerCaido") then    
                                killPlayer(player)
                            end
                        end, 240000, 1)
                end
            end
        else
            setPedAnimation(player, "CRACK", "crckdeth2", -1, false, true, false)
        end
    end
end
setTimer(ChecarVida, 200, 0)

function playerDamage_text ( attacker, loss )
     if not (getElementData(source, "attackerD")) then
         setElementData(source, "attackerD", "(Desconhecido)")
         return
     end
         if attacker then
             if (getElementData(source, "attackerD") == getElementData(attacker, "char:name")) then
             else
             setElementData(source, "attackerD", getElementData(attacker, "char:name"))
         end
    end
end
--addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text )

--addEvent("OnDano", true)
--addEventHandler("OnDano", getRootElement(), ChecarVida)

function ChecarVidaA()
    for i, player in pairs (getElementsByType("player")) do
        
        if  getElementData(player, "PlayerCaido") then
            if getElementHealth(player) > 31 then
                --if not getElementData(player, "loggedin") then return end
                setElementData(player, "PlayerCaido", false)
                setPedAnimation(player, false)
                setElementFrozen(player, false )
                --setPlayerMuted(player, false)
                toggleAllControls ( player, true )

                setTimer ( setPedAnimation, 100, 1, player,  "CRACK", "crckdeth2",-1, 5000, false, false, false)
                setTimer ( setPedAnimation, 250, 1, player, nil)

            end
        end
    end
end
setTimer(ChecarVidaA, 200, 0)

function SetarCaidoComHS(attacker)
    player = source
    if not getElementData(player, "PlayerCaido") then
        removePedFromVehicle(player)
        setElementHealth(player, 10)
        setElementData(player, "PlayerCaido", true)
        --setPedAnimation(player, "SWEET", "Sweet_injuredloop", 1000, false, false, false, true)
        setPedAnimation( player, "CRACK", "crckidle2", -1, false, false, false, true)
        exports.btc_admin:outputAdminMessage("#7cc576" .. getPlayerName(player) .. " (" .. getElementData(player, "playerid") .. ") #ffffffAcabou de ser derrubado pelo "..getPlayerName(attacker).."")
        exports.logs:logMessage("[LOG - MORTES] " .. getPlayerName(player) .. " (" .. getElementData(player, "playerid") .. ") Acabou de ser derrubado por "..(getElementData(player, "attackerD") or "(Desconhecido)"), 2)
        setTimer(function()
            if getElementData(player, "PlayerCaido") then    
                killPlayer(player)
            end
        end, 240000, 1)
    end
end
addEvent("OnHS", true)
addEventHandler("OnHS", getRootElement(), SetarCaidoComHS)

local zone = createColCuboid(1161.37207, -1376.58325, 13.98417, 9.4462890625, 38.906982421875, 3.9)

function ticketPlayer(thePlayer)
 if not (getElementData(thePlayer, "maca:area") == true) then outputChatBox("#FF0000[AVISO]#FFFFFF: O /curar só é utilizavel do lado da maca!.", thePlayer, 255,255,255, true) return end
            if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ("Samu")) then
            local posX1, posY1, posZ1 = getElementPosition(thePlayer)
            for _, player in ipairs(getElementsByType("player")) do
                local posX2, posY2, posZ2 = getElementPosition(player)
                local distance = getDistanceBetweenPoints3D(posX1, posY1, posZ1, posX2, posY2, posZ2)
                if distance <= 1 then
                    if player ~= thePlayer then
                        --if isPedDead(player) then outputChatBox("#bebebeEsta pessoa foi morta, não é mais possivel cura-la!",thePlayer,255,255,255,true) return end
                        local health = getElementHealth(player)
                        if health >= 31 then outputChatBox("#bebebeVocê só pode ajudar pessoas caidas!",thePlayer,255,255,255,true) return end
                        setPedAnimation( thePlayer, "MEDIC", "CPR", 4500, true, false, false, false)
                        --randomLife(thePlayer, player)
                        setTimer ( function()
                            setTimer ( setPedAnimation, 100, 1, player,  "GHANDS", "gsign2", 5000, false, false, false)
                            setTimer ( setPedAnimation, 250, 1, player, nil)

                            --setElementHealth ( player, 35 )

                            setElementHealth ( player, 39 )
                            setPedAnimation(player, false)
                            toggleAllControls ( player, true )
                            setElementFrozen( player, false )
                            setElementData(player,"PlayerCaido",false)


                            --takeChar (player)
                        end, 4500, 1 )
                return
                end
            end
        end
    end
end
addCommandHandler("curar", ticketPlayer, false, false)


function takeChar (thePlayer)
    --if isPedDead(thePlayer) then return end
    setTimer ( setPedAnimation, 100, 1, thePlayer,  "GHANDS", "gsign2", 5000, false, false, false)
    setTimer ( setPedAnimation, 250, 1, thePlayer, nil)
    setElementHealth ( thePlayer, 39 )
    setPedAnimation(thePlayer, false)
    toggleAllControls ( thePlayer, true )
    setElementFrozen( thePlayer, false )
    setElementData(thePlayer,"PlayerCaido",false)
end

function reanimar(thePlayer)
    if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ("Samu")) then
    local posX1, posY1, posZ1 = getElementPosition(thePlayer)
    for _, player in ipairs(getElementsByType("player")) do
        local posX2, posY2, posZ2 = getElementPosition(player)
        local distance = getDistanceBetweenPoints3D(posX1, posY1, posZ1, posX2, posY2, posZ2)
        if distance <= 2 then
            if player ~= thePlayer then
                if not getElementData(thePlayer, "char:animando") then

                local health = getElementHealth(player)
                if health >= 98 then outputChatBox("#bebebeVocê só pode ajudar pessoas tristes!",thePlayer,255,255,255,true) return end

                --if not getElementData(player, "PlayerAnimo") then outputChatBox("#bebebeVocê só pode ajudar pessoas desanimadas!",thePlayer,255,255,255,true) return end

                setElementData(thePlayer, "char:animando", true)

                triggerClientEvent(thePlayer,"JoinQuitGtaV:notifications", thePlayer,"animo", "Faça o melhor RP possivel com o paciente, seja criativo e mostre seu potencial, você será notificado quando o paciente for reanimado. ( duração: 1 minuto )", 50 )
                triggerClientEvent(player,"JoinQuitGtaV:notifications", player,"animo", "Faça o melhor RP possivel com o medico, seja criativo e mostre seu potencial, você será notificado quando terminar. ( duração: 1 minuto )", 50 )


                setPedAnimation( thePlayer, "POLICE", "CopTraf_Stop", -1, false, false, true, false)

                setTimer ( function()
                    takeChar2 (player)

                    triggerClientEvent(thePlayer,"JoinQuitGtaV:notifications", thePlayer,"animo", "Parabéns pelo belo RP, seja sempre assim!  ( PACIENTE CURADO COM SUCESSO, BOM JOGO )", 15 )
                    triggerClientEvent(player,"JoinQuitGtaV:notifications", player,"animo", "Parabéns pelo belo RP, seja sempre assim!  ( VOCÊ FOI CURADO COM SUCESSO, BOM JOGO )", 15 )

                    setElementData(thePlayer, "char:animando", false)
                end, 60000, 1 )

            end
        return
        end
    end
end
end
end
addCommandHandler("reanimar", reanimar, false, false)

function takeChar2 (thePlayer)
setElementHealth ( thePlayer, 100 )
setPedAnimation(thePlayer, false)
end


function takeChar22 (thePlayer)
    if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ("Samu")) then
    setElementData(thePlayer, "char:animando", false)
    outputChatBox("#bebebeDEBUG CORRIGIDO!",thePlayer,255,255,255,true) 
    setElementData(thePlayer,"PlayerCaido",false)
    setElementData(thePlayer,"PlayerAnimo",false)
        end 
    end 
addCommandHandler("mdebug", takeChar22)


function ChecarAnimo2(attacker)
    for i, player in pairs (getElementsByType("player")) do
        if not getElementData(player, "PlayerAnimo") then
            if getElementData(player, "PlayerCaido") then return end
                if getElementHealth(player) > 1 then
                    if getElementHealth(player) < 50 then 
                        setElementData(player, "PlayerAnimo", true)
                        triggerClientEvent(player,"JoinQuitGtaV:notifications", player,"animo", "Você está desanimado vá para o hospital e tome um remedio!", 15 )
                        toggleControl (player, "sprint", false ) 
                        toggleControl (player, "jump", false )
                        toggleControl (player, "crouch", false )
                        setPedWalkingStyle(player,120)
                        --setElementHealth(player, 45)
                    end
                end
        else
            setPedWalkingStyle(player,120)
            toggleControl (player, "sprint", false ) 
            toggleControl (player, "jump", false )
            toggleControl (player, "crouch", false )
        end
    end
end
setTimer(ChecarAnimo2, 200, 0)

function ChecarAnimo()
    for i, player in pairs (getElementsByType("player")) do
        if  getElementData(player, "PlayerAnimo") then
            if getElementHealth(player) > 51 then
                setElementData(player, "PlayerAnimo", false)
                setPedAnimation(player, false)
                setPedWalkingStyle(player,0)
                toggleControl (player, "sprint", true ) 
                toggleControl (player, "crouch", true )
                toggleControl (player, "jump", true )

                setTimer ( setPedAnimation, 100, 1, player,  "GHANDS", "gsign2", 5000, false, false, false)
                setTimer ( setPedAnimation, 250, 1, player, nil)


            end
        end
    end
end
setTimer(ChecarAnimo, 200, 0)


function ChecarVidaV()
    for i, veh in pairs (getElementsByType("vehicle")) do
        if not getElementData(veh, "VehExplode") then
                    if getElementHealth(veh) <= 300 then 
                        setElementData(veh, "VehExplode", true)
                        setVehicleDamageProof ( veh, true ) 
                        setElementHealth(veh, 299)
                end
        end
    end
end
setTimer(ChecarVidaV, 200, 0)

function ChecarVidaVV()
    for i, veh in pairs (getElementsByType("vehicle")) do
        if  getElementData(veh, "VehExplode") then
            if getElementHealth(veh) >= 300 then
                setElementData(veh, "VehExplode", false)
                setVehicleDamageProof ( veh, false ) 
            end
        end
    end
end
setTimer(ChecarVidaVV, 200, 0)


function randomLife(thePlayer, vitima)
    -- local liferamdom = math.random(1, 100)
    -- if liferamdom then
        -- if not (liferamdom == 10 or liferamdom == 70 or liferamdom == 90 or liferamdom == 1 or liferamdom == 55 or liferamdom == 15 or liferamdom == 20 or liferamdom == 21 or liferamdom == 29 or liferamdom == 83 or liferamdom == 63 or liferamdom == 91) then
             Tempo2[vitima] = setTimer(function()
             local x, y, z = getElementPosition(vitima)
             spawnPlayer (vitima, x, y, z, 0, getElementModel(vitima))
             setElementHealth(vitima, 40)
            -- setPlayerMuted(vitima, false)
             toggleAllControls (vitima, true )
             end, 5000, 1, vitima)
            -- else
            -- Tempo2[vitima] = setTimer(function()
            -- outputChatBox("#FF0000[AVISO]#FFFFFF: Você não conseguiu salvar o cidadão a tempo.", thePlayer, 255,255,255, true)
            -- setElementHealth(vitima, 0)
            -- end, 4000, 1, vitima)
        -- end
    -- end
end

Edited by JULIUUUUUUUUU
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...