25.11.2017, 13:15
I just tested in game with your code, and it worked fine, the prints were showing.
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.
Код:
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
There does seem to be a few historic posts from others reporting that OnPlayerGiveDamageActor may be buggy.