SA-MP Forums Archive
[FilterScript] Health Lost, Armour lost bubble over target's head - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Health Lost, Armour lost bubble over target's head (/showthread.php?tid=417675)



Health Lost, Armour lost bubble over target's head - RajatPawar - 22.02.2013

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!


Re: Health Lost, Armour lost bubble over target's head - Alvon - 22.02.2013

Interactive technique. Good work.

Note - That's perfect.

#March



Re: Health Lost, Armour lost bubble over target's head - [L4T]Left4Theft - 22.02.2013

Not That good.
Try harder
But good


Re: Health Lost, Armour lost bubble over target's head - SuperViper - 22.02.2013

1) You should use the native function OnPlayerTakeDamage which was made in 0.3d, which rendered wups' include useless.

2) The label stays forever. Did you even test this?

3) You can use SetPlayerChatBubble.


Re: Health Lost, Armour lost bubble over target's head - LavaHDProkiller - 22.02.2013

cool


Re: Health Lost, Armour lost bubble over target's head - RajatPawar - 22.02.2013

Nope, please read the intro again! And yes. Sorry and thanks for your input superviper, will do the needful. Thanks everyone else.


Re: Health Lost, Armour lost bubble over target's head - RajatPawar - 23.02.2013

Updated with all the things except SPCB! Thanks SV. You do not need wups include or anything now!