Пользователь
- Сообщения
- 143
- Реакции
- 3
- Предупреждения
- 100
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
- Ошибка
-
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(19) : error 021: symbol already defined: "set_dhudmessage"
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(24) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(34) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(37) : error 021: symbol already defined: "show_dhudmessage"
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(42) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(44) : warning 218: old style prototypes used with optional semicolumns
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(45) : error 054: unmatched closing brace
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(46) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(49) : warning 218: old style prototypes used with optional semicolumns
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(50) : error 054: unmatched closing brace
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(51) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(54) : error 021: symbol already defined: "get_players"
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(56) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(58) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(63) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(65) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(67) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(70) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(79) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(82) : warning 218: old style prototypes used with optional semicolumns
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(83) : error 054: unmatched closing brace
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(84) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(86) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(90) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(95) : error 021: symbol already defined: "vformat"
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(96) : warning 218: old style prototypes used with optional semicolumns
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(97) : error 054: unmatched closing brace
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(100) : error 021: symbol already defined: "ArrayDestroy"
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(103) : error 010: invalid function or declaration
// H:\Ёрсюўшщ ёЄюы\scripting\include\dhudmessage.inc(106) : error 025: function heading differs from prototype
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
/*================================================================================
Библиотеки
=================================================================================*/
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <dhudmessage>
#include <colorchat>
/*================================================================================
Данные о плагине
=================================================================================*/
#define PLUGIN "Ad From Server"
#define VERSION "1.0"
#define AUTHOR "BadMandarin"
/*================================================================================
Константы/Массивы и остальное
=================================================================================*/
//#define IP_LOGER
#if defined IP_LOGER
#define IP_LOCK "127.0.0.1" // Здесь писать ип сервера, т.к стоит привязка по ип!
#endif
new g_icvars[10];//Массивы для кваров
//INI
//Для выбора секции.
enum _:STRSECTION {
SEC_CHAT,
SEC_CHECK,
SEC_CONN,
SEC_SCROLL,
SEC_INFO
}
new gSecName[STRSECTION][30] = {
"[chat]",
"[check]",
"[connect]",
"[scroll]",
"[info]"
}
new gSecNum = -1; //Здесь записываем текущую секцию.
//Секция chat
new Array:gArrChat;
new ad_count, iMessgCount;
//Сохранение секции check
enum _:STRCHECK {
CHECK_MESS[192],
CHECK_KEY[64]
};
new Array:gArrCheck;
new ArrCheck[STRCHECK]; //Локальный массив.
//Сохранение секции connect
enum _:STRCONNECT {
CONNECT_MESS[192],
CONNECT_TIME[11]
};
new Array:gArrConnect;
new ArrConnect[STRCONNECT];
//Сохранение секции scroll
new Array:gArrScroll;
//Сохранение секции info
enum _:STRINFO {
INFO_MESS[192],
INFO_COLOR[13],
INFO_COORD[15],
INFO_TYPE
};
new Array:gArrInfo;
new ArrInfo[STRINFO];
/*================================================================================
Гл. Функция
=================================================================================*/
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR);
#if defined IP_LOGER
new szIp[33];
get_user_ip(0, szIp, charsmax(szIp));
if(!equal(szIp , IP_LOCK)) set_fail_state("Плагин не куплен.");
else{
server_print("==================================");
server_print("IP Подошёл.");
server_print("Plugin: Ad From Server");
server_print("Author: BadMandarin");
server_print("КОНТАКТЫ ДЛЯ СВЯЗИ: dm20dm(Skype & Vk)");
server_print("==================================");
}
#endif
//Ловим момент использования чата игром для функции сообщений по ключевым словам
register_clcmd("say","eventSay");
register_clcmd("say_team","eventSay");
//Инициализируем массивы.
gArrChat = ArrayCreate(192,1);
gArrCheck = ArrayCreate(STRCHECK);
gArrConnect = ArrayCreate(STRCONNECT);
gArrScroll = ArrayCreate(192,1);
gArrInfo = ArrayCreate(STRINFO);
//Квары
g_icvars[0] = register_cvar("ad_show_msg","1")
g_icvars[1] = register_cvar("ad_chat_freq","60")
g_icvars[2] = register_cvar("ad_scroll_freq","120")
g_icvars[3] = register_cvar("ad_scroll_speed","0.2")
g_icvars[4] = register_cvar("ad_info_freq","180")
g_icvars[5] = register_cvar("ad_info_time","12")
g_icvars[6] = register_cvar("ad_info_pos","-1.0 0.20")
Load_Info();
new Float:time1 = get_pcvar_float(g_icvars[1])
new Float:time2 = get_pcvar_float(g_icvars[2])
new Float:time3 = get_pcvar_float(g_icvars[4])
set_task(time1,"advertise", .flags="b")
set_task(time2,"ScrollMessage", .flags="b")
set_task(time3,"InfoMessage", .flags="b")
}
/*================================================================================
ad_from_server.ini | Получение данных
=================================================================================*/
public Load_Info() {
//Считываем из файла параметры
static path[64];
get_configsdir(path, 63);
new filepatch[256];
formatex(filepatch, charsmax(filepatch), "%s/ad_from_server.ini",path)
if(file_exists(filepatch)) {
static buffer[256];
new iLine, iNum;
for(iLine = 0; read_file(filepatch, iLine, buffer, charsmax(buffer), iNum); iLine++) {
if(iNum > 0 && buffer[0] != '/' && buffer[1] != '/' && buffer[0] != ';') {
//Получаем имя секции.
new bool:NewSect = false;
for(new i=0;i<sizeof(gSecName);i++) {
if(equali(buffer,gSecName[i])) {
gSecNum = i;
NewSect = true;
}
}
if(NewSect) { //Если строка с секцией то переходим на новую строку.
continue;
}
new tempMessageChat[192],
tempMessageKey[192],
tempKeyMessages[192],
tempConnnectMes[192],
tempConnectTime[192],
tempInfoMes[192],
tempInfoColor[10],
tempInfoCoord[10],
tempInfoType[11];
switch(gSecNum) { //Секция 1 - сообщения в чат
case SEC_CHAT: {
trim(buffer)
if(buffer[0] == '"'){
parse(buffer, tempMessageChat, charsmax(tempMessageChat))
format_color(tempMessageChat, charsmax(tempMessageChat));
ArrayPushString(gArrChat,tempMessageChat)
ad_count++
}else{
continue;
}
}
case SEC_CHECK: { //Секция 2 - сообщения по ключевым словам
trim(buffer)
if(buffer[0] == '"'){
parse(buffer, tempMessageKey, charsmax(tempMessageKey), tempKeyMessages, charsmax(tempKeyMessages))
format_color(tempKeyMessages, charsmax(tempKeyMessages));
copy(ArrCheck[CHECK_KEY],sizeof(tempMessageKey),tempMessageKey);
copy(ArrCheck[CHECK_MESS],sizeof(tempKeyMessages),tempKeyMessages);
ArrayPushArray(gArrCheck, ArrCheck);
}else{
continue;
}
}
case SEC_CONN: { //Секция 3 - сообщения при коннекте
trim(buffer)
if(buffer[0] == '"'){
parse(buffer, tempConnnectMes, charsmax(tempConnnectMes), tempConnectTime, charsmax(tempConnectTime))
format_color(tempConnnectMes, charsmax(tempConnnectMes));
copy(ArrConnect[CONNECT_MESS],sizeof(tempConnnectMes),tempConnnectMes);
copy(ArrConnect[CONNECT_TIME],sizeof(tempConnectTime),tempConnectTime);
ArrayPushArray(gArrConnect,ArrConnect);
}else{
continue;
}
}
case SEC_SCROLL: { //Секция 4 - Scroll
ArrayPushString(gArrScroll,buffer)
}
case SEC_INFO: { //Секция 5 - по центру экрана
trim(buffer)
if(buffer[0] == '"'){
parse(buffer, tempInfoMes, charsmax(tempInfoMes), tempInfoColor, charsmax(tempInfoColor), tempInfoCoord, charsmax(tempInfoCoord), tempInfoType, charsmax(tempInfoType));
format_color(tempInfoMes, charsmax(tempInfoMes));
copy(ArrInfo[INFO_MESS],sizeof(tempInfoMes),tempInfoMes);
copy(ArrInfo[INFO_COLOR],sizeof(tempInfoColor),tempInfoColor);
copy(ArrInfo[INFO_COORD],sizeof(tempInfoCoord),tempInfoCoord);
copy(ArrInfo[INFO_TYPE],sizeof(tempInfoType),tempInfoType);
ArrayPushArray(gArrInfo,ArrInfo);
}else{
continue;
}
}
}
}
}
} else {
write_file(filepatch, "//Отсутствует ini файл плагина.", 0);
write_file(filepatch, "//Проверьте архив.", 1);
}
}
/*================================================================================
Вывод в чат
=================================================================================*/
new iMessage[192];
new g_sType;
new TextMes[190]
public advertise(){
g_sType = get_pcvar_num(g_icvars[0])
if(g_sType == 0){
new random = random_num(0, ArraySize(gArrChat) - 1)
ArrayGetString(gArrChat, random,iMessage, charsmax(iMessage))
}else{
new messageindex = iMessgCount == ad_count ? (iMessgCount = 0) : iMessgCount++
ArrayGetString(gArrChat, messageindex,iMessage, charsmax(iMessage))
}
new iStrBreak;
new szRight[190], szLeft[190];
if(containi(iMessage,"^n") >= 0)
{
do
{
strtok(iMessage, szLeft, charsmax(szLeft), szRight, charsmax(szRight), '^n');
formatex(TextMes, charsmax(TextMes), "%s", szLeft);
writeMessage(0, TextMes);
if((iStrBreak = containi(szRight, "^n")) < 0)
{
formatex(TextMes, charsmax(TextMes), "%s", szRight);
writeMessage(0, TextMes);
}else{
formatex(iMessage, charsmax(iMessage), "%s", szRight);
}
}
while(iStrBreak >= 0)
}else{
formatex(TextMes, charsmax(TextMes), "%s", iMessage);
writeMessage(0, TextMes);
}
}
/*================================================================================
По ключевым словам
=================================================================================*/
new iKeyMessage[STRCHECK];
public eventSay(id){
if(ArraySize(gArrCheck) < 1)
return PLUGIN_CONTINUE;
new talk[64];
read_args(talk, 63);
for(new i=0;i<ArraySize(gArrCheck);i++){
ArrayGetArray(gArrCheck, i,iKeyMessage)
if(containi(talk, iKeyMessage[CHECK_KEY]) != -1){
//writeMessage(id, iKeyMessage[CHECK_MESS])
new iStrBreak;
new szRight[190], szLeft[190];
if(containi(iKeyMessage[CHECK_MESS],"^n") >= 0)
{
do
{
strtok(iKeyMessage[CHECK_MESS], szLeft, charsmax(szLeft), szRight, charsmax(szRight), '^n');
formatex(TextMes, charsmax(TextMes), "%s", szLeft);
writeMessage(0, TextMes);
if((iStrBreak = containi(szRight, "^n")) < 0)
{
formatex(TextMes, charsmax(TextMes), "%s", szRight);
writeMessage(0, TextMes);
}else{
formatex(iKeyMessage[CHECK_MESS], charsmax(iKeyMessage[CHECK_MESS]), "%s", szRight);
}
}
while(iStrBreak >= 0)
}else{
formatex(TextMes, charsmax(TextMes), "%s", iKeyMessage[CHECK_MESS]);
writeMessage(0, TextMes);
}
}
}
return PLUGIN_CONTINUE;
}
/*================================================================================
Вывод при коннекте
=================================================================================*/
new tempconnect[STRCONNECT];
public client_authorized(id)
{
for(new i=0;i<ArraySize(gArrConnect);i++){
ArrayGetArray(gArrConnect, i,tempconnect)
new Float:time = str_to_float(tempconnect[CONNECT_TIME])
new messindex[2];
messindex[0] = i
set_task(time,"chat_message", id, messindex,charsmax(messindex))
}
}
public chat_message(messindex[], id){
new index = messindex[0]
ArrayGetArray(gArrConnect, index, tempconnect)
writeMessage(id, tempconnect[CONNECT_MESS])
}
/*================================================================================
Scroll сообщения
=================================================================================*/
new szScrollMessage[ 32 * 4 ];
public ScrollMessage()
{
g_sType = get_pcvar_num(g_icvars[0])
static iPos, iMaxPos; if( !iMaxPos ) iMaxPos = ArraySize( gArrScroll ) - 1;
if( ++iPos > iMaxPos ) iPos = 0;
if(g_sType == 0){
new random = random_num(0, ArraySize(gArrScroll) - 1)
ArrayGetString( gArrScroll, random, szScrollMessage, charsmax( szScrollMessage ) );
}else{
ArrayGetString( gArrScroll, iPos, szScrollMessage, charsmax( szScrollMessage ) );
}
new Float:howfast = get_pcvar_float(g_icvars[3])
set_hudmessage(200, 100, 0, -1.0, 0.90, 2, 6.0, 6.0, howfast, 0.05, -1 );
format_color( szScrollMessage, charsmax( szScrollMessage ) ); show_hudmessage( 0, szScrollMessage );
}
/*================================================================================
Hud сообщения
=================================================================================*/
new szInfoMessage[ STRINFO ];
public InfoMessage()
{
g_sType = get_pcvar_num(g_icvars[0])
static iPos, iMaxPos; if( !iMaxPos ) iMaxPos = ArraySize( gArrInfo ) - 1;
if( ++iPos > iMaxPos ) iPos = 0;
if(g_sType == 0){
new random = random_num(0, ArraySize(gArrInfo) - 1)
ArrayGetArray( gArrInfo, random, szInfoMessage );
}else{
ArrayGetArray( gArrInfo, iPos, szInfoMessage );
}
new szColor[ 12 ];
copy( szColor, charsmax( szColor ), szInfoMessage[ INFO_COLOR ] );
new iColor[ 3 ];
iColor[2] = str_to_num(szColor[6])
szColor[6] = 0
iColor[1] = str_to_num(szColor[3])
szColor[3] = 0
iColor[0] = str_to_num(szColor[0])
new sCoord[ 2 ][ 6 ];
new szPos[ 15 ]; get_pcvar_string( g_icvars[ 6 ], szPos, charsmax( szPos ) );
parse( szPos, sCoord[0], 5, sCoord[1], 5 );
if(strlen(szInfoMessage[INFO_COORD]) > 0){
get_pcvar_string(g_icvars[6],szInfoMessage[INFO_COORD],14)
parse(szInfoMessage[INFO_COORD],sCoord[0],5,sCoord[1],5)
}
new Float:hudInfoxPos = str_to_float(sCoord[0])
new Float:hudInfoyPos = str_to_float(sCoord[1])
new type = str_to_num(szInfoMessage[INFO_TYPE])
new Float:timefade = get_pcvar_float(g_icvars[5])
if( type )
{
set_dhudmessage(iColor[0], iColor[1], iColor[2], hudInfoxPos, hudInfoyPos, 0, 6.0, timefade, 0.05, 2.0);
show_dhudmessage( 0, szInfoMessage[INFO_MESS] )
}
else
{
set_hudmessage(iColor[0], iColor[1], iColor[2], hudInfoxPos, hudInfoyPos, 0, 6.0, timefade, 0.05, 2.0, -1)
show_hudmessage( 0, szInfoMessage[INFO_MESS] )
}
}
/*================================================================================
Стоки
=================================================================================*/
//Замена ключей
stock format_color(message[], msglen)
{
new servername[180];
get_cvar_string("hostname", servername, charsmax(servername))
new string[256], len = charsmax(string);
copy(string, len, message);
replace_all(string, len, "!n", "^1");
replace_all(string, len, "!t", "^3");
replace_all(string, len, "!g", "^4");
replace_all(string, len, "\n", "^n");
replace_all(string, len, "%hostname%", servername);
formatex(message, msglen, "^1%s", string);
}
/*================================================================================
Чат
=================================================================================*/
public writeMessage(const player,const message[], any:...){
new count = 1
new TextColor, players[32];
new strtext[190],color_of_team[10],old_team_info[10];
format(strtext,189,"%s",message); new len = charsmax(strtext)
if(containi(strtext,"!b") >= 0){
TextColor=2
replace_all(strtext, len, "!b", "^3");
}else if(containi(strtext,"!r") >= 0){
TextColor=1
replace_all(strtext, len, "!r", "^3");
}else if(containi(strtext,"!w") >= 0){
TextColor=3
replace_all(strtext, len, "!w", "^3");
}else{
TextColor=4
}
if (player) players[0] = player; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
get_user_team(players[i],old_team_info,9);
switch(TextColor){
case 0:{ //Без указания цвета. Избавляет (благодаря return) от некоторых лишних действий, идущих после закрытия switch.
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
write_byte(players[i]);
write_string(strtext);
message_end();
return;
}
case 1:color_of_team="TERRORIST"; //Красный.
case 2:color_of_team="CT"; //Синий.
case 3:color_of_team="SPECTATOR"; //Серый.
case 4:color_of_team=old_team_info; //Цвет команды.
//В итоге цвет после тега ^x03 будет зависить от выше написанного, а именно от цвета команды.
//Для зелёного (для тега ^x04) цвет команды не важен. Зелёный - он и в Африке зелёный...
//Аналогично и со стандартным (по умолчанию жёлтым) цветом (тегом ^x01).
//Поэтому можно ставить смело ноль в writeMessage, если НЕ использован в сообщении тег ^x03.
}
//Смена цвета команды.
message_begin(MSG_ONE,get_user_msgid("TeamInfo"),_,players[i]);
write_byte(players[i]);
write_string(color_of_team);
message_end();
//Посылка сообщения на экран с цветом (от тега ^x03), зависящим от цвета команды.
message_begin(MSG_ONE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(strtext);
message_end();
//Смена цвета команды обратно.
message_begin(MSG_ONE,get_user_msgid("TeamInfo"),_,players[i]);
write_byte(players[i]);
write_string(old_team_info);
message_end();
}
}
}
}
Как исправить ?
В этой теме было размещено решение! Перейти к решению.