SA-MP Forums Archive
damage count - 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: damage count (/showthread.php?tid=485538)



damage count - Champ - 04.01.2014

how to count damage and save it in a variable for later use ?


Re: damage count - Danyal - 04.01.2014

Count Damage?? what you want to say?

you want to store health and use it for further use? if yes then create a float variable and save it in your system and later load it for your work.

[This forum requires that you wait 240 seconds between posts. Please try again in 97 seconds.]


Re: damage count - Champ - 04.01.2014

I want to store the highest damage did by a player in a variable then show it when the time comes.


Re: damage count - Mauzen - 04.01.2014

Take a look at this: https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage


Re: damage count - Champ - 04.01.2014

This directly prints the value of the damage. I just want to store it in a variable and print the highest damage did when i want it to be printed.


Re: damage count - Danyal - 04.01.2014

pawn Код:
//Make Global Variable
new float:PlayerHealth[MAX_PLAYERS];

Then On A Public Function
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    // Here amount is what it takes by the Killer
    // You can compare PlayerHealth that is global variable and store the amount of taken damage
    // You can do it like this PlayerHealth[playerid] = amount;
    return 1;
}
this should work like this but I am not conformed


Re: damage count - Champ - 04.01.2014

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    PlayerHealth[playerid] = amount;
    // OR
    PlayerHealth[issuerid] = amount;
    return 1;
}



Re: damage count - Danyal - 04.01.2014

Player as player will get damage not the killer


Re: damage count - Champ - 04.01.2014

tage mismatch warning.

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    damagedid[playerid] = amount;
    return 1;
}



Re: damage count - Patrick - 04.01.2014

Quote:
Originally Posted by Champ
Посмотреть сообщение
tage mismatch warning.

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    damagedid[playerid] = amount;
    return 1;
}
damagedid variable/array should have Float tag because amount has Float tag, I mean this
pawn Код:
new Float:damagedid[MAX_PLAYERS];