BorderLine Posted May 22, 2013 Share Posted May 22, 2013 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
Castillo Posted May 22, 2013 Share Posted May 22, 2013 Simply do: local infection = getElementData ( source, "infeccion" ) if ( infection <= 99 and infection > 0 ) then Link to comment
BorderLine Posted May 22, 2013 Author Share Posted May 22, 2013 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
Castillo Posted May 22, 2013 Share Posted May 22, 2013 Well, I'm not sure, but maybe the only way is re-enabling friendly fire and making your own friendly fire system. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now