Jump to content

[Help] Spray gives life


Atouk

Recommended Posts

     addEventHandler("onClientPlayerDamage", localPlayer, 
function(attacker, weapon, bodypart, loss) 
    if (attacker and getElementType(attacker) == "player" and weapon == 41 then 
        cancelEvent() 
        if (not isTimer(pause)) then  
            local health = getElementHealth(localPlayer) 
            if (health < 99) then 
            triggerServerEvent("medic:healing", localPlayer, attacker) 
            pause = setTimer(function() end, 1000, 1) 
            end 
        end 
    end 
end 
) 

I have an error?

Link to comment
     addEventHandler("onClientPlayerDamage", localPlayer, 
function(attacker, weapon, bodypart, loss) 
    if (attacker and getElementType(attacker) == "player" and weapon == 41 then 
        cancelEvent() 
        if (not isTimer(pause)) then  
            local health = getElementHealth(localPlayer) 
            if (health < 99) then 
            triggerServerEvent("medic:healing", localPlayer, attacker) 
            pause = setTimer(function() end, 1000, 1) 
            end 
        end 
    end 
end 
) 

I have an error?

How bout checking it yourself?

/debugscript 3 and check for bad arguments.

Link to comment

Tell me the Results.

addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function ( attacker, weapon, bodypart, loss ) 
        if attacker and getElementType ( attacker ) == "player" and weapon == 41 then 
            cancelEvent ( ) 
            local health = getElementHealth ( localPlayer ) 
            if ( health < 99 ) then 
                -- triggerServerEvent("medic:healing", localPlayer, attacker) 
                setElementHealth ( localPlayer, health + 10 ) 
            end  
        end 
    end 
) 

Link to comment

server:

addEventHandler ( 'onPlayerDamage', root, 
    function ( attacker, weapon ) 
        if attacker and getElementType ( attacker ) == 'player' and weapon == 41 then 
            cancelEvent ( ) 
            local health = getElementHealth ( source ) 
            if ( health < 99 ) then 
                setElementHealth ( source, health + 1 ) 
            else 
                outputChatBox( 'He is in a good condition', attacker, 255, 0, 0, true ) 
            end 
        end 
    end 
) 

Link to comment
server:
addEventHandler ( 'onPlayerDamage', root, 
    function ( attacker, weapon ) 
        if attacker and getElementType ( attacker ) == 'player' and weapon == 41 then 
            cancelEvent ( ) 
            local health = getElementHealth ( source ) 
            if ( health < 99 ) then 
                setElementHealth ( source, health + 1 ) 
            else 
                outputChatBox( 'He is in a good condition', attacker, 255, 0, 0, true ) 
            end 
        end 
    end 
) 

https://wiki.multitheftauto.com/wiki/OnPlayerDamage

It should also be noted that canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead.

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...