Jump to content

[Помогите]Работа Медика.


Recommended Posts

Server:

createTeam ( "Medic", 200, 0, 100 ) 
  
addEventHandler( 'onPlayerDamage',root, 
    function( attacker, weapon, bodypart, loss ) 
        local health = getElementHealth( source ) 
        if isElement( attacker ) and attacker ~= source and weapon == 41 and health < 100 then 
            local team = getPlayerTeam( attacker ) 
            if team then 
                if getTeamName( team ) == 'Medic' then 
                    local money = getPlayerMoney( source )  
                    if money >= 10 then 
                        givePlayerMoney( attacker,10 ) 
                        takePlayerMoney( source,10 ) 
                        setElementHealth( source,getElementHealth( source ) + 10 ) 
                    end 
                end  
            end  
        end  
    end 
) 

Client:

addEventHandler( 'onClientPlayerDamage',localPlayer, 
    function( attacker, weapon, bodypart, loss ) 
        local health = getElementHealth( source ) 
        if isElement( attacker ) and attacker ~= source and weapon == 41 and health < 100 then 
            local team = getPlayerTeam( attacker ) 
            if team then 
                if getTeamName( team ) == 'Medic' then 
                    if getPlayerMoney( ) >= 10 then 
                        cancelEvent( ) 
                    end 
                end  
            end 
        end 
    end 
) 

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