Am si eu un plugin gasit pe net care la finalul rundei afiseaza ce damage ai dat/primit, care are o mica problema ca sa-i spun asa, cum ar fi :
(100 with 2) damage, (41 with 2) taken, Player (4 HP) . I-a aratat ca i-a dat 100 ( maxim ), dar el mai avea 4, nefiind mort. Nu stiu exact unde este problema si am rugamintea la voi ca cineva sa ma ajute daca se poate.
As mai vrea inca o chestie ca atunci cand unui player i-am dat cap si el mai avea 14 HP, sa-mi arate ca i-am dat 14, nu 89 sau cat i-am dat eu cu arma respectiva, vreau ca totul sa fie la maxim 100HP calculat, atat cu grenada cat si cu gloantele.
x -> y = 100 HP
x + x -> y = 100 HP
x + x + x -> y = 100 HP
x + x + x + x -> y = 100 HP
x + x + x + x + x-> y = 100 HP
Code: Select all
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#define PLUGIN "Show Damage"
#define AUTHOR "momo"
#define VERSION "1.0"
#define is_valid_player(%1) (1 <= %1 <= 32)
new hits[33][33],
dmgs[33][33];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamagePost", 1);
register_logevent("logevent_RoundStart", 2, "1=Round_Start");
register_event("SendAudio", "EventRoundEnd", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
}
public client_connect(id) {
arrayset(hits[id], 0, charsmax(hits[]));
dmgs[id] = hits[id];
}
public Ham_TakeDamagePost(this, idinflictor, idattacker, Float:damage, damagebits) {
hits[this][idattacker]++;
dmgs[this][idattacker]+= floatround(damage);
return HAM_HANDLED;
}
public logevent_RoundStart() {
for (new i = 0; i < charsmax(hits); ++i) {
arrayset(hits[i], 0, charsmax(hits[]));
dmgs[i] = hits[i];
}
}
public LastRoundDamage(id) {
new message[255], username[32];
copy(message, charsmax(message), "(%d with %d) damage, (%d with %d) taken, %s (%d HP)");
for (new i = 0; i < charsmax(hits[]); i++) {
if (hits[id][i] != 0 || hits[i][id] != 0) {
get_user_name(i, username, charsmax(username));
client_print(id, print_chat, message, min(dmgs[i][id],100), hits[i][id], min(dmgs[id][i],100), hits[id][i], username, is_user_alive(i) ? get_user_health(i) : 0);
}
}
return PLUGIN_HANDLED_MAIN;
}
public EventRoundEnd()
{
new MaxPlayers = get_maxplayers()
for( new id = 1; id <= MaxPlayers; id++ ) {
if(is_valid_player(id) ){
LastRoundDamage(id)
}
}
}