Модификация объединение 2х плагинов

Сообщения
15
Реакции
-3
Просьба объединить
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DeXTeR"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

register_event("HLTV", "reset_score", "a", "1=0", "2=0")
}

public reset_score(id) {
new frags = cs_get_user_frags(id);
new deaths = cs_get_user_deaths(id);

if(frags == 0 || frags == 1 || deaths == 0 || deaths == 1)
{
cs_set_user_deaths(id, 0)
cs_set_user_frags(id, 0)
}
return PLUGIN_HANDLED
}

И

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

#define adtime 300.0 //Default of 10 minuites

new pcvar_Advertise
new pcvar_Display

public plugin_init()
{
register_plugin("Reset Score", "v.1", "Help")

register_clcmd("say /rs", "reset_score")
register_clcmd("say /resetscore", "reset_score")
register_clcmd("say_team /rs", "reset_score")
register_clcmd("say_team /resetscore", "reset_score")

pcvar_Advertise = register_cvar("sv_rsadvertise", "1")
pcvar_Display = register_cvar("sv_rsdisplay", "1")
if(get_cvar_num("sv_rsadvertise") == 1)
{
set_task(adtime, "advertise", _, _, _, "b")
}

register_cvar("amx_rstune", "1")
}

public reset_score(id)
{
cs_set_user_deaths(id, 0)
set_user_frags(id, 0)
cs_set_user_deaths(id, 0)
set_user_frags(id, 0)

if(get_pcvar_num(pcvar_Display) == 1)
{
new name[33]
get_user_name(id, name, 32)

ChatColor(id, "^1* ^4-^1> !gУважаемый игрок !t%s, !gваш счёт успешно обнулён", name)
if (get_cvar_num("amx_rstune") != 0)
{
client_cmd(id,"spk buttons/bell1.wav")
}
}
}


public advertise()
{
set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.71, 2, 6.0, 3.0, 0.1, 1.5 );
show_dhudmessage(0, "Напишите /rs для обнуления счёта");
}

public client_putinserver(id)
{
if(get_pcvar_num(pcvar_Advertise) == 1)
{
set_task(10.0, "connectmessage", id, _, _, "a", 1)
}
}

public connectmessage(id)
{
if(is_user_connected(id))
{
ChatColor(id, "^1* ^4-^1> ^4Учись играть, а не ^1/rs !yписать ^3Т_Т")
}
}

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")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
write_byte(players);
write_string(msg);
message_end();
}
}
}
}
 

Download all Attachments

Сообщения
19
Реакции
7
Код:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <dhudmessage>

#define adtime 300.0 //Default of 10 minuites

new pcvar_Advertise
new pcvar_Display

public plugin_init()
{
    register_plugin("Reset Score", "v.1", "Help")
    // Edit Eryk172 for SiJey ( dev-cs.ru )

    register_clcmd("say /rs", "reset_score")
    register_clcmd("say /resetscore", "reset_score")
    register_clcmd("say_team /rs", "reset_score")
    register_clcmd("say_team /resetscore", "reset_score")

    register_event("HLTV", "reset_score", "a", "1=0", "2=0")
    
    pcvar_Advertise = register_cvar("sv_rsadvertise", "1")
    pcvar_Display = register_cvar("sv_rsdisplay", "1")
    if(get_cvar_num("sv_rsadvertise") == 1)
    {
        set_task(adtime, "advertise", _, _, _, "b")
    }

    register_cvar("amx_rstune", "1")
}

public reset_score(id)
{
    new frags = cs_get_user_frags(id);
    new deaths = cs_get_user_deaths(id);
    
    if(frags != 0 || frags != 1 || deaths != 0 || deaths != 1)
    return;
    
    cs_set_user_deaths(id, 0)
    set_user_frags(id, 0)
    cs_set_user_deaths(id, 0)
    set_user_frags(id, 0)

    if(get_pcvar_num(pcvar_Display) == 1)
    {
        new name[33]
        get_user_name(id, name, 32)

        ChatColor(id, "^1* ^4-^1> !gУважаемый игрок !t%s, !gваш счёт успешно обнулён", name)
        if (get_cvar_num("amx_rstune") != 0)
        {
            client_cmd(id,"spk buttons/bell1.wav")
        }
    }
}


public advertise()
{
    set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.71, 2, 6.0, 3.0, 0.1, 1.5 );
    show_dhudmessage(0, "Напишите /rs для обнуления счёта");
}

public client_putinserver(id)
{
    if(get_pcvar_num(pcvar_Advertise) == 1)
    {
        set_task(10.0, "connectmessage", id, _, _, "a", 1)
    }
}

public connectmessage(id)
{
    if(is_user_connected(id))
    {
        ChatColor(id, "^1* ^4-^1> ^4Учись играть, а не ^1/rs !yписать ^3Т_Т")
    }
}

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")
    replace_all(msg, 190, "!y", "^1")
    replace_all(msg, 190, "!t", "^3")

    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
                write_byte(players);
                write_string(msg);
                message_end();
            }
        }
    }
}
 
Сообщения
15
Реакции
-3
eryk172, ага спасибо, так и я могу, я имел ввиду чтобы во 2ой плагин добавить автоматическое обнуление счёта из первого
 

Вложения

Сообщения
19
Реакции
7
Код:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
//#include <colorchat>
//#include <dhudmessage>

#define adtime 300.0 //Default of 10 minuites

new pcvar_Advertise
new pcvar_Display

public plugin_init()
{
    register_plugin("Reset Score", "v.1", "Help")
    // Edit Eryk172 for SiJey ( dev-cs.ru )

    register_clcmd("say /rs", "reset_score")
    register_clcmd("say /resetscore", "reset_score")
    register_clcmd("say_team /rs", "reset_score")
    register_clcmd("say_team /resetscore", "reset_score")

    register_event("HLTV", "reset_score", "a", "1=0", "2=0")
   
    pcvar_Advertise = register_cvar("sv_rsadvertise", "1")
    pcvar_Display = register_cvar("sv_rsdisplay", "1")
    if(get_cvar_num("sv_rsadvertise") == 1)
    {
        set_task(adtime, "advertise", _, _, _, "b")
    }

    register_cvar("amx_rstune", "1")
}

public reset_score(id)
{
    new frags = get_user_frags(id);
    new deaths = get_user_deaths(id);
   
    if(frags != 0 || frags != 1 || deaths != 0 || deaths != 1)
    return;
   
    cs_set_user_deaths(id, 0)
    set_user_frags(id, 0)
    cs_set_user_deaths(id, 0)
    set_user_frags(id, 0)

    if(get_pcvar_num(pcvar_Display) == 1)
    {
        new name[33]
        get_user_name(id, name, 32)

        client_print_color(id, id, "^1* ^4-^1> !gУважаемый игрок !t%s, !gваш счёт успешно обнулён", name)
        if (get_cvar_num("amx_rstune") != 0)
        {
            client_cmd(id,"spk buttons/bell1.wav")
        }
    }
}


public advertise()
{
    set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.71, 2, 6.0, 3.0, 0.1, 1.5 );
    show_dhudmessage(0, "Напишите /rs для обнуления счёта");
}

public client_putinserver(id)
{
    if(get_pcvar_num(pcvar_Advertise) == 1)
    {
        set_task(10.0, "connectmessage", id, _, _, "a", 1)
    }
}

public connectmessage(id)
{
    if(is_user_connected(id))
    {
        client_print_color(id, id,  "^1* ^4-^1> ^4Учись играть, а не ^1/rs !yписать ^3Т_Т")
    }
}
1546703247579.png
If you have error, uncomment this:
//#include <colorchat>
//#include <dhudmessage>
 
Сообщения
1,420
Реакции
2,511
Помог
58 раз(а)
eryk172, it's a good try, but it will not work as expected due to:
if(frags != 0 || frags != 1 || deaths != 0 || deaths != 1)

Here is my edition.
AMX Mod X 1.9.0 + ReAPI.

Код:
/*
* Author: https://t.me/twisternick
* Request: https://dev-cs.ru/threads/4853
*/

#include <amxmodx>
#include <amxmisc>
#include <reapi>

#pragma semicolon 1

#define PLUGIN_VERSION "0.1"

/****************************************************************************************
****************************************************************************************/

enum _:CVARS
{
    CVAR_ADVERTISE,
    Float:CVAR_ADVERTISE_TIME,
    CVAR_DISPLAY,
    CVAR_SOUND
};

new g_eCvar[CVARS];

public plugin_init()
{
    register_plugin("RS NewRound + Command", PLUGIN_VERSION, "w0w");
    register_dictionary("rs_nrc.txt");

    register_clcmd("say /rs", "func_ResetScore");
    register_clcmd("say /resetscore", "func_ResetScore");
    register_clcmd("say_team /rs", "func_ResetScore");
    register_clcmd("say_team /resetscore", "func_ResetScore");

    RegisterHookChain(RG_CSGameRules_RestartRound, "refwd_NewRound_Post", true);

    new pCvar;

    pCvar = create_cvar("rs_nrc_advertise", "1", FCVAR_NONE, fmt("%L", LANG_SERVER, "RS_NRC_CVAR_ADVERTISE"), true, 0.0, true, 1.0);
    bind_pcvar_num(pCvar, g_eCvar[CVAR_ADVERTISE]);

    pCvar = create_cvar("rs_nrc_advertise", "300.0", FCVAR_NONE, fmt("%L", LANG_SERVER, "RS_NRC_CVAR_ADVERTISE_TIME"), true, 1.0);
    bind_pcvar_float(pCvar, g_eCvar[CVAR_ADVERTISE_TIME]);

    pCvar = create_cvar("rs_nrc_display", "1", FCVAR_NONE, fmt("%L", LANG_SERVER, "RS_NRC_CVAR_DISPLAY"), true, 0.0, true, 1.0);
    bind_pcvar_num(pCvar, g_eCvar[CVAR_DISPLAY]);

    pCvar = create_cvar("rs_nrc_sound", "1", FCVAR_NONE, fmt("%L", LANG_SERVER, "RS_NRC_CVAR_SOUND"), true, 0.0, true, 1.0);
    bind_pcvar_num(pCvar, g_eCvar[CVAR_SOUND]);

    AutoExecConfig(true, "rs_newround_command");

    if(g_eCvar[CVAR_ADVERTISE])
        set_task_ex(g_eCvar[CVAR_ADVERTISE_TIME], "task_Advertise", .flags = SetTask_Repeat);
}

public refwd_NewRound_Post()
{
    new iPlayers[MAX_PLAYERS], iPlayerCount;
    get_players(iPlayers, iPlayerCount);

    for(new i, iPlayer; i < iPlayerCount; i++)
    {
        iPlayer = iPlayers[i];

        new Float:flFrags = get_entvar(iPlayer, var_frags);
        new iDeaths = get_member(iPlayer, m_iDeaths);

        if(flFrags <= 1 || iDeaths <= 1)
        {
            set_entvar(iPlayer, var_frags, 0.0);
            set_member(iPlayer, m_iDeaths, 0);
        }
    }
}

public func_ResetScore(id)
{
    new Float:flFrags = get_entvar(id, var_frags);
    new iDeaths = get_member(id, m_iDeaths);

    if(iDeaths == 0 && flFrags == 0.0)
    {
        client_print_color(id, print_team_red, "%l", "RS_NRC_ERROR_RESET");
        return PLUGIN_CONTINUE;
    }

    set_entvar(id, var_frags, 0.0);
    set_member(id, m_iDeaths, 0);

    if(g_eCvar[CVAR_DISPLAY])
    {
        client_print_color(id, print_team_default, "%l", "RS_NRC_RESETED");

        if(g_eCvar[CVAR_SOUND])
            rg_send_audio(id, "buttons/bell1.wav");
    }

    return PLUGIN_HANDLED;
}

public task_Advertise()
{
    set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.71, 2, 6.0, 3.0, 0.1, 1.5);
    show_dhudmessage(0, "%l", "RS_NRC_ADVERTISE_MESSAGE");
}

public client_putinserver(id)
{
    if(g_eCvar[CVAR_ADVERTISE])
        set_task_ex(10.0, "task_ConnectMessage", id, .flags = SetTask_RepeatTimes, .repeat = 1);
}

public task_ConnectMessage(id)
{
    if(is_user_connected(id))
        client_print_color(id, print_team_default, "%l", "RS_NRC_CONNECT_MESSAGE");
}
amxmodx/data/lang/rs_nrc.txt:
Код:
[ru]
RS_NRC_ERROR_RESET = ^3* ^1Вы не можете обновить счёт в данный момент
RS_NRC_RESETED = ^4* ^1Вы успешно обновили счёт!
RS_NRC_ADVERTISE_MESSAGE = Вы можете обновить счёт введя в чат /rs
RS_NRC_CONNECT_MESSAGE = ^4* ^1Вы можете обновить счёт введя в чат /rs

RS_NRC_CVAR_ADVERTISE = Нужно ли оповещение DHUD
RS_NRC_CVAR_ADVERTISE_TIME = Каждые сколько секунд будет появляться оповещение DHUD
RS_NRC_CVAR_DISPLAY = Отображать ли сообщение игроку при сбрасывании счета через команду
RS_NRC_CVAR_SOUND = Нужно ли проигрывать звук игроку при сбрасывании счета через команду
 
Последнее редактирование:

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

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