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

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

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

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

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

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

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

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

Префиксы

Статус пользователя zloykenny
сообщение 13.12.2016, 12:27
Сообщение #1
Стаж: 9 лет 5 месяцев

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

Подскажите пожалуйста как в плагины добавить префикс например /rs

else
{
client_print(id, print_chat, "Ваш счёт успешно обнулён")
}

А сделать вот так
[RS] Ваш счёт успешно обнулён
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя ssx
сообщение 13.12.2016, 14:10
Сообщение #2


Стаж: 12 лет

Сообщений: 2237
Благодарностей: 1343
Полезность: 836

zloykenny,

Код:
client_print(id, print_chat, "[RS] Ваш счёт успешно обнулён!") 


[Half-Life DM FFA] 78.152.169.100:27016
[CS 1.6 GunGame] 78.152.169.100:27018
[CS 1.6 DM AIM] 78.152.169.100:27017
[CS 1.6 DM FFA] 78.152.169.100:27015
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя zloykenny
сообщение 13.12.2016, 14:24
Сообщение #3
Стаж: 9 лет 5 месяцев

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

ssx, А цветным как сделать серез !g !y
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя ssx
сообщение 13.12.2016, 15:09
Сообщение #4


Стаж: 12 лет

Сообщений: 2237
Благодарностей: 1343
Полезность: 836

Цитата(zloykenny @ 13.12.2016, 14:24) *
ssx, А цветным как сделать серез !g !y

в поиск по форуму введи Colorchat

там еще смотря какой амхх у тебя .


Код:

#if AMXX_VERSION_NUM < 183
#include <colorchat>
#else
#define DontChange print_team_default
#define Blue print_team_blue
#define Red print_team_red
#define Grey print_team_grey
#endif

Код:
client_print_color(id, DontChange, "[^4RS^1] ^4Ваш счёт успешно обнулён!")






Отредактировал: ssx, - 13.12.2016, 15:19


[Half-Life DM FFA] 78.152.169.100:27016
[CS 1.6 GunGame] 78.152.169.100:27018
[CS 1.6 DM AIM] 78.152.169.100:27017
[CS 1.6 DM FFA] 78.152.169.100:27015
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя zloykenny
сообщение 13.12.2016, 16:35
Сообщение #5
Стаж: 9 лет 5 месяцев

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

ssx, что-то не работает
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя energydance
сообщение 13.12.2016, 16:40
Сообщение #6


Стаж: 10 лет

Сообщений: 2809
Благодарностей: 740
Полезность: 213

zloykenny, скинь исходник чтобы понятно было куда ты код вставляешь и как


Press enter to exit ...
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя zloykenny
сообщение 13.12.2016, 16:53
Сообщение #7
Стаж: 9 лет 5 месяцев

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

Оригинал. Подскажите как сделать вот так [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 /rs", "reset_score")
register_clcmd("say /resetscore", "reset_score")
register_clcmd("say /restartscore", "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 обнулил свой счёт", 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 или /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(id, print_chat, "Напишите в чате /resetscore или /rs для обнуления вашего счёта")
}
}


Отредактировал: Bloo, - 13.12.2016, 20:35
Причина: Выдано устное предупреждение!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Bloo
сообщение 13.12.2016, 20:54
Сообщение #8


Стаж: 12 лет

Сообщений: 15547
Благодарностей: 6971
Полезность: 1206

Код:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>

#define adtime 600.0 //Default of 10 minuites

/*
### ColorChat description ###
# ^1 - Normal
# ^3 - Team color
# ^4 - Green
### ###
*/

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 /rs", "reset_score")
register_clcmd("say /resetscore", "reset_score")
register_clcmd("say /restartscore", "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_color(0, DontChange, "^4[RS] ^1%s обнулил свой счёт", name)
}
else
{
client_print_color(id, DontChange, "^4[RS] ^1Ваш счёт успешно обнулён")
}
}

public advertise()
{
set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
show_hudmessage(0, "Напишите в чате /resetscore или /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, DontChange, "^4[RS] ^1Напишите в чате /resetscore или /rs для обнуления вашего счёта")
}
}

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя zloykenny
сообщение 13.12.2016, 21:23
Сообщение #9
Стаж: 9 лет 5 месяцев

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

Bloo, Что-то не хочет компилироваться:

Строка: (57) : error 017: undefined symbol "client_print_color"
Строка: (57) : warning 215: expression has no effect
Строка: (57) : warning 215: expression has no effect
Строка: (57) : error 001: expected token: ";", but found ")"
Строка: (57) : error 029: invalid expression, assumed zero
Строка: (57) : fatal error 107: too many error messages on one line
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Bloo
сообщение 13.12.2016, 21:28
Сообщение #10


Стаж: 12 лет

Сообщений: 15547
Благодарностей: 6971
Полезность: 1206

zloykenny, по тому что у вас нет инклуда.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя zloykenny
сообщение 13.12.2016, 21:32
Сообщение #11
Стаж: 9 лет 5 месяцев

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

Цитата(Bloo @ 13.12.2016, 21:28) *
zloykenny, по тому что у вас нет инклуда.


правильно ли вставил ? всё равно что-то не то...
Код:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>

#define adtime 600.0 //Default of 10 minuites

/*
### ColorChat description ###
# ^1 - Normal
# ^3 - Team color
# ^4 - Green
### ###
*/

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 /rs", "reset_score")
register_clcmd("say /resetscore", "reset_score")
register_clcmd("say /restartscore", "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_color(0, DontChange, "^1[^4RS^1] ^1%s обнулил свой счёт", name)
}
else
{
client_print_color(id, DontChange, "^1[^4RS^1] ^1Ваш счёт успешно обнулён")
}
}

public advertise()
{
set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
show_hudmessage(0, "^1[^4RS^1] ^1Напишите в чате /resetscore или /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, DontChange, "^1[^4RS^1] ^1Напишите в чате /resetscore или /rs для обнуления вашего счёта")
}
}

#if defined _colorchat_included
#endinput
#endif
#define _colorchat_included

/* ColorChat Support */
#define NORMAL DontChange
#define GREEN DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color

#define MAX_TRANSLATION_LENGTH 2048

enum {
DontChange = 0,
Grey = -1,
Red = -2,
Blue = -3
};

#define print_team_default DontChange
#define print_team_grey Grey
#define print_team_red Red
#define print_team_blue Blue

stock client_print_color(id, sender, const fmt[], any:...)
{
// check if id is different from 0
if (id && !is_user_connected(id))
{
return 0;
}

if (sender < Blue || sender > 32)
{
sender = DontChange;
}
else if (sender < DontChange)
{
sender = -sender + 32; // align indexes to the TeamInfo ones
}

static const szTeamName[][] =
{
"",
"TERRORIST",
"CT"
};

new szMessage[191];

new iParams = numargs();

// Specific player code
if (id)
{
if (iParams == 3)
{
copy(szMessage, charsmax(szMessage), fmt); // copy so message length doesn't exceed critical 192 value
}
else
{
vformat(szMessage, charsmax(szMessage), fmt, 4);
}

if (sender > (32 - Grey))
{
if (sender > (32 - Blue))
{
sender = id;
}
else
{
_CC_TeamInfo(id, sender, szTeamName[sender - (32 - Grey)]);
}
}
_CC_SayText(id, sender, szMessage);
}

// Send message to all players
else
{
// Figure out if at least 1 player is connected
// so we don't execute useless useless code if not
new iPlayers[32], iNum;
get_players(iPlayers, iNum, "ch");
if (!iNum)
{
return 0;
}

new iMlNumber, i, j;
new Array:aStoreML = ArrayCreate();
if (iParams >= 5) // ML can be used
{
for (j = 3; j < iParams; j++)
{
// retrieve original param value and check if it's LANG_PLAYER value
if (getarg(j) == LANG_PLAYER)
{
i = 0;
// as LANG_PLAYER == -1, check if next parm string is a registered language translation
while ((szMessage[i] = getarg(j + 1, i++))) {}
if (GetLangTransKey(szMessage) != TransKey_Bad)
{
// Store that arg as LANG_PLAYER so we can alter it later
ArrayPushCell(aStoreML, j++);

// Update ML array saire so we'll know 1st if ML is used,
// 2nd how many args we have to alterate
iMlNumber++;
}
}
}
}

// If arraysize == 0, ML is not used
// we can only send 1 MSG_ALL message if sender != 0
if (!iMlNumber)
{
if (iParams == 3)
{
copy(szMessage, charsmax(szMessage), fmt);
}
else
{
vformat(szMessage, charsmax(szMessage), fmt, 4);
}
if (0 < sender < (32 - Blue)) // if 0 is passed, need to loop
{
if (sender > (32 - Grey))
{
_CC_TeamInfo(0, sender, szTeamName[sender - (32 - Grey)]);
}
_CC_SayText(0, sender, szMessage);
return 1;
}
}

if (sender > (32 - Blue))
{
sender = 0; // use receiver index
}

for (--iNum; iNum >= 0; iNum--)
{
id = iPlayers[iNum];

if (iMlNumber)
{
for (j = 0; j < iMlNumber; j++)
{
// Set all LANG_PLAYER args to player index ( = id )
// so we can format the text for that specific player
setarg(ArrayGetCell(aStoreML, j), _, id);
}

// format string for specific player
vformat(szMessage, charsmax(szMessage), fmt, 4);
}

if (sender > (32 - Grey))
{
_CC_TeamInfo(id, sender, szTeamName[sender - (32 - Grey)]);
}
_CC_SayText(id, sender, szMessage);
}

ArrayDestroy(aStoreML);
}
return 1;
}

stock _CC_TeamInfo(iReceiver, iSender, szTeam[])
{
static iTeamInfo = 0;
if (!iTeamInfo)
{
iTeamInfo = get_user_msgid("TeamInfo");
}
message_begin(iReceiver ? MSG_ONE : MSG_ALL, iTeamInfo, _, iReceiver);
write_byte(iSender);
write_string(szTeam);
message_end();
}

stock _CC_SayText(iReceiver, iSender, szMessage[])
{
static iSayText = 0;
if (!iSayText)
{
iSayText = get_user_msgid("SayText");
}

// Prevent sending format and localization strings via chat
for (new i = 0; i < 192; i++)
{
if (szMessage[i] == 0) break;
if (szMessage[i] == '%' ||
szMessage[i] == '#')
szMessage[i] = ' ';
}

message_begin(iReceiver ? MSG_ONE : MSG_ALL, iSayText, _, iReceiver);
write_byte(iSender ? iSender : iReceiver);
if (szMessage[0] > 4)
{
write_byte(1);
szMessage[192 - 2 - 1] = 0; // Two write_byte + string terminator
write_string(szMessage);
}
else
{
szMessage[192 - 1 - 1] = 0; // One write_byte + string terminator
write_string(szMessage);
}
message_end();
}

new _translation_szBuffer[MAX_TRANSLATION_LENGTH];

stock register_dictionary_colored(const filename[])
{
if (!register_dictionary(filename))
{
return 0;
}

new szFileName[256];
get_localinfo("amxx_datadir", szFileName, charsmax(szFileName));
format(szFileName, charsmax(szFileName), "%s/lang/%s", szFileName, filename);
new fp = fopen(szFileName, "rt");
if (!fp)
{
log_amx("Failed to open %s", szFileName);
return 0;
}

new szLang[3], szKey[64], TransKey:iKey;

while (!feof(fp))
{
fgets(fp, _translation_szBuffer, charsmax(_translation_szBuffer));
trim(_translation_szBuffer);

if (_translation_szBuffer[0] == '[')
{
strtok(_translation_szBuffer[1], szLang, charsmax(szLang), _translation_szBuffer, 1, ']');
}
else if (_translation_szBuffer[0])
{
strbreak(_translation_szBuffer, szKey, charsmax(szKey), _translation_szBuffer, charsmax(_translation_szBuffer));
iKey = GetLangTransKey(szKey);
if (iKey != TransKey_Bad)
{
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "!g", "^4");
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "!t", "^3");
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "!n", "^1");
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^4", "^4");
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^3", "^3");
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^1", "^1");
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^n", "^n");
replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^t", "^t");
AddTranslation(szLang, iKey, _translation_szBuffer[2]);
}
}
}

fclose(fp);
return 1;
}

/* ML from AMXX 1.8.3 support */
#define register_dictionary register_dictionary_colored


Отредактировал: Bloo, - 13.12.2016, 21:35
Причина: Выдано устное предупреждение!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Bloo
сообщение 13.12.2016, 21:37
Сообщение #12


Стаж: 12 лет

Сообщений: 15547
Благодарностей: 6971
Полезность: 1206

zloykenny, не надо ничего никуда вставлять. Подгрузка инклуда уже инициализирована в коде который я дал.
Достаточно положить файл на который я дал ссылку в папку "icludes" компилятора. Либо компилируйте web-компилятором на форуме, там есть этот инклуд.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя zloykenny
сообщение 13.12.2016, 21:51
Сообщение #13
Стаж: 9 лет 5 месяцев

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

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