SA-MP Forums Archive
[FilterScript] Blood & Damage Amount - 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] Blood & Damage Amount (/showthread.php?tid=321114)



Blood & Damage Amount - Shadow_ - 25.02.2012

Blood & Damage Amount
About

This isn't really a filterscript, its more of 2 separate code snippets that are involved within the same system.

Blood; When you're shot or you fall anything and lose more than 25HP. You'll get 4 large spots of blood pop up on your screen (they will disappear after 2 seconds), I suppose just like in the actual game when you get that blood splatter.

Damage Amount; When you shoot a player, you'll get a textdraw come up on your screen ( just right of your player ) that says '46.00 - taken' < just an example. it will show the actual amount you have taken. you also get a little ding sound so it can alert you, this makes it very easy to find someone's hitbox.

Screen-Shots

Blood;


Damage Amount;


Code

Blood Code;

pawn Код:
#include <a_samp>

new Text:Blood1;
new Text:Blood2;
new Text:Blood3;
new Text:Blood4;

new timer;

public OnFilterScriptInit()
{
    Blood1 = TextDrawCreate(160.000000, 140.000000, "ld_dual:ex4");
    TextDrawBackgroundColor(Blood1, 255);
    TextDrawFont(Blood1, 4);
    TextDrawLetterSize(Blood1, 0.500000, 1.000000);
    TextDrawColor(Blood1, -1);
    TextDrawSetOutline(Blood1, 0);
    TextDrawSetProportional(Blood1, 1);
    TextDrawSetShadow(Blood1, 1);
    TextDrawUseBox(Blood1, 1);
    TextDrawBoxColor(Blood1, 255);
    TextDrawTextSize(Blood1, 60.000000, 60.000000);

    Blood2 = TextDrawCreate(250.000000, 200.000000, "ld_dual:ex4");
    TextDrawBackgroundColor(Blood2, 255);
    TextDrawFont(Blood2, 4);
    TextDrawLetterSize(Blood2, 0.500000, 1.000000);
    TextDrawColor(Blood2, -1);
    TextDrawSetOutline(Blood2, 0);
    TextDrawSetProportional(Blood2, 1);
    TextDrawSetShadow(Blood2, 1);
    TextDrawUseBox(Blood2, 1);
    TextDrawBoxColor(Blood2, 255);
    TextDrawTextSize(Blood2, 60.000000, 60.000000);

    Blood3 = TextDrawCreate(370.000000, 170.000000, "ld_dual:ex4");
    TextDrawBackgroundColor(Blood3, 255);
    TextDrawFont(Blood3, 4);
    TextDrawLetterSize(Blood3, 0.500000, 1.000000);
    TextDrawColor(Blood3, -1);
    TextDrawSetOutline(Blood3, 0);
    TextDrawSetProportional(Blood3, 1);
    TextDrawSetShadow(Blood3, 1);
    TextDrawUseBox(Blood3, 1);
    TextDrawBoxColor(Blood3, 255);
    TextDrawTextSize(Blood3, 60.000000, 60.000000);

    Blood4 = TextDrawCreate(330.000000, 290.000000, "ld_dual:ex4");
    TextDrawBackgroundColor(Blood4, 255);
    TextDrawFont(Blood4, 4);
    TextDrawLetterSize(Blood4, 0.500000, 1.000000);
    TextDrawColor(Blood4, -1);
    TextDrawSetOutline(Blood4, 0);
    TextDrawSetProportional(Blood4, 1);
    TextDrawSetShadow(Blood4, 1);
    TextDrawUseBox(Blood4, 1);
    TextDrawBoxColor(Blood4, 255);
    TextDrawTextSize(Blood4, 60.000000, 60.000000);
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(amount >= 25)
    {
        TextDrawShowForPlayer(playerid, Blood1), TextDrawShowForPlayer(playerid, Blood2), TextDrawShowForPlayer(playerid, Blood3), TextDrawShowForPlayer(playerid, Blood4);
        timer = SetTimerEx("RemoveDamageDraw", 2000, true, "%d", playerid);
    } else return 0;
    return 1;
}

forward RemoveDamageDraw(playerid);
public RemoveDamageDraw(playerid)
{
    TextDrawHideForPlayer(playerid, Blood1), TextDrawHideForPlayer(playerid, Blood2), TextDrawHideForPlayer(playerid, Blood3), TextDrawHideForPlayer(playerid, Blood4);
    KillTimer(timer);
    return 1;
}

Damage Amount;

pawn Код:
#include <a_samp>

new Text:DTaken;
new timer;

public OnFilterScriptInit()
{
    DTaken = TextDrawCreate(360.000000, 260.000000, " ");
    TextDrawBackgroundColor(DTaken, 255);
    TextDrawFont(DTaken, 3);
    TextDrawLetterSize(DTaken, 0.500000, 1.000000);
    TextDrawColor(DTaken, -1);
    TextDrawSetOutline(DTaken, 1);
    TextDrawSetProportional(DTaken, 1);
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    PlayerPlaySound(playerid, 5201, 0, 0, 0);
    new string[35];
    format(string, sizeof(string), "%2.2f - taken", amount);
    TextDrawSetString(DTaken, string);
    TextDrawShowForPlayer(playerid, DTaken);
    timer = SetTimerEx("RemoveDamageDraw", 2000, true, "%d", playerid);
    return 1;
}


forward RemoveDamageDraw(playerid);
public RemoveDamageDraw(playerid)
{
    TextDrawHideForPlayer(playerid, DTaken);
    KillTimer(timer);
    return 1;
}
Credits

Lorenc_ for the Damage amount system, i got the idea from the /hitmarker system on his SF-CnR server.
( Join Today; Really Fun, Active Admins, Great Scripts/Scripter, 188.227.161.240:7777 )

Gho$t & blunt for helping me to test the different scripts.

The idea for the Blood Splatter didn't actually come from the SP Version of SA, i saw a video of someone dying on a roleplay server and thats where i saw it, also i wanted to use these sprites :P ( I think the server was PR-RP but i cannot be 100% sure. )


Re: Blood & Damage Amount - Psymetrix - 25.02.2012

Nice. I wanted to create something like this but never had the time. I wanted to do a SA:MP version of Call Of Duty's blood splatter. If you get hit in the back the splatter would be at the bottom of your screen and so on. Perhaps a version 2?


Re: Blood & Damage Amount - Eiy Mard - 26.02.2012

GJ .. nice work !


Re: Blood & Damage Amount - Shadow_ - 26.02.2012

Quote:
Originally Posted by Psymetrix
Посмотреть сообщение
Nice. I wanted to create something like this but never had the time. I wanted to do a SA:MP version of Call Of Duty's blood splatter. If you get hit in the back the splatter would be at the bottom of your screen and so on. Perhaps a version 2?
Yeah, could be done by checking if a player is facing away from a player then obviously checking if the player damaged another player ...


Re: Blood & Damage Amount - TheYoungCapone - 26.02.2012

I like this very much
Suggestion: What about if you add the heliblood 0.3c particle as well?


Re: Blood & Damage Amount - Shadow_ - 26.02.2012

Whats the name for it ?


Re: Blood & Damage Amount - iPLEOMAX - 26.02.2012

Nice!

Reminds me of my FS I made in 0.3c, I used the text with font 1 and resized them to large size to make it look like a blood splatter. I think I can improve it now.


Re: Blood & Damage Amount - Michael@Belgium - 26.02.2012

Hmm good Imma use the blood code ^^


Re: Blood & Damage Amount - T0pAz - 26.02.2012

I love the things done with the sprites. Nice work!


Re: Blood & Damage Amount - Aira - 26.02.2012

Nice Work man, +Rep