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

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

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

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

плагин resetscore

, сделать цветное сообщение
Статус пользователя Legenda
сообщение 10.10.2010, 15:57
Сообщение #1


Иконка группы

Стаж: 16 лет

Сообщений: 3619
Благодарностей: 1706
Полезность: 1010

Меценат Меценат

очень интересует как сделать что бы сообщение выводилось цветным.

т.е.
Код
"%s $tобнулил(a) свой счет командой /rs"

Ник игрока должен быть красным или другого цвета
остальное сообщение обычного цвета
/rs - зеленым цветом выделялось.

Код
/*
   This is a simple plugin I made that will just restart a players score
   making their deaths and kills set to 0, this is to help players out a
   little bit because they no longer have to reconnect or retry if they
   want their score to start over, they can just type a simple command
  
      ---------------------------------
       --------- MADE BY SILENTTT -----
        ------ MADE BY SILENTTT ------
         --  MADE BY SILENTTT -------
        ------ MADE BY SILENTTT ------
       --------- MADE BY SILENTTT -----
      ---------------------------------
*/

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

#define adtime     600.0 //Default of 10 minuites

new pcvar_Advertise
new pcvar_Display

public plugin_init()
{
    register_plugin("Reset Score", "1.0", "Silenttt")
    
    //You may type /resetscore or /restartscore
    register_clcmd("say /resetscore", "reset_score")
    register_clcmd("say /restartscore", "reset_score")
    register_clcmd("say /rs", "reset_score")
    register_clcmd("say /retry", "reset_score")
    //This command by default will be set at 0
    //Change it to 1 in server.cfg if you want
    //A message to be shown to advertise this.
    pcvar_Advertise = register_cvar("sv_rsadvertise", "0")
    //This command by default is also 0
    //Change it to 1 in server.cfg if you want
    //It to show who reset their scores when they do it
    pcvar_Display = register_cvar("sv_rsdisplay", "0")
    
    if(get_cvar_num("sv_rsadvertise") == 1)
    {
        set_task(adtime, "advertise", _, _, _, "b")
    }
}

public reset_score(id)
{
    //These both NEED to be done twice, otherwise your frags wont
    //until the next round
    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(0, print_chat, "%s $tобнулил(a) свой счет командой /rs", name)
    }
    else
    {
        client_print(id, print_chat, "Вы обнулили свой счет")
    }
}

public advertise()
{
    set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
    show_hudmessage(0, "Используйте /resetscore для сброса счета")
}

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(id, print_chat, "Наберите в чат /resetscore для сброса счета")
    }
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Rejiser
сообщение 10.10.2010, 16:08
Сообщение #2


Стаж: 15 лет

Сообщений: 2261
Благодарностей: 1068
Полезность: 870

инклуд колорчата нужен
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Legenda
сообщение 10.10.2010, 16:14
Сообщение #3


Иконка группы

Стаж: 16 лет

Сообщений: 3619
Благодарностей: 1706
Полезность: 1010

Меценат Меценат

подробнее можно ?
такой код?

Код
/*
   This is a simple plugin I made that will just restart a players score
   making their deaths and kills set to 0, this is to help players out a
   little bit because they no longer have to reconnect or retry if they
   want their score to start over, they can just type a simple command
  
      ---------------------------------
       --------- MADE BY SILENTTT -----
        ------ MADE BY SILENTTT ------
         --  MADE BY SILENTTT -------
        ------ MADE BY SILENTTT ------
       --------- MADE BY SILENTTT -----
      ---------------------------------
*/

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

/*Color Chat*/
#define MAXSLOTS 32

enum ChatColor
{
    CHATCOLOR_NORMAL = 1,
    CHATCOLOR_GREEN,
    CHATCOLOR_TEAM_COLOR,
    CHATCOLOR_GREY,     
    CHATCOLOR_RED,         
    CHATCOLOR_BLUE,     
}

new g_TeamName[][] =
{
    "",
    "TERRORIST",
    "CT",
    "SPECTATOR"
}

#define adtime     600.0 //Default of 10 minuites

new pcvar_Advertise
new pcvar_Display

public plugin_init()
{
    register_plugin("Reset Score", "1.0", "Silenttt")
    
    //You may type /resetscore or /restartscore
    register_clcmd("say /resetscore", "reset_score")
    register_clcmd("say /restartscore", "reset_score")
    register_clcmd("say /rs", "reset_score")
    register_clcmd("say /retry", "reset_score")
    //This command by default will be set at 0
    //Change it to 1 in server.cfg if you want
    //A message to be shown to advertise this.
    pcvar_Advertise = register_cvar("sv_rsadvertise", "0")
    //This command by default is also 0
    //Change it to 1 in server.cfg if you want
    //It to show who reset their scores when they do it
    pcvar_Display = register_cvar("sv_rsdisplay", "0")
    
    if(get_cvar_num("sv_rsadvertise") == 1)
    {
        set_task(adtime, "advertise", _, _, _, "b")
    }
}

public reset_score(id)
{
    //These both NEED to be done twice, otherwise your frags wont
    //until the next round
    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(0, print_chat, "%s $tобнулил(a) свой счет командой /rs", name)
    }
    else
    {
        client_print(id, print_chat, "Вы обнулили свой счет")
    }
}

public advertise()
{
    set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
    show_hudmessage(0, "Используйте /resetscore для сброса счета")
}

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(id, print_chat, "Наберите в чат /resetscore для сброса счета")
    }
}


Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Rejiser
сообщение 10.10.2010, 19:58
Сообщение #4


Стаж: 15 лет

Сообщений: 2261
Благодарностей: 1068
Полезность: 870

Вот, инструкция внутри прилагается
Прикрепленный файл  Colored_messages.rar ( 3,51 килобайт ) Кол-во скачиваний: 127
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Legenda
сообщение 10.10.2010, 22:18
Сообщение #5


Иконка группы

Стаж: 16 лет

Сообщений: 3619
Благодарностей: 1706
Полезность: 1010

Меценат Меценат

Цитата(Rejiser @ 10.10.2010, 20:58) *
Вот, инструкция внутри прилагается
Прикрепленный файл  Colored_messages.rar ( 3,51 килобайт ) Кол-во скачиваний: 127

спасибо
тему можно закрывать
все сделал)

кому нужен код
то
код
/*
This is a simple plugin I made that will just restart a players score
making their deaths and kills set to 0, this is to help players out a
little bit because they no longer have to reconnect or retry if they
want their score to start over, they can just type a simple command

---------------------------------
--------- MADE BY SILENTTT -----
------ MADE BY SILENTTT ------
-- MADE BY SILENTTT -------
------ MADE BY SILENTTT ------
--------- MADE BY SILENTTT -----
---------------------------------
*/

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

#define adtime 600.0 //Default of 10 minuites

new pcvar_Advertise
new pcvar_Display

public plugin_init()
{
register_plugin("Reset Score", "1.0", "Silenttt")

//You may type /resetscore or /restartscore
register_clcmd("say /resetscore", "reset_score")
register_clcmd("say /restartscore", "reset_score")
register_clcmd("say /rs", "reset_score")
register_clcmd("say /retry", "reset_score")
//This command by default will be set at 0
//Change it to 1 in server.cfg if you want
//A message to be shown to advertise this.
pcvar_Advertise = register_cvar("sv_rsadvertise", "0")
//This command by default is also 0
//Change it to 1 in server.cfg if you want
//It to show who reset their scores when they do it
pcvar_Display = register_cvar("sv_rsdisplay", "0")

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

public reset_score(id)
{
//These both NEED to be done twice, otherwise your frags wont
//until the next round
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)
ColorChat(0,GREEN," ^x04 [Игрок:] ^x03 %s ^x01 обнулил(a) свой счет командой ^x04 /rs ",name)
}
else
{
client_print(id, print_chat, "Вы обнулили свой счет")
}
}

public advertise()
{
set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
show_hudmessage(0, "Используйте /resetscore для сброса счета")
}

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(id, print_chat, "Наберите в чат /resetscore для сброса счета")
}
}


компилируем и не забываем в scripting\include положить файл colorchat.inc
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 4 раз
   + Цитировать сообщение
Статус пользователя kakaska
сообщение 25.9.2011, 13:23
Сообщение #6
Стаж: 15 лет

Сообщений: 19
Благодарностей: 1
Полезность: 0

Цитата(Legenda @ 10.10.2010, 23:18) *
спасибо
тему можно закрывать
все сделал)

кому нужен код
то
код
/*
This is a simple plugin I made that will just restart a players score
making their deaths and kills set to 0, this is to help players out a
little bit because they no longer have to reconnect or retry if they
want their score to start over, they can just type a simple command

---------------------------------
--------- MADE BY SILENTTT -----
------ MADE BY SILENTTT ------
-- MADE BY SILENTTT -------
------ MADE BY SILENTTT ------
--------- MADE BY SILENTTT -----
---------------------------------
*/

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

#define adtime 600.0 //Default of 10 minuites

new pcvar_Advertise
new pcvar_Display

public plugin_init()
{
register_plugin("Reset Score", "1.0", "Silenttt")

//You may type /resetscore or /restartscore
register_clcmd("say /resetscore", "reset_score")
register_clcmd("say /restartscore", "reset_score")
register_clcmd("say /rs", "reset_score")
register_clcmd("say /retry", "reset_score")
//This command by default will be set at 0
//Change it to 1 in server.cfg if you want
//A message to be shown to advertise this.
pcvar_Advertise = register_cvar("sv_rsadvertise", "0")
//This command by default is also 0
//Change it to 1 in server.cfg if you want
//It to show who reset their scores when they do it
pcvar_Display = register_cvar("sv_rsdisplay", "0")

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

public reset_score(id)
{
//These both NEED to be done twice, otherwise your frags wont
//until the next round
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)
ColorChat(0,GREEN," ^x04 [Игрок:] ^x03 %s ^x01 обнулил(a) свой счет командой ^x04 /rs ",name)
}
else
{
client_print(id, print_chat, "Вы обнулили свой счет")
}
}

public advertise()
{
set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
show_hudmessage(0, "Используйте /resetscore для сброса счета")
}

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(id, print_chat, "Наберите в чат /resetscore для сброса счета")
}
}


компилируем и не забываем в scripting\include положить файл colorchat.inc

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