SA-MP Forums Archive
How to combine the hit I gived? - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to combine the hit I gived? (/showthread.php?tid=518453)



How to combine the hit I gived? - Matnix - 10.06.2014

Hello,

I would like to make a damage system I know to do the easiest one, but I want to create one like that (and I don't see how I can do that)


so its:

I give 2 hit on a players with deagle.
Hited player will saw a textdraw at each hit, and at the second one he will se 2HIT - 92(2 eagles damages) DAMAGES.

thx for help, and i'd like to do it with all wps.


Re: How to combine the hit I gived? - SilentSoul - 10.06.2014

Just create a variable that checks how many times the player got shoot, example:

pawn Код:
new ShootCount[MAX_PLAYERS]=0;
new Float:ShootDamage[MAX_PLAYERS];
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid,bodypart)
{
    //show your textdraws
    ShootDamage[playerid]+=amount;
    ShootCount[playerid]++;
    new string[128];
    format(string,sizeof(string),"%d Hit - %.0f",ShootCount[playerid],ShootDamage[playerid]);
    PlayerTextDrawSetString(playerid,yourtextdraw,string);
    SetTimerEx("ResetPlayerVariable",2000,false,"i",playerid);//I made a timer after 2 second to reset hit variable back
    return 1;
}
forward ResetPlayerVariable(playerid);
public ResetPlayerVariable(playerid)
{
    ShootCount[playerid]=0;
    ShootDamage[playerid]=0;
    return 1;
}