OnPlayerGiveDamageActor
#1

Hello!
I don't know what i'm doing wrong but for some reason
OnPlayerGiveDamageActor
Is not being called and it was working before..
I'm trying to figure it out but I just don't see what could be wrong,
Actors are created,
SetActorInvulnerable is true
And SetActorInvulnerable is still not called, I tried to debug it but I can't it's not even entering the callback
Reply
#2

If you set invulnerable to true, then OnPlayerGiveDamageActor will not be called. Check the wiki:
Once set invulnerable, the actor does not call OnPlayerGiveDamageActor.
Players will have actor's invulnerability state changed only when it is restreamed to them.

https://sampwiki.blast.hk/wiki/SetActorInvulnerable
Reply
#3

My bad invulnerable is false.
But still not called, I created a debug command which would return actors status and this is what i got

pawn Код:
CMD:checkactor(playerid, params[]) {
    if(IsValidActor(cityActor)) {
        print("created");
        if(IsActorInvulnerable(cityActor)) {
            print("undestroyable");
        }
        else {
            print("destroyable");
        }
    }
    else {
        print("not created");
    }
    return true;
}

// callback

public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart) {
    printf("callback normal called.");
    if(damaged_actorid == cityActor && IsValidActor(cityActor)) {
        print("actor attached");
    }
    return true;
}

// result

[14:52:13] created
[14:52:13] destroyable
Now the part under OnPlayerGiveDamageActor is still not being called even after I attack actor
Reply
#4

I believe that the callback is bugged and does not get called at all.

Similar Problems: http://*******/2Bm7wgH
Reply
#5

Maybe but it still does not explain why it was working a couple of days or even a day ago on a server that holds 150+ players and now it doesnt
Reply
#6

I just tested in game with your code, and it worked fine, the prints were showing.

Код:
new ActorCJ;

public OnGameModeInit()
{
	ActorCJ = CreateActor(0, 0.0, 0.0, 3.0, 0.0);
	SetActorInvulnerable(ActorCJ, false);
	return 1;
}

/*public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart)
{
    new string[128], attacker[MAX_PLAYER_NAME];
    new weaponname[24];
    GetPlayerName(playerid, attacker, sizeof (attacker));
    GetWeaponName(weaponid, weaponname, sizeof (weaponname));

    format(string, sizeof(string), "%s has made %.0f damage to actor id %d, weapon: %s", attacker, amount, damaged_actorid, weaponname);
    SendClientMessageToAll(0xFFFFFFFF, string);
    return 1;
}*/

public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart) {
	printf("callback normal called.");
    if(damaged_actorid == ActorCJ && IsValidActor(ActorCJ)) {
    	print("actor attached");
    }
    return true;
}
Код:
[00:10:35] callback normal called.
[00:10:35] actor attached
[00:10:36] callback normal called.
[00:10:36] actor attached
[00:10:37] callback normal called.
[00:10:37] actor attached
[00:10:37] callback normal called.
[00:10:37] actor attached
[00:10:37] callback normal called.
[00:10:37] actor attached
[00:10:38] callback normal called.
[00:10:38] actor attached
[00:10:38] callback normal called.
[00:10:38] actor attached
Are you 100% sure you are setting the actor to be vulnerable?

There does seem to be a few historic posts from others reporting that OnPlayerGiveDamageActor may be buggy.
Reply
#7

Yes I'm sure and this also happens on third actor since I'm only using this for three of them.
This is how i created them:

pawn Код:
// creating them
new cityActor;
cityActor = CreateActor(163,1495.4327,-1786.7675,13.5349,36.4921);
SetActorInvulnerable(cityActor, false);
They're spawned and all that but callback is not being called at all :S
Is it possible that a plugin or something is blocking the function ?
Since I've started recieving
-
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
and
[sampgdk:error] Too many callback arguments (at most 32 allowed)

But that went away with pragma dynamic, and I'm sure that the script is not the problem since it's optimized.
Reply
#8

Nevermind I fixed it, turns out that the streamer plugin was causing the problem.
I downgraded to 2.8.2 and its working for now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)