SA-MP Forums Archive
How To Do This - 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 Do This (/showthread.php?tid=310722)



How To Do This - (_AcE_) - 13.01.2012

Hi I'm working on an A/D script. I was wondering if I use:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
How do I add all the damage a certain player gives together in a round to display his total damage given. Like, The Player who gave the Most damage?


Re: How To Do This - Kaperstone - 13.01.2012

here: (should work)
pawn Код:
new PlayerTotalDamageGiven[MAX_PLAYERS];

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
PlayerTotalDamageGiven[issuerid] = amout++;
return 1;
}
the player that damage the most idk how to make


Re: How To Do This - IceCube! - 13.01.2012

THat aboce +
THis when you want to work it out

pawn Код:
new stat;
new name[MAX_PLAYER_NAME];
for(new i = 0; i<MAX_PLAYERS; i++)
{
     if(stat<PlayerTotalDamageGiven[i])
     {
         stat = PlayerTotalDamageGiven[i];
         GetPlayerName(i, name, MAX_PLAYER_NAME);
       }
}
Then place the info where you want it

For example...

pawn Код:
format(string, sizeof(string), "%s did the most damge this round" name);
 SendClientMessageToAll(COLOUR, string);



Re: How To Do This - (_AcE_) - 13.01.2012

xkirll I get a tag mismatch on yours..:S