Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <hamsandwich>
- #include <fun>
- #include <colorchat>
- #define AUTHOR "aSior - amxx.pl/user/60210-asiorr/"
- new const damageInfoFormat[] = "Ofiara: %s^t^t-^t^tTrafienia: %i^t^t-^t^tDamage: %i^n";
- // Display type: 0 - multiple lines, 1 - one line
- new const displayDamageMode = 0;
- // Determines wether to display chat info with killer info.
- new const bool:displayChatMessage = true;
- #define ForRange(%1,%2,%3) for(new %1 = %2; %1 <= %3; %1++)
- #define ForPlayers(%1) for(new %1 = 1; %1 <= MAX_PLAYERS + 1; %1++)
- new victimHits[MAX_PLAYERS + 1][MAX_PLAYERS + 1],
- victimDamage[MAX_PLAYERS + 1][MAX_PLAYERS + 1],
- victimName[MAX_PLAYERS + 1][MAX_PLAYERS + 1][33],
- bool:damagePrinted[MAX_PLAYERS + 1];
- public plugin_init()
- {
- register_plugin("CS:GO-like damage info", "v0.1", AUTHOR);
- RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
- register_event("DeathMsg", "playerDeathEvent", "a");
- register_message(get_user_msgid("TextMsg"), "messageText");
- register_logevent("roundEnd", 2, "1=Round_End");
- }
- public messageText()
- {
- static textMessage[22];
- get_msg_arg_string(2, textMessage, charsmax(textMessage));
- if(!equal(textMessage, "#Game_will_restart_in"))
- {
- return PLUGIN_CONTINUE;
- }
- roundEnd();
- return PLUGIN_CONTINUE;
- }
- public roundEnd()
- {
- ForPlayers(index)
- {
- if(!is_user_connected(index))
- {
- continue;
- }
- if(!damagePrinted[index])
- {
- printDamage(index);
- }
- damagePrinted[index] = false;
- }
- }
- public playerDeathEvent()
- {
- new killer = read_data(1),
- victim = read_data(2);
- if(is_user_hltv(victim) || is_user_bot(victim))
- {
- return;
- }
- printDamage(victim);
- resetVariables(victim);
- if(displayChatMessage && killer && killer != victim)
- {
- ColorChat(victim, RED, "[Death Info]^x01 Zostales zabity przez^x04 %n^x01. W konsoli (~) zostaly wypisane statystyki rundy.", killer);
- }
- }
- public TakeDamage(victim, idinflictor, attacker, Float:damage, damagebits)
- {
- if(!is_user_alive(attacker) || !is_user_alive(victim) || is_user_hltv(victim))
- {
- return HAM_IGNORED;
- }
- if(!victimName[attacker][victim][0])
- {
- get_user_name(victim, victimName[attacker][victim], charsmax(victimName[][]));
- }
- victimHits[attacker][victim]++;
- victimDamage[attacker][victim] += floatround(damage);
- return HAM_IGNORED;
- }
- printDamage(index)
- {
- if(!is_user_connected(index))
- {
- return;
- }
- new bool:damageDealt,
- generalDamage,
- generalHits,
- generalVictims;
- ForRange(i, 1, 32)
- {
- if(!victimHits[index][i])
- {
- continue;
- }
- if(!damageDealt)
- {
- printSeparator(index, 1);
- damageDealt = true;
- }
- generalDamage += victimDamage[index][i];
- generalHits += victimHits[index][i];
- generalVictims++;
- client_print(index, print_console, damageInfoFormat, victimName[index][i], victimHits[index][i], victimDamage[index][i]);
- }
- if(damageDealt)
- {
- printSeparator(index, 2);
- if(!displayDamageMode)
- {
- client_print(index, print_console, "Statystyka:^n^n^tTrafienia: %i^n^tObrazenia: %i^n^tOfiary: %i", generalHits, generalDamage, generalVictims);
- }
- else
- {
- client_print(index, print_console, "Statystyka: %i trafien%s, %i damage, %i ofiar%s.", generalHits, generalHits == 1 ? "e" : (generalHits < 5 ? "a" : "") , generalDamage, generalVictims, generalVictims == 1 ? "a" : (generalVictims < 5 ? "y" : ""));
- }
- printSeparator(index, 1);
- damagePrinted[index] = true;
- }
- }
- resetVariables(index)
- {
- ForRange(i, 1, 32)
- {
- victimName[index][i] = "";
- victimHits[index][i] = 0;
- victimDamage[index][i] = 0;
- }
- damagePrinted[index] = false;
- }
- printSeparator(index, times)
- {
- ForRange(i, 0, times - 1)
- {
- client_print(index, print_console, "\
- ^n\
- ----------------------------------------------------\
- ----------------------------------------------------\
- ^n\
- ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement