Jump to content

Check Element Data


Recommended Posts

Hi everyone, i have a little problem

Well, i was making a cure for my zombie infecction.

the problem is, when the players have 70 of infection, then im use spray and reduce his infection.

But, when im still spraying, he has - 10 - 20 then can be -1000 or more if im still use spray on him

How to check when his infection is on 0 then no low more his infection.

my code

local localPlayer = getLocalPlayer() 
function spray ( attacker, weapon, bodypart ) 
  cuInf = getElementData (source, "infeccion") 
    if ( attacker ) then 
        if ( getElementType ( attacker ) == "player" ) then 
            if ( weapon == 41 ) then 
                if getElementData(source,"infeccion") <= 99 then 
        cancelEvent() 
        setElementData (source, "infeccion", cuInf - 2)  
    end 
        end 
            end 
                end 
                    end 
addEventHandler ( "onClientPlayerDamage", localPlayer, spray) 

Thanks for your time

Link to comment

Thxanks a loot. Idk why that isnt work when i did .. jaja

Well and the last question. I have friendly fire. Buf if i want use spray on a player of my own team, isnt work,

i supposed is a fridly fire problem. How to do to make same effect to all?

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