Nice Killer [урезать функционал]

Сообщения
17
Реакции
2
Добрый вечер, требуется помощь. Нужно урезать функционал отображения в hud и сделать оставшийся текст в одну строку.

Screenshot_5.png
 
Последнее редактирование модератором:
Сообщения
2,713
Реакции
2,993
Помог
59 раз(а)
Есть более новая версия плагина, которая была опубликована на мёртвом ныне форуме GoldSrc
Код:
/**
* Modified by Safety1st
* 6/19/2016
*
* Official support forum:
* http://goldsrc.ru/
*
* Changes are:
* - a lot corrections to get nice plugin
* - multilingual support
* - added support for Russian words endings
*
* Notes:
* - each headshot is counted even if it didn't lead to death
* - self damage/kills, C4 damage and other world damage are ignored
*
* Credits:
* - Subb98 for some info about Ham_TakeDamage forward
*/

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

/*---------------EDIT ME------------------*/
//#define IGNORE_TEAM_DAMAGE // uncomment this on servers where friendly fire is ON
/*----------------------------------------*/

const MAX_CLIENTS = 32
enum _:score {
frags,
Float:dmg,
hs
}

new niceP[MAX_CLIENTS + 1][score]

new hudsync

new maxplayers

enum _:Types { word_frag, word_hs }

#define m_iTeam 114
#define fm_cs_get_user_team_index(%1) get_pdata_int( %1, m_iTeam )

public plugin_init() {
register_plugin( "Nice Killer", "1.7", "Got Milk? / HoHoL / Safety1st" )
register_dictionary( "nice_killer.txt" )

RegisterHam( Ham_TakeDamage, "player", "hook_TakeDamage_Post", .Post = 1 )
register_event( "DeathMsg", "Event_DeathMessage", "a", "1!0" ) // killed by player ('1')
register_logevent( "event_round_end", 2, "1=Round_End" )
register_event( "HLTV", "event_round_start", "a", "1=0", "2=0" )

hudsync = CreateHudSyncObj()

maxplayers = get_maxplayers()
}

public event_round_end()
// delay is needed to count last round kill
set_task( 1.0, "GetTheBest" )

public GetTheBest() {
new iPlayers[32], iPlayersNum, player
new pfrags, Float:pdamage, tmpf, Float:tmpd, tmpid
get_players( iPlayers, iPlayersNum, "h" ) // except HLTV

for( new i; i < iPlayersNum; i++ ) {
player = iPlayers
pfrags = niceP[player][frags]

if( pfrags < tmpf )
continue

pdamage = niceP[player][dmg]
if ( pfrags > tmpf || pdamage > tmpd ) {
tmpid = player
tmpf = pfrags
tmpd = pdamage
}
}

if( tmpf ) {
// there is a winner
static name[32], wordfrag[20], wordhs[40], msg[192]
get_user_name( tmpid, name, charsmax(name) )
set_hudmessage( random(200) + 25, random(200) + 25, random(200) + 25, -1.0, 0.17, 0, .fxtime = 0.0, .holdtime = 5.0 /* max possible */ )
for( new i = 1; i <= maxplayers; i++ ) {
if( !is_user_connected(i) )
continue

CreateWord( i, word_frag, tmpf, wordfrag, charsmax(wordfrag) )
CreateWord( i, word_hs, niceP[tmpid][hs], wordhs, charsmax(wordhs) )
formatex( msg, charsmax(msg), "%L", i, "NC_MESSAGE",
name, wordfrag, wordhs, floatround(tmpd) /* it's better to round float than ignore decimal part */ )

ShowSyncHudMsg(i, hudsync, msg)
}
}
}

CreateWord( id, type, value, word[], len = 0 ) {
enum _:Count { alone, afew, many }
static szWord[Types][Count][] = {
{ "NC_WORD_KILL_1", "NC_WORD_KILL_2_4", "NC_WORD_KILL_S" },
{ "NC_WORD_HS_1", "NC_WORD_HS_2_4", "NC_WORD_HS_S" }
}

new iLen = formatex( word, len, "%d ", value )
switch( value ) {
case 1, 21, 31, 41, 51, 61, 71, 81, 91 :
formatex( word[iLen], len - iLen, "%L", id, szWord[type][alone] )
case 2..4, 22..24, 32..34, 42..44, 52..54, 62..64, 72..74, 82..84, 92..94 :
formatex( word[iLen], len - iLen, "%L", id, szWord[type][afew] )
default :
formatex( word[iLen], len - iLen, "%L", id, szWord[type][many] )
}
}

public hook_TakeDamage_Post( victim, inflictor, attacker, Float:damage, damagebits ) {
#if !defined DMG_GRENADE
// for compatibility with old AMXX
#define DMG_GRENADE (1<<24) // hit by HE grenade
#endif

if( !attacker || attacker > maxplayers || victim == attacker /* ignore self-damage */ )
return HAM_IGNORED

// forward is fired even if mp_friendlyfire = 0
if( fm_cs_get_user_team_index(victim) == fm_cs_get_user_team_index(attacker) )
// ignore team damage
return HAM_IGNORED

if( inflictor == attacker || damagebits & DMG_GRENADE ) {
niceP[attacker][dmg] += damage

#define m_LastHitGroup 75
if( get_pdata_int( victim, m_LastHitGroup ) == HIT_HEAD )
niceP[attacker][hs]++
}

return HAM_IGNORED
}

public Event_DeathMessage() {
#define KillerID 1
#define VictimID 2

static iKiller, iVictim
iKiller = read_data(KillerID)
iVictim = read_data(VictimID)

if( iKiller != iVictim /* except suicides; BTW death due to amx_slay is a suicide too */ ) {
#if defined IGNORE_TEAM_DAMAGE
if( fm_cs_get_user_team_index(iKiller) == fm_cs_get_user_team_index(iVictim) )
// ignore TKs
return
#endif
niceP[iKiller][frags]++
}
}

public event_round_start() {
for( new i = 1; i <= maxplayers; i++ )
arrayset( niceP, 0, score )
}

public client_disconnect(id)
arrayset( niceP[id], 0, score )


Lang-файл:
nice_killer.txt
Код:
[en]
NC_MESSAGE = The best round player:^n%s^nHe did %s, %s and %d damage
NC_WORD_KILL_1 = kill
NC_WORD_KILL_2_4 = kills
NC_WORD_KILL_S = kills
NC_WORD_HS_1 = hit in head
NC_WORD_HS_2_4 = hits in head
NC_WORD_HS_S = hits in head

[ru]
NC_MESSAGE = Лучший игрок раунда:^n%s^n%s, %s и %d ypона
NC_WORD_KILL_1 = фраг
NC_WORD_KILL_2_4 = фрага
NC_WORD_KILL_S = фрагов
NC_WORD_HS_1 = попадание в головy
NC_WORD_HS_2_4 = попадания в головy
NC_WORD_HS_S = попаданий в головy


3 Июн 2017


урезать функционал отображения в hud и сделать оставшийся текст в одну строку.
1) Lang-файле меняешь ключ:
Код:

NC_MESSAGE = Лучший игрок раунда:^n%s^n%s, %s и %d ypона
>>
NC_MESSAGE = Лучший игрок раунда: %s

В коде плагина:
Код:
 formatex( msg, charsmax(msg), "%L", i, "NC_MESSAGE",
name, wordfrag, wordhs, floatround(tmpd) /* it's better to round float than ignore decimal part */ )
>>
formatex( msg, charsmax(msg), "%L", i, "NC_MESSAGE",
name)
 
Сообщения
9
Реакции
0
Помог
1 раз(а)
Ку Всем, а можно что бы статистика более точнее, даже не точнее хотя бы приблизительно рассчитывало команду /me
гранату не кидал !!!
 

Download all Attachments

Сообщения
17
Реакции
2
wopox1337, приветствую!
А можно как то сделать dhud, а не hud ?
10 Авг 2017
Sant1, что во "Вложения", у меня все ровно с /me показывает вроде как.
 

Вложения

Сообщения
24
Реакции
-1
Подскажите, как вывести сообщение в чат т.е. в dhud, а hud убрать?
Что нужно заменить в коде?
 
Сообщения
2,491
Реакции
2,790
Помог
61 раз(а)
ganja_dypb, не поднимайте старые темы. Создайте свою в соответсвующем разделе
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу