Jump to content

Counter


manawydan

Recommended Posts

Posted

counter. how to use?

when a zombie attacks a player, the player receives a counter. when the counters reach three, the player becomes zumbie.

onClientPlayerDamage 

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted

You are asking us to tell you the first step of everything in the whole scripting world? Man. You should probably read some manuals first.

To make a simple counter, use variables. Since this is a client-side script, it will only be triggered for the damaged player.

Perhaps this might help..

Client-side

counter = 0; 
  
addEventHandler("onClientPlayerDamage", root, 
    function(attacker, weapon, bodypart, loss) 
        if (attacker and getElementType(attacker) == "ped") then 
            if (counter ~= 3) then 
                counter = counter+1; 
            else 
                outputChatBox("You became a zombie.", 245, 40, 40, false); 
            end 
        end 
    end 
) 

If I helped you, please click the like button on the right ;) Thanks!

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