• 0
Sign in to follow this  
Drayzin

EventHandler HandleDamage

Question

Hello !

Im trying to play around with the eventhandler to become invincible !!!

So i wrote this script: 

Spoiler

_state = true;
while {_state} do {
    _justPlayers = allPlayers - entities "HeadlessClient_F";
    diag_log _justPlayers;
    if (count _justPlayers > 0) then 
    {
        _unit = _justPlayers select 0;
        diag_log _unit;
        _unit addEventHandler ["HandleDamage", 
        {
            diag_log "BAM BAM BAM BAM BAM BAM BAM BAM BAM BAM BAM BAM BAM BAM BAMN BAM";
            0
        }];
        _state = false;
    };

    uiSleep 120;
};

Its run server side, and it shows no problems in the SC, and when i get shot by ai it does fire, as in the sc gets the "bam bam bam bam" message. 

But i still die :o i was insta dropped. Did i write this wrong, or is there something im missing ???  Im the only "player" on the server besides a headless client, and the cs shows that "diag_log _unit" is me.

 

Hope someone can help me out ! =)

Edited by Drayzin

Share this post


Link to post
Share on other sites

1 answer to this question

  • 0

... i found the answer.

I thought i had already tried this but i was wrong. The eventhandler needs to be fire on the machine the unit is local to. So the script needs to fired on the client, not the server....

Share this post


Link to post
Share on other sites
Advertisement

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.