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

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

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

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

> Правила форума

Этот раздел, как вы могли заметить по названию, предназначен для решения вопросов по поводу уже существующих модов и плагинов.
Пожалуйста, если у вас проблема с написанием плагина, не путайте этот раздел с разделом по скриптингу.
Для поиска плагинов и модов существует соответствующий раздел.

Название темы должно соответствовать содержанию. Темы с названием типа "Помогите", "Вопрос", "парни подскажите..." - будут удалены.
Все темы, не относящиеся к "Вопросам по модам и плагинам", будут удалены или перемещены в соответствующий раздел.

Правила оформления темы:
1. Помимо заголовка не забудьте верно сформулировать свой вопрос.
2. Выложите исходник (в тег кода + ) или ссылку на плагин который вызывает у вас вопросы.
3. Выложите лог с ошибками (если имеется) под спойлер

Плагины Kill Assist + Vip weapon

, Помощь в настрйоке данных плагинов
Статус пользователя ry3ik
сообщение 17.7.2016, 17:06
Сообщение #1
Стаж: 10 лет

Сообщений: 23
Благодарностей: 2
Полезность: 39

Доброго времени суток, Уважаемые форумчане.
В плагине Kill Assist, общие фраги иду в общую статистику. Например: пишу в чате /top100, открывается окно, и показано, что 95 место занимает Player 1 + Player2. И все показатели по нулям (убийств, смертей, % эффек. и т.д.)
Скажите пожалуйста, можно ли как то настроить плагин Kill Assist, что бы фраги не шли в статистику (/top15)? (использую StatsX Shell 2.0 )
Kill Assist.sma
Код
/* --------------------------------------------------------------------------
    Kill assist (for CS) v1.1b
      by Digi (a.k.a. Hunter-Digital)
        www.thehunters.ro
          -----------------------------------------------------------------

    Description:

      When a player gets killed, this plugin checks if another player, from the same team,
      did enough damage to the victim so that he could be an accomplice to the kill and
      the assister will also receive a frag
      (all of these are cvar controlled)


    CVars and default values:

      - amx_killassist_enable 0/1 (default: 1)
        Enable/disable the plugin

      - amx_killassist_mindamage 1-9999 (default: 50)
        Minimum amount of damage to deal to be nominated for an assisted kill

      - amx_killassist_givefrags 0/1 (default: 1)
        Give or not give the assister frags

      - amx_killassist_givemoney 0-16000 (default: 300)
        Give or not give the assister some money, 0 disables, 1 or more sets how much money

      - amx_killassist_onlyalive 0/1 (default: 0)
        Only alive players can be of assistance in killing other players


    Credits and thanks:

      - ConnorMcLeod - for helping with quick name changing
      - arkshine - for helping with name squeeze
      - joaquimandrade - code improvements
      - anakin_cstrike - code improvements
      - Nextra - more code improvements
      - ajvn - some ideas
      - Dores - and more code improvements


    Changelog:

      v1.0 - Release
      v1.0b - Fixed admin name bug
      v1.0c - Some modifications and added g_bOnline
      v1.0d - Removed useless stuff xD, added pcvar on amx_mode and used formatex()
      v1.1 - converted to CS only, new cvars: amx_killassist_onlyalive, amx_killassist_givemoney, enriched cvar handling, added team cache and fixed some bugs
      v1.1b - simplified cvar checking using clamp()

        -------------------------------------------------------------- */

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>

#define PLUGIN_TITLE        "Kill assist (for CS)"
#define PLUGIN_VERSION        "1.1b"
#define PLUGIN_AUTHOR        "Digi (a.k.a. Hunter-Digital)"

#define MAXPLAYERS        32+1 // leave my +1 alone >:P

#define TEAM_NONE            0
#define TEAM_TE            1
#define TEAM_CT            2
#define TEAM_SPEC            3

#define is_player(%1) (1 <= %1 <= g_iMaxPlayers)

new msgID_sayText
new msgID_deathMsg
new msgID_scoreInfo
new msgID_money

new pCVar_amxMode

new pCVar_enabled
new pCVar_minDamage
new pCVar_giveFrags
new pCVar_giveMoney
new pCVar_onlyAlive

new ch_pCVar_enabled
new ch_pCVar_minDamage
new ch_pCVar_giveFrags
new ch_pCVar_giveMoney
new ch_pCVar_onlyAlive

new g_szName[MAXPLAYERS][32]
new g_iTeam[MAXPLAYERS]
new g_iDamage[MAXPLAYERS][MAXPLAYERS]
new bool:g_bAlive[MAXPLAYERS] = {false, ...}
new bool:g_bOnline[MAXPLAYERS] = {false, ...}

new g_iLastAmxMode
new g_iMaxPlayers = 0
new bool:g_bAmxModeExists = false

public plugin_init()
{
    register_plugin(PLUGIN_TITLE, PLUGIN_VERSION, PLUGIN_AUTHOR)
    register_cvar("plugin_killassist", PLUGIN_VERSION, FCVAR_SERVER)

    pCVar_enabled = register_cvar("amx_killassist_enabled", "1")
    pCVar_minDamage = register_cvar("amx_killassist_mindamage", "50")
    pCVar_giveFrags = register_cvar("amx_killassist_givefrags", "1")
    pCVar_giveMoney = register_cvar("amx_killassist_givemoney", "300")
    pCVar_onlyAlive = register_cvar("amx_killassist_onlyalive", "0")

    if(cvar_exists("amx_mode"))
    {
        pCVar_amxMode = get_cvar_pointer("amx_mode")

        g_bAmxModeExists = true
    }

    msgID_money = get_user_msgid("Money")
    msgID_sayText = get_user_msgid("SayText")
    msgID_deathMsg = get_user_msgid("DeathMsg")
    msgID_scoreInfo = get_user_msgid("ScoreInfo")

    register_message(msgID_deathMsg, "msg_deathMsg")

    register_logevent("event_roundStart", 2, "1=Round_Start")

    register_event("Damage", "player_damage", "be", "2!0", "3=0", "4!0")
    register_event("DeathMsg", "player_die", "ae")
    register_event("TeamInfo", "player_joinTeam", "a")

    RegisterHam(Ham_Spawn, "player", "player_spawn", 1)

    g_iMaxPlayers = get_maxplayers()
}

public plugin_cfg() event_roundStart()

public event_roundStart()
{
    ch_pCVar_enabled = clamp(get_pcvar_num(pCVar_enabled), 0, 1)
    ch_pCVar_minDamage = clamp(get_pcvar_num(pCVar_minDamage), 0, 9999)
    ch_pCVar_giveFrags = clamp(get_pcvar_num(pCVar_giveFrags), 0, 1)
    ch_pCVar_giveMoney = clamp(get_pcvar_num(pCVar_giveMoney), 0, 16000)
    ch_pCVar_onlyAlive = clamp(get_pcvar_num(pCVar_onlyAlive), 0, 1)
}

public client_putinserver(iPlayer)
{
    g_bOnline[iPlayer] = true

    get_user_name(iPlayer, g_szName[iPlayer], 31)
}

public client_disconnect(iPlayer)
{
    g_iTeam[iPlayer] = TEAM_NONE
    g_bAlive[iPlayer] = false
    g_bOnline[iPlayer] = false
}

public player_joinTeam()
{
    static iPlayer, szTeam[2]

    iPlayer = read_data(1)
    read_data(2, szTeam, 1)

    switch(szTeam[0])
    {
        case 'T': g_iTeam[iPlayer] = TEAM_TE
        case 'C': g_iTeam[iPlayer] = TEAM_CT
        default: g_iTeam[iPlayer] = TEAM_SPEC // since you can't transfer yourself to unsigned team...
    }

    return PLUGIN_CONTINUE
}

public player_spawn(iPlayer)
{
    if(!is_user_alive(iPlayer))
        return HAM_IGNORED

    g_bAlive[iPlayer] = true // he's alive !

    static p, szName[32]

    get_user_name(iPlayer, szName, 31)

    if(!equali(szName, g_szName[iPlayer])) // make sure he has his name !
    {
        set_msg_block(msgID_sayText, BLOCK_ONCE)
        set_user_info(iPlayer, "name", g_szName[iPlayer])
    }

    // reset damage meters

    for(p = 1; p <= g_iMaxPlayers; p++)
        g_iDamage[iPlayer][p] = 0

    return HAM_IGNORED
}

public player_damage(iVictim)
{
    if(!ch_pCVar_enabled || !is_player(iVictim))
        return PLUGIN_CONTINUE

    static iAttacker

    iAttacker = get_user_attacker(iVictim)

    if(!is_player(iAttacker))
        return PLUGIN_CONTINUE

    g_iDamage[iAttacker][iVictim] += read_data(2)

    return PLUGIN_CONTINUE
}

public player_die()
{
    if(!ch_pCVar_enabled)
        return PLUGIN_CONTINUE

    static iVictim, iKiller

    iVictim = read_data(2)
    iKiller = read_data(1)

    if(!is_player(iVictim))
        return PLUGIN_CONTINUE

    g_bAlive[iVictim] = false

    if(!is_player(iKiller))
        return PLUGIN_CONTINUE

    static szWeapon[24], iHS, iKillerTeam

    iKillerTeam = g_iTeam[iKiller]
    iHS = read_data(3)
    read_data(4, szWeapon, 23)

    if(iKiller != iVictim && g_iTeam[iVictim] != iKillerTeam)
    {
        static iKiller2, iDamage2, p

        iKiller2 = 0
        iDamage2 = 0

        for(p = 1; p <= g_iMaxPlayers; p++)
        {
            if(p != iKiller && g_bOnline[p] && (ch_pCVar_onlyAlive && g_bAlive[p] || !ch_pCVar_onlyAlive) && iKillerTeam == g_iTeam[p] && g_iDamage[p][iVictim] >= ch_pCVar_minDamage && g_iDamage[p][iVictim] > iDamage2)
            {
                iKiller2 = p
                iDamage2 = g_iDamage[p][iVictim]
            }

            g_iDamage[p][iVictim] = 0
        }

        if(iKiller2 > 0 && iDamage2 > ch_pCVar_minDamage)
        {
            if(ch_pCVar_giveFrags)
            {
                static iFrags

                iFrags = get_user_frags(iKiller2)+1

                set_user_frags(iKiller2, iFrags)

                message_begin(MSG_ALL, msgID_scoreInfo)
                write_byte(iKiller2)
                write_short(iFrags)
                write_short(get_user_deaths(iKiller2))
                write_short(0)
                write_short(iKillerTeam)
                message_end()
            }

            if(ch_pCVar_giveMoney)
            {
                static iMoney

                iMoney = cs_get_user_money(iKiller2) + ch_pCVar_giveMoney

                if(iMoney > 16000)
                    iMoney = 16000

                cs_set_user_money(iKiller2, iMoney)

                if(g_bAlive[iKiller2]) // no reason to send a money message when the player has no hud :}
                {
                    message_begin(MSG_ONE_UNRELIABLE, msgID_money, _, iKiller2)
                    write_long(iMoney)
                    write_byte(1)
                    message_end()
                }
            }

            static szName1[32], iName1Len, szName2[32], iName2Len, szNames[32], szWeaponLong[32]

            iName1Len = get_user_name(iKiller, szName1, 31)
            iName2Len = get_user_name(iKiller2, szName2, 31)

            g_szName[iKiller] = szName1

            if(iName1Len < 14)
            {
                   formatex(szName1, iName1Len, "%s", szName1)
                   formatex(szName2, 28-iName1Len, "%s", szName2)
            }
            else if(iName2Len < 14)
            {
                   formatex(szName1, 28-iName2Len, "%s", szName1)
                   formatex(szName2, iName2Len, "%s", szName2)
            }
            else
            {
                   formatex(szName1, 13, "%s", szName1)
                   formatex(szName2, 13, "%s", szName2)
            }

            formatex(szNames, 31, "%s + %s", szName1, szName2)

            set_msg_block(msgID_sayText, BLOCK_ONCE)
            set_user_info(iKiller, "name", szNames)

            if(g_bAmxModeExists)
            {
                g_iLastAmxMode = get_pcvar_num(pCVar_amxMode)

                set_pcvar_num(pCVar_amxMode, 0)
            }

            if(equali(szWeapon, "grenade"))
                szWeaponLong = "weapon_hegrenade"
            else
                formatex(szWeaponLong, 31, "weapon_%s", szWeapon)

            static args[4]

            args[0] = iVictim
            args[1] = iKiller
            args[2] = iHS
            args[3] = get_weaponid(szWeaponLong)

            set_task(0.1, "player_diePost", 0, args, 4)
        }
        else
            do_deathmsg(iKiller, iVictim, iHS, szWeapon)
    }
    else
        do_deathmsg(iKiller, iVictim, iHS, szWeapon)

    return PLUGIN_CONTINUE
}

public player_diePost(arg[])
{
    static iKiller, szWeapon[24]

    iKiller = arg[1]

    get_weaponname(arg[3], szWeapon, 23)
    replace(szWeapon, 23, "weapon_", "")

    do_deathmsg(iKiller, arg[0], arg[2], szWeapon)

    set_msg_block(msgID_sayText, BLOCK_ONCE)
    set_user_info(iKiller, "name", g_szName[iKiller])

    if(g_bAmxModeExists)
        set_pcvar_num(pCVar_amxMode, g_iLastAmxMode)

    return PLUGIN_CONTINUE
}

public msg_deathMsg() return ch_pCVar_enabled ? PLUGIN_HANDLED : PLUGIN_CONTINUE

/* originally from messages_stocks.inc, a little modified, added vars and blablabla :P */
stock do_deathmsg(iKiller, iVictim, iHS, const szWeapon[])
{
    message_begin(MSG_ALL, msgID_deathMsg)
    write_byte(iKiller)
    write_byte(iVictim)
    write_byte(iHS)
    write_string(szWeapon)
    message_end()
}

/* --------------------------------------------------------------------------
    EOF
        -------------------------------------------------------------- */


Еще один вопрос касающийся плагина Vip weapon. При написании в чат /vipka, открывается окно, что дают VIP привилегии и как их можно купить. Данный плагин я отключил на aim, awp, sk, 35hp мапах. И как Вы поняли, при написании /vipka, ничего не происходит.
Скажите пожалуйста, возможно ли как то его настроить, что бы оружие не выдавалось VIP игрокам, а окно с информацией показывалось? Или же написать отдельный плагин? (пробовал сам, но ничего не получилось :()
Vip weapon.sma
Код
/*
*-------------------Информация--------------------*
*
* Название: Vip_weapon
* Автор: 7eVen
* Версия: 1.1
* Последнее обновление: 19.12.2012
* Посетите сайт: http://lancs.ru/
*
*-------------------------------------------------*
*
*-------------------Переменные--------------------*
*     
* amx_vip_give [По умолчанию: 3]
* - Количество раундов, после которых оружия
* - будет доступно.
*
*-------------------------------------------------*
*
*----------------История изменений----------------*
*
* 1.0:
*    [!] Первый релиз.
*
* 1.1:
*    [!] Полная оптимизация кода.
*    [*] Фикс некоторых ошибок.
*    [+] При выдачи Deagle второе оружия убирается.
*     [+] Добавлен квар amx_vip_give.
*
*-------------------------------------------------*
*
*----------------------P.S------------------------*
*
* Пишу плагины, на заказ. Skype magoga25
*
*-------------------------------------------------*
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta_util>

#define VIP_FLAG ADMIN_LEVEL_H

new pistols[6] = {CSW_P228, CSW_ELITE, CSW_FIVESEVEN, CSW_GALIL, CSW_USP, CSW_GLOCK18}

new round_number, g_round
new bool:has_used[32]

public plugin_init()
{
    register_plugin("Vip_weapon", "1.1", "7eVen")
    
    register_event("ResetHUD", "ResetHUD", "be")
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    
    register_clcmd("vipmenu", "vip_menu")
    
    register_clcmd("say /adminka", "adminka")
    register_clcmd("say /vipka","vipka")
    
    g_round = register_cvar("amx_vip_give", "3")
}

public vip_menu(id)
{
    if ( ! ( get_user_flags ( id ) & VIP_FLAG )  )  
    {
        ChatColor ( id, "^3[^4 V.I.P^3 ] ^1 Только для ^4[V.I.P]")
        return PLUGIN_HANDLED;
    }    
    
    new menu = menu_create("\r Оружейка \w[\y V.I.P \w]", "show_vipmenu")

    menu_additem(menu, "\wВзять \r[\y Famas \r]\r", "1")
    menu_additem(menu, "\wВзять \r[\y M4A1 \r]\r", "2")
    menu_additem(menu, "\wВзять \r[\y AK47 \r]\r", "3")
    menu_additem(menu, "\wВзять \r[\y AWP \r]\r", "4")
    
    menu_setprop(menu, MPROP_NEXTNAME, "Дальше")
    menu_setprop(menu, MPROP_BACKNAME, "Назад")
    menu_setprop(menu, MPROP_EXITNAME, "Выход")
    menu_setprop(menu, MPROP_EXIT,MEXIT_ALL)
        
    menu_display(id,menu,0)
    return PLUGIN_HANDLED;
}

public show_vipmenu(id, menu, item)
{    
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED;
    }
    
    if(is_user_alive(id)&& !has_used[id] )
    {
    
    if ( round_number <= get_pcvar_num(g_round) )
    {
        ChatColor ( id, "^3[^4 V.I.P^3 ] ^1 Доступно со %d раунда!", get_pcvar_num(g_round) )
        return PLUGIN_HANDLED;
    }  
    
    new data[6], iName[64], access, callback
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
        
    new key = str_to_num(data)
        
    switch(key)
    {
        case 1:
        {
            give_item( id, "weapon_famas" )
            cs_set_user_bpammo( id , CSW_FAMAS, 90 )
        }
        case 2:
        {
            give_item( id, "weapon_m4a1" )
            cs_set_user_bpammo( id , CSW_M4A1, 90 )
        }
        case 3:
        {
            give_item( id, "weapon_ak47" )
            cs_set_user_bpammo( id , CSW_AK47, 90 )
        }
        case 4:
        {
            give_item( id, "weapon_awp" )
            cs_set_user_bpammo( id , CSW_AWP, 30 )
        }
    }
    has_used[id] = true;
    }
    else
    {
        ChatColor ( id, "^3[^4 V.I.P^3 ] ^1 Вы уже использовали.Подождите..." )
        return PLUGIN_HANDLED;
    }
    return PLUGIN_HANDLED;
}

public event_round_start ()
{
    round_number++
    arrayset(has_used, false, 32)
}

public adminka(id)
{
    show_motd( id, "adminka.txt", "Покупка - Админки!" )
}

public vipka(id)
{
    show_motd( id, "vip.txt", "Покупка - V.I.P!" )
}

public ResetHUD(id)
{
    set_task(0.5, "VIP", id + 6910)
}

public VIP(TaskID)
{
    new id = TaskID - 6910
  
    if (get_user_flags(id) & VIP_FLAG && is_user_connected(id) && is_user_alive(id))
    {
        for (new i = 0; i < 6; i++)
        {
            if (fm_strip_user_gun(id, pistols[i]))
            {
                break;
            }    
            message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
            write_byte(id)
            write_byte(4)
            message_end()    
            give_item( id, "weapon_hegrenade" )
            give_item( id, "weapon_flashbang" )
            give_item( id, "weapon_flashbang" )
            give_item( id, "weapon_smokegrenade" )
            give_item( id, "item_assaultsuit" )
            give_item( id, "item_thighpack" )
            give_item( id, "weapon_deagle")
        
            give_item( id, "ammo_50ae" )
            give_item( id, "ammo_50ae" )
            give_item( id, "ammo_50ae" )
            give_item( id, "ammo_50ae" )
            give_item( id, "ammo_50ae" )    
        }
    }
    return PLUGIN_HANDLED;
}

stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!g", "^4") // Green Color
    replace_all(msg, 190, "!y ", "^1") // Default Color
    replace_all(msg, 190, "!team", "^3") // Team Color
    replace_all(msg, 190, "!team2", "^0") // Team2 Color
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}

Буду весьма признателен за оказанную помощь
i
Уведомление:
Неверный раздел, тщательно выбирайте раздел для новых тем, перенёс.


Отредактировал: iShot, - 17.7.2016, 17:17
Причина: Выдано устное предупреждение!
Прикрепленные файлы:
Прикрепленный файл  vip_weapon.sma ( 5,48 килобайт ) Кол-во скачиваний: 7
Прикрепленный файл  kill_assist.sma ( 9,85 килобайт ) Кол-во скачиваний: 11


TOP SERVER IN THE WORLD!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: