How to add the damage?
#1

Код:
format(text, sizeof(text), "~r~Damage received: %.0f || Issuer: %s", amount, issuer);
	GameTextForPlayer(damagedid, text, 3000, 1);
In this above script, when we shoot or damage someone, the text will show the amount of damage that we did. But I had made that text to dissapear within 3 seconds. So when we make a damage, the text appears and it dissapears in 3 seconds. But what I want is, that when we keep damaging someone, the script will add the damages done within that 3 seconds and show the total damage on the text.

For example:
A player damages another guy and reduces 10% health. And the "Damage Received: 10" text will appear. But that player will damage another guy or the same guy 30%. So what I want is that the text will display the addition of both these damages within that 3 seconds of the text. So the text should display according to this example is "Damage Received: 40".

Thanks,
Mani.
Reply
#2

I assume you using a timer to make it go away.

I'll give you the part of the code you need for this from my script its smillier to what you made only I used textdraws

pawn Код:
if(dmgdealt[issuerid] == true) KillTimer(dmgdlttmr[issuerid]);
        dmgdlttmr[issuerid] = SetTimerEx("destroydmgTD",3000,false,"dd",issuerid,playerid);
        dmgdealt[issuerid] = true;
What I did is I made a bool var so I know if to kill the timer or not, if the player keeps damaging the other player the dmgdealt will be true and it will kill the timer before it even starts so it doesnt destroy the textdraw.
Reply
#3

Well basically, I want a way to add up the damage I give to someone.
Reply
#4

Quote:
Originally Posted by Captain_Mani
Посмотреть сообщение
Well basically, I want a way to add up the damage I give to someone.
Make a var that will store the dmg a player did so far and keep adding to it.
You will need to reset it at the timer.
Reply
#5

I don't know much about bool var and stuff you said above.
Can you give me a code? :\
Reply
#6

Bump.
Reply
#7

Why doesn't anyone help? Bump.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)