SA-MP Forums Archive
OnPlayerGiveDamageActor don't work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerGiveDamageActor don't work (/showthread.php?tid=606659)



OnPlayerGiveDamageActor don't work - ax1 - 07.05.2016

Код:
CMD:actor(playerid)
{
        new Float:pos[3];
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
	Actor[playerid] = CreateActor(28, pos[0], pos[1], pos[2], 0.0);
	SetActorInvulnerable(Actor[playerid], false);
        SetActorHealth(Actor[playerid], 100);
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;
}
nothing happens when I shoot or punch actor


Re: OnPlayerGiveDamageActor don't work - Sew_Sumi - 07.05.2016

Are you getting any warnings on compiling your gamemode?


Re: OnPlayerGiveDamageActor don't work - ax1 - 07.05.2016

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Are you getting any warnings on compiling your gamemode?
Compiling does not give any warnings


Re: OnPlayerGiveDamageActor don't work - Sew_Sumi - 07.05.2016

Weird, because that code, works fine when on a clean gamemode.


Re: OnPlayerGiveDamageActor don't work - Dayrion - 07.05.2016

This is working perfectly for me. It's weird...
Put some print on the callback to get where is the error.


Re: OnPlayerGiveDamageActor don't work - ax1 - 07.05.2016

Sorry, I forgot 1 line

CMD:actor(playerid)
{
new Floatos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
Actor[playerid] = CreateActor(28, pos[0], pos[1], pos[2], 0.0);
SetActorInvulnerable(Actor[playerid], false);
SetActorHealth(Actor[playerid], 100);
ApplyActorAnimation(Actor[playerid], "CRACK", "crckdeth3", 4.1, 0,1,0,1,1);
return 1;
}

So I guess problem is in the animation


Re: OnPlayerGiveDamageActor don't work - Sew_Sumi - 07.05.2016

Nope, still works. Do you do anything with OnPlayerGiveDamage?