[FilterScript] Health Lost, Armour lost bubble over target's head
#1

This is something so simple, I wanted to make it, finally got it to work. I haven't tested it, since there is no one who's online yet on whom I can test it. Anyways, here it is.
pawn Code:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
#define COLOR_GREEN 0x33AA33AA
new Text3D:Targetlabel;
new Text3D:Shooterlabel;
new DTimer;

stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    new Float:TargetPos[3], string[25], Float:ShooterPos[3], nstring[25];
    GetPlayerPos(issuerid, ShooterPos[0], ShooterPos[1], ShooterPos[2]);
    GetPlayerPos(playerid, TargetPos[0], TargetPos[1], TargetPos[2]);
    format(string, 25, "Lost -%f health", amount);
    format(nstring, 25, "Made %s (%d) lose -%f health!", GetName(playerid), playerid, amount);
    Targetlabel = Create3DTextLabel(string, COLOR_RED, TargetPos[0], TargetPos[1], TargetPos[2], 50.0, GetPlayerVirtualWorld(playerid), 0);
    Shooterlabel =  Create3DTextLabel(nstring, COLOR_GREEN, ShooterPos[0], ShooterPos[1], ShooterPos[2], 50.0, GetPlayerVirtualWorld(issuerid), 0);
    Update3DTextLabelText(Targetlabel, COLOR_RED, string);
    Update3DTextLabelText(Shooterlabel, COLOR_GREEN, nstring);
    Attach3DTextLabelToPlayer(Targetlabel, playerid, 0.0, 0.0, 0.3);
    Attach3DTextLabelToPlayer(Shooterlabel, issuerid, 0.0, 0.0, 0.3);
    DTimer = SetTimer("DestroyTD",3000, 0);
    return 1;
}
forward public DestroyTD();
public DestroyTD()
{
    Delete3DTextLabel(Targetlabel);
    Delete3DTextLabel(Shooterlabel);
    KillTimer(DTimer);
    return 1;
}
ScreenShot: Here is how I imagine it to be: (Yes, I know my paint skills are awesome.)

Yes, you are gonna think, is this a joke, lol.
Thanks, if there are any bugs, please do tell me!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)