Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Бонус лучшему игроку в раунде

loran
сообщение 19.6.2017, 2:12
Сообщение #1
Стаж: 7 лет 11 месяцев

Сообщений: 2072
Благодарностей: 801
Полезность: 305

Вообщем есть такой плагин. Кто может сделать выдачу бонуса в виде денег лучшему игроку раунду? Кому не лень blush.gif И чтобы инфа появлялась в чате "Вам начислен бонус в размере 3000$" за лучшего игрока в раунде". И сделать так чтобы Бонусы были отключены на картах где нет закупки, ну или просто убрать сообщение из чата на этих картах.
.
Cкрытый текст
Код
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

/*---------------EDIT ME------------------*/
//#define IGNORE_TEAM_DAMAGE    // чтобы тимкиллы не учитывались.
/*----------------------------------------*/

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[i]
        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[i], 0, score )
}

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


Отредактировал: loran, - 19.6.2017, 2:14
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя OnlySteam
сообщение 19.6.2017, 21:14
Сообщение #2


Стаж: 9 лет 6 месяцев

Сообщений: 418
Благодарностей: 96
Полезность: 180

loran,

https://fungun.net/shop/?p=show&id=46

Отключает квары на определённых картах
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
loran
сообщение 19.6.2017, 22:58
Сообщение #3
Стаж: 7 лет 11 месяцев

Сообщений: 2072
Благодарностей: 801
Полезность: 305

OnlySteam, мне кажется ты не понял что я написал))
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: