SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 15/06/2012, 08:20 PM   #1
[MsT]Pho3niX
Little Clucker
 
Join Date: Apr 2012
Location: Mariana, Minas Gerais, Brazil
Posts: 45
Reputation: 3
Post GiveDamage and TakeDamage with TextDraw and Sound

Yo people, I created this FilterScript for GM's A/D and DM

Feel free to use it! Still in BETA!

pawn Code:
#include <a_samp>

#define LGreenColor   0x00FF04FF
#define RedColor      0xE81010FF

new Text:GiveDamage[MAX_PLAYERS];
new Text:TakeDamage[MAX_PLAYERS];

public OnGameModeInit()
{
    for(new i; i < MAX_PLAYERS; ++i)
    {
    GiveDamage[i] = TextDrawCreate(171.000000, 388.000000, " ");
    TextDrawAlignment(GiveDamage[i], 2);
    TextDrawBackgroundColor(GiveDamage[i], 255);
    TextDrawFont(GiveDamage[i], 2);
    TextDrawLetterSize(GiveDamage[i], 0.160000, 0.599999);
    TextDrawColor(GiveDamage[i], 0x00FF04FF);
    TextDrawSetOutline(GiveDamage[i], 1);
    TextDrawSetProportional(GiveDamage[i], 1);
    }

    for(new i; i < MAX_PLAYERS; ++i)
    {
    TakeDamage[i] = TextDrawCreate(440.000000,388.000000, " ");
    TextDrawAlignment(TakeDamage[i], 2);
    TextDrawBackgroundColor(TakeDamage[i], 255);
    TextDrawFont(TakeDamage[i], 2);
    TextDrawLetterSize(TakeDamage[i], 0.160000, 0.599999);
    TextDrawColor(TakeDamage[i], 0xE81010FF);
    TextDrawSetOutline(TakeDamage[i], 1);
    TextDrawSetProportional(TakeDamage[i], 1);
    }
    return 1;
}

forward OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid);
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    new s[20];
    format(s, 20, "+Damage %.0f", amount);
    TextDrawSetString(GiveDamage[playerid], s);
    TextDrawShowForPlayer(playerid, GiveDamage[playerid]);
    PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
    SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
    return 1;
}

forward OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid);
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new s[20];
    format(s, 20, "-Damage %.0f", amount);
    TextDrawSetString(TakeDamage[playerid], s);
    TextDrawShowForPlayer(playerid, TakeDamage[playerid]);
    SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
    return 1;
}

forward DestruirTextoDraw(playerid);
public DestruirTextoDraw(playerid)
{
    TextDrawHideForPlayer(playerid, GiveDamage[playerid]);
    TextDrawHideForPlayer(playerid, TakeDamage[playerid]);
    return 1;
}

When you hit a shot or a blow, the damage will appear and give a sound of success.


When you take a shot, suffering a blow or fall, the damage appears.
http://img85.imageshack.us/img85/2588/samp028iwd.png
'

Last edited by [MsT]Pho3niX; 16/06/2012 at 01:34 AM.
[MsT]Pho3niX is offline   Reply With Quote
Old 15/06/2012, 08:29 PM   #2
Ades
Gangsta
 
Ades's Avatar
 
Join Date: May 2012
Location: Ji-Parana - RO ,Brazil
Posts: 778
Reputation: 63
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

What is the use of it?
__________________
Projects :

[Map] Wrong way and the right way [||||||||||||||||||||]

[Map] [||||||||||||||||||||]



Ades is offline   Reply With Quote
Old 15/06/2012, 08:35 PM   #3
[MsT]Pho3niX
Little Clucker
 
Join Date: Apr 2012
Location: Mariana, Minas Gerais, Brazil
Posts: 45
Reputation: 3
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

Read the description, GM's A / D and DM
[MsT]Pho3niX is offline   Reply With Quote
Old 15/06/2012, 08:39 PM   #4
Ades
Gangsta
 
Ades's Avatar
 
Join Date: May 2012
Location: Ji-Parana - RO ,Brazil
Posts: 778
Reputation: 63
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

GameMode A/D ?

Never heard of it.
__________________
Projects :

[Map] Wrong way and the right way [||||||||||||||||||||]

[Map] [||||||||||||||||||||]



Ades is offline   Reply With Quote
Old 15/06/2012, 08:54 PM   #5
iFederal
Big Clucker
 
Join Date: Apr 2012
Posts: 93
Reputation: 7
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

A/D - what did I just see?
Can you explain more, please?
iFederal is offline   Reply With Quote
Old 15/06/2012, 09:30 PM   #6
CooL_LosT
Little Clucker
 
Join Date: Apr 2011
Location: Brazil
Posts: 2
Reputation: 0
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

gamemodes of attack and defense, tdm, dm
CooL_LosT is offline   Reply With Quote
Old 15/06/2012, 09:30 PM   #7
Shadow_
Gangsta
 
Shadow_'s Avatar
 
Join Date: Nov 2008
Location: Vatican City
Posts: 519
Reputation: 44
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

You should of use PlayerTextDraws.

And take screenshots.
__________________
Shadow_ is offline   Reply With Quote
Old 15/06/2012, 09:30 PM   #8
Djole1337
Gangsta
 
Join Date: Apr 2012
Posts: 873
Reputation: 303
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

Well when player shoot you it shows given and taken damage in textdraw... But it doesn't show real values.You should check code again.
__________________
YouKnowWho
Djole1337 is offline   Reply With Quote
Old 16/06/2012, 12:47 AM   #9
[MsT]Pho3niX
Little Clucker
 
Join Date: Apr 2012
Location: Mariana, Minas Gerais, Brazil
Posts: 45
Reputation: 3
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

Quote:
Originally Posted by Mr_DjolE View Post
Well when player shoot you it shows given and taken damage in textdraw... But it doesn't show real values.You should check code again.
For an amateur in pawn, is already quite good enough just to improve the code. xD

I'll try better xD
[MsT]Pho3niX is offline   Reply With Quote
Old 16/06/2012, 12:50 AM   #10
Mark Shade
Huge Clucker
 
Mark Shade's Avatar
 
Join Date: Mar 2012
Posts: 244
Reputation: 67
Default Re: GiveDamage and TakeDamage with TextDraw and Sound

Good work -repped.
__________________
Universal Roleplay: 172.246.255.147:7806 -- Click To Play!
Mark Shade is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnPlayerGiveDamage / TakeDamage PrawkC Scripting Help 3 15/09/2012 06:24 AM
Sound bug WillyP Help Archive 0 11/12/2010 05:33 PM
sound bug Geoca_Olbis Client Support 2 05/11/2009 12:57 AM
car sound leuthrick Help Archive 2 04/11/2009 04:29 PM


All times are GMT. The time now is 03:11 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.