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

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

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

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

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

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

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

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

Из-за какого плагина эта ошибка?

Статус пользователя panikajo
сообщение 6.3.2014, 18:32
Сообщение #1
Стаж: 10 лет

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

FATAL ERROR (shutting down): Host_Error: PF_MessageEnd_I: Refusing to send user message SayText of 194 bytes to client, user message size limit is 192 bytes

Может ли она возникать из-за этого плагина?
colorchat

#include <amxmodx>

#define VERSION "0.1.3"

#define MAX_PLAYERS 32
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

enum _:Colors {
DontChange,
Red,
Blue,
Grey
}

new const g_szTeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}

new gmsgSayText, gmsgTeamInfo, g_iMaxPlayers

new g_bConnected[MAX_PLAYERS+1]
new g_bBot[MAX_PLAYERS+1]
new g_iPlayerTeamColor[MAX_PLAYERS+1]

new Array:g_aStoreML

public plugin_init()
{
register_plugin("ColorChat", VERSION, "ConnorMcLeod")

register_event("TeamInfo", "Event_TeamInfo", "a")

gmsgTeamInfo = get_user_msgid("TeamInfo")
gmsgSayText = get_user_msgid("SayText")
g_iMaxPlayers = get_maxplayers()
g_aStoreML = ArrayCreate(1, 10) // assume we won't have more that 10 LANG_PLAYER args, so don't reserve more
}

public plugin_end()
{
// just in case...
ArrayDestroy(g_aStoreML)
}

public plugin_natives()
{
register_library("chatcolor")
register_native("client_print_color", "client_print_color")
}

public client_putinserver(id)
{
// Little tip so we won't alter HLTV TeamInfo, dunno what would result
g_bConnected[id] = !is_user_hltv(id)

// So we won't send useless msgs to bots
g_bBot[id] = is_user_bot(id)
}

public client_disconnect(id)
{
g_bConnected[id] = false
}

public Event_TeamInfo()
{
// Store the TeamInfo msg sent by game so if we alter that player TeamInfo
// we can restore is w/o retrieving his team
static szTeamInfo[2]
read_data(2, szTeamInfo, charsmax(szTeamInfo))
switch( szTeamInfo[0] )
{
case 'T': g_iPlayerTeamColor[ read_data(1) ] = Red
case 'C': g_iPlayerTeamColor[ read_data(1) ] = Blue
default : g_iPlayerTeamColor[ read_data(1) ] = Grey
}
}

public client_print_color(iPlugin, iParams) // client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
new id = get_param(1)

// check if id is different from 0
if( id )
{
// check player range and ingame player
if( !IsPlayer(id) || !g_bConnected[id] || g_bBot[id] )
{
return
}
}

new iColor = get_param(2)
if( iColor > Grey )
{
iColor = DontChange
}

new szMessage[256], iPlayerTeamColor
if( iColor > DontChange )
{
// if color specified, set 1st color to team color
szMessage[0] = 0x03
}
else
{
// if no color passed, set 1st color to green
szMessage[0] = 0x04
}

// Specific player code
if(id)
{
if( iParams == 3 )
{
// if only 3 args are passed, no need to format the string, just retrieve it
get_string(3, szMessage[1], charsmax(szMessage)-1)
}
else
{
// else format the string
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)
}

// convert !g, !t, and !n flags
Set_String_Color(szMessage, charsmax(szMessage))

// cut the string at its 192th character to prevent a bug
// that would prevent players from joining the server
szMessage[192] = 0

// if color specified
iPlayerTeamColor = g_iPlayerTeamColor[id]
if( iColor && iPlayerTeamColor != iColor )
{
// set id TeamInfo in consequence
// so SayText msg gonna show the right color
Send_TeamInfo(id, id, MSG_ONE_UNRELIABLE, g_szTeamName[iColor])

// Send the message
Send_SayText(id, id, MSG_ONE_UNRELIABLE, szMessage)

// restore TeamInfo
Send_TeamInfo(id, id, MSG_ONE_UNRELIABLE, g_szTeamName[iPlayerTeamColor])
}
else
{
Send_SayText(id, id, MSG_ONE_UNRELIABLE, szMessage)
}
}

// Send message to all players
else
{
// Figure out if at least 1 player is connected
// so we don't send useless message if not
// and we gonna use that player as team reference (aka SayText message sender) for color change
new iPlayerFound = FindPlayer()
if( !iPlayerFound )
{
return
}

new j

// Use that array to store LANG_PLAYER args indexes, and szTemp to store ML keys
new iArraySize, szTemp[64]

for(j=4; j<iParams-1; j++)
{
// retrieve original param value and check if it's LANG_PLAYER value
if( get_param_byref(j) == LANG_PLAYER )
{
// as LANG_PLAYER == -1, check if next parm string is a registered language translation
get_string(j+1, szTemp, charsmax(szTemp))
if( GetLangTransKey(szTemp) )
{
// Store that arg as LANG_PLAYER so we can alter it later
ArrayPushCell(g_aStoreML, j)

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

j++
}
}
}

// If arraysize == 0, ML is not used
// we can only send 1 MSG_BROADCAST message
if( !iArraySize )
{
if( iParams == 3 )
{
get_string(3, szMessage[1], charsmax(szMessage)-1)
}
else
{
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)
}

Set_String_Color(szMessage, charsmax(szMessage))
szMessage[192] = 0

iPlayerTeamColor = g_iPlayerTeamColor[iPlayerFound]
if( iColor && iPlayerTeamColor != iColor )
{
Send_TeamInfo(0, iPlayerFound, MSG_BROADCAST, g_szTeamName[iColor])
Send_SayText(0, iPlayerFound, MSG_BROADCAST, szMessage)
Send_TeamInfo(0, iPlayerFound, MSG_BROADCAST, g_szTeamName[iPlayerTeamColor])
}
else
{
Send_SayText(0, iPlayerFound, MSG_BROADCAST, szMessage)
}
}

// ML is used, we need to loop through all players,
// format text and send a MSG_ONE_UNRELIABLE SayText message
else
{
iPlayerTeamColor = g_iPlayerTeamColor[iPlayerFound]
new bColorChange = ( iColor && iPlayerTeamColor != iColor )
new szNewColor[10], szPreviousColor[10]
if( bColorChange )
{
copy(szNewColor, charsmax(szNewColor), g_szTeamName[iColor])
copy(szPreviousColor, charsmax(szPreviousColor), g_szTeamName[iPlayerTeamColor])
}

for( new i = 1; i <= g_iMaxPlayers; i++ )
{
if( g_bConnected[i] && !g_bBot[i] )
{
for(j=0; j<iArraySize; j++)
{
// Set all LANG_PLAYER args to player id ( = i )
// so we can format the text for that specific player
set_param_byref(ArrayGetCell(g_aStoreML, j), i)
}

// format string for player i
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)

Set_String_Color(szMessage, charsmax(szMessage))
szMessage[192] = 0

if( bColorChange )
{
Send_TeamInfo(i, iPlayerFound, MSG_ONE_UNRELIABLE, szNewColor)
Send_SayText(i, iPlayerFound, MSG_ONE_UNRELIABLE, szMessage)
Send_TeamInfo(i, iPlayerFound, MSG_ONE_UNRELIABLE, szPreviousColor)
}
else
{
Send_SayText(i, iPlayerFound, MSG_ONE_UNRELIABLE, szMessage)
}
}
}
// clear the array so next ML message we don't need to figure out
// if should use PushArray or SetArray
ArrayClear(g_aStoreML)
}
}
}

// convert !g, !t, and !n flags
Set_String_Color( szString[] , iLen )
{
while( replace(szString, iLen, "!g", "^4") )
{
}
while( replace(szString, iLen, "!t", "^3") )
{
}
while( replace(szString, iLen, "!n", "^1") )
{
}
}

Send_TeamInfo(iReceiver, iPlayerId, MSG_DEST, szTeam[])
{
message_begin(MSG_DEST, gmsgTeamInfo, _, iReceiver)
write_byte(iPlayerId)
write_string(szTeam)
message_end()
}

Send_SayText(iReceiver, iPlayerId, MSG_DEST, szMessage[])
{
message_begin(MSG_DEST, gmsgSayText, _, iReceiver)
write_byte(iPlayerId)
write_string(szMessage)
message_end()
}

FindPlayer()
{
for(new id=1; id<=g_iMaxPlayers; id++)
{
if(g_bConnected[id])
{
return id
}
}
return 0
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя proff_q
сообщение 6.3.2014, 18:39
Сообщение #2
Стаж: 12 лет

Сообщений: 357
Благодарностей: 263
Полезность: 804

Может.
P.S. Почему нельзя выложить нормальный исходник в нормальный тег pawn?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя panikajo
сообщение 6.3.2014, 18:46
Сообщение #3
Стаж: 10 лет

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

Цитата(proff_q @ 6.3.2014, 18:39) *
Может.
P.S. Почему нельзя выложить нормальный исходник в нормальный тег pawn?

Если вам так удобнее то вот)
Прикрепленный файл  colorchat.sma ( 7,38 килобайт ) Кол-во скачиваний: 23

Если может то как ее исправить?

Отредактировал: panikajo, - 6.3.2014, 18:46
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Esecman
сообщение 6.3.2014, 18:46
Сообщение #4
Стаж: 10 лет

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

Код:
szMessage[192]

>>
Код:
new szMessage[191]

Код:
szMessage[191]


Отредактировал: Esecman, - 6.3.2014, 19:22
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Legenda
сообщение 6.3.2014, 18:50
Сообщение #5


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

Стаж: 14 лет

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

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

лучше
szMessage[190]
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя proff_q
сообщение 6.3.2014, 18:56
Сообщение #6
Стаж: 12 лет

Сообщений: 357
Благодарностей: 263
Полезность: 804

Выше ответ неверен.
Переменная создается с 256 символами, а нужно 192, но как сказал Легенда, поставьте лучше 190.
new szMessage[256]
=>
new szMessage[191]

Далее везде замените
szMessage[192]
=>
szMessage[190]

Отредактировал: proff_q, - 6.3.2014, 19:08
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя panikajo
сообщение 6.3.2014, 19:01
Сообщение #7
Стаж: 10 лет

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

Компилятору не нравиться.
colorchat.sma(134) : error 032: array index out of bounds (variable "szMessage")
colorchat.sma(208) : error 032: array index out of bounds (variable "szMessage")
colorchat.sma(251) : error 032: array index out of bounds (variable "szMessage")
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя proff_q
сообщение 6.3.2014, 19:07
Сообщение #8
Стаж: 12 лет

Сообщений: 357
Благодарностей: 263
Полезность: 804

Голова уже совсем не соображает.
Вместо
new szMessage[256]
=>
new szMessage[191]
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя panikajo
сообщение 6.3.2014, 19:12
Сообщение #9
Стаж: 10 лет

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

Цитата(proff_q @ 6.3.2014, 19:07) *
Голова уже совсем не соображает.
Вместо
new szMessage[256]
=>
new szMessage[191]

Ну вы мне уже это писали я это сделал пишет ошибку.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя proff_q
сообщение 6.3.2014, 19:16
Сообщение #10
Стаж: 12 лет

Сообщений: 357
Благодарностей: 263
Полезность: 804

panikajo,
Нет, я писал по-другому, а потом исправил. При создании переменной нужно указывать на один байт больше.
Не будьте невнимательны, как я =)
Код:
#include <amxmodx>

#define VERSION "0.1.3"

#define MAX_PLAYERS 32
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

enum _:Colors {
DontChange,
Red,
Blue,
Grey
}

new const g_szTeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}

new gmsgSayText, gmsgTeamInfo, g_iMaxPlayers

new g_bConnected[MAX_PLAYERS+1]
new g_bBot[MAX_PLAYERS+1]
new g_iPlayerTeamColor[MAX_PLAYERS+1]

new Array:g_aStoreML

public plugin_init()
{
register_plugin("ColorChat", VERSION, "ConnorMcLeod")

register_event("TeamInfo", "Event_TeamInfo", "a")

gmsgTeamInfo = get_user_msgid("TeamInfo")
gmsgSayText = get_user_msgid("SayText")
g_iMaxPlayers = get_maxplayers()
g_aStoreML = ArrayCreate(1, 10) // assume we won't have more that 10 LANG_PLAYER args, so don't reserve more
}

public plugin_end()
{
// just in case...
ArrayDestroy(g_aStoreML)
}

public plugin_natives()
{
register_library("chatcolor")
register_native("client_print_color", "client_print_color")
}

public client_putinserver(id)
{
// Little tip so we won't alter HLTV TeamInfo, dunno what would result
g_bConnected[id] = !is_user_hltv(id)

// So we won't send useless msgs to bots
g_bBot[id] = is_user_bot(id)
}

public client_disconnect(id)
{
g_bConnected[id] = false
}

public Event_TeamInfo()
{
// Store the TeamInfo msg sent by game so if we alter that player TeamInfo
// we can restore is w/o retrieving his team
static szTeamInfo[2]
read_data(2, szTeamInfo, charsmax(szTeamInfo))
switch( szTeamInfo[0] )
{
case 'T': g_iPlayerTeamColor[ read_data(1) ] = Red
case 'C': g_iPlayerTeamColor[ read_data(1) ] = Blue
default : g_iPlayerTeamColor[ read_data(1) ] = Grey
}
}

public client_print_color(iPlugin, iParams) // client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
new id = get_param(1)

// check if id is different from 0
if( id )
{
// check player range and ingame player
if( !IsPlayer(id) || !g_bConnected[id] || g_bBot[id] )
{
return
}
}

new iColor = get_param(2)
if( iColor > Grey )
{
iColor = DontChange
}

new szMessage[191], iPlayerTeamColor
if( iColor > DontChange )
{
// if color specified, set 1st color to team color
szMessage[0] = 0x03
}
else
{
// if no color passed, set 1st color to green
szMessage[0] = 0x04
}

// Specific player code
if(id)
{
if( iParams == 3 )
{
// if only 3 args are passed, no need to format the string, just retrieve it
get_string(3, szMessage[1], charsmax(szMessage)-1)
}
else
{
// else format the string
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)
}

// convert !g, !t, and !n flags
Set_String_Color(szMessage, charsmax(szMessage))

// cut the string at its 192th character to prevent a bug
// that would prevent players from joining the server
szMessage[190] = 0

// if color specified
iPlayerTeamColor = g_iPlayerTeamColor[id]
if( iColor && iPlayerTeamColor != iColor )
{
// set id TeamInfo in consequence
// so SayText msg gonna show the right color
Send_TeamInfo(id, id, MSG_ONE_UNRELIABLE, g_szTeamName[iColor])

// Send the message
Send_SayText(id, id, MSG_ONE_UNRELIABLE, szMessage)

// restore TeamInfo
Send_TeamInfo(id, id, MSG_ONE_UNRELIABLE, g_szTeamName[iPlayerTeamColor])
}
else
{
Send_SayText(id, id, MSG_ONE_UNRELIABLE, szMessage)
}
}

// Send message to all players
else
{
// Figure out if at least 1 player is connected
// so we don't send useless message if not
// and we gonna use that player as team reference (aka SayText message sender) for color change
new iPlayerFound = FindPlayer()
if( !iPlayerFound )
{
return
}

new j

// Use that array to store LANG_PLAYER args indexes, and szTemp to store ML keys
new iArraySize, szTemp[64]

for(j=4; j<iParams-1; j++)
{
// retrieve original param value and check if it's LANG_PLAYER value
if( get_param_byref(j) == LANG_PLAYER )
{
// as LANG_PLAYER == -1, check if next parm string is a registered language translation
get_string(j+1, szTemp, charsmax(szTemp))
if( GetLangTransKey(szTemp) )
{
// Store that arg as LANG_PLAYER so we can alter it later
ArrayPushCell(g_aStoreML, j)

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

j++
}
}
}

// If arraysize == 0, ML is not used
// we can only send 1 MSG_BROADCAST message
if( !iArraySize )
{
if( iParams == 3 )
{
get_string(3, szMessage[1], charsmax(szMessage)-1)
}
else
{
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)
}

Set_String_Color(szMessage, charsmax(szMessage))
szMessage[190] = 0

iPlayerTeamColor = g_iPlayerTeamColor[iPlayerFound]
if( iColor && iPlayerTeamColor != iColor )
{
Send_TeamInfo(0, iPlayerFound, MSG_BROADCAST, g_szTeamName[iColor])
Send_SayText(0, iPlayerFound, MSG_BROADCAST, szMessage)
Send_TeamInfo(0, iPlayerFound, MSG_BROADCAST, g_szTeamName[iPlayerTeamColor])
}
else
{
Send_SayText(0, iPlayerFound, MSG_BROADCAST, szMessage)
}
}

// ML is used, we need to loop through all players,
// format text and send a MSG_ONE_UNRELIABLE SayText message
else
{
iPlayerTeamColor = g_iPlayerTeamColor[iPlayerFound]
new bColorChange = ( iColor && iPlayerTeamColor != iColor )
new szNewColor[10], szPreviousColor[10]
if( bColorChange )
{
copy(szNewColor, charsmax(szNewColor), g_szTeamName[iColor])
copy(szPreviousColor, charsmax(szPreviousColor), g_szTeamName[iPlayerTeamColor])
}

for( new i = 1; i <= g_iMaxPlayers; i++ )
{
if( g_bConnected[i] && !g_bBot[i] )
{
for(j=0; j<iArraySize; j++)
{
// Set all LANG_PLAYER args to player id ( = i )
// so we can format the text for that specific player
set_param_byref(ArrayGetCell(g_aStoreML, j), i)
}

// format string for player i
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)

Set_String_Color(szMessage, charsmax(szMessage))
szMessage[190] = 0

if( bColorChange )
{
Send_TeamInfo(i, iPlayerFound, MSG_ONE_UNRELIABLE, szNewColor)
Send_SayText(i, iPlayerFound, MSG_ONE_UNRELIABLE, szMessage)
Send_TeamInfo(i, iPlayerFound, MSG_ONE_UNRELIABLE, szPreviousColor)
}
else
{
Send_SayText(i, iPlayerFound, MSG_ONE_UNRELIABLE, szMessage)
}
}
}
// clear the array so next ML message we don't need to figure out
// if should use PushArray or SetArray
ArrayClear(g_aStoreML)
}
}
}

// convert !g, !t, and !n flags
Set_String_Color( szString[] , iLen )
{
while( replace(szString, iLen, "!g", "^4") )
{
}
while( replace(szString, iLen, "!t", "^3") )
{
}
while( replace(szString, iLen, "!n", "^1") )
{
}
}

Send_TeamInfo(iReceiver, iPlayerId, MSG_DEST, szTeam[])
{
message_begin(MSG_DEST, gmsgTeamInfo, _, iReceiver)
write_byte(iPlayerId)
write_string(szTeam)
message_end()
}

Send_SayText(iReceiver, iPlayerId, MSG_DEST, szMessage[])
{
message_begin(MSG_DEST, gmsgSayText, _, iReceiver)
write_byte(iPlayerId)
write_string(szMessage)
message_end()
}

FindPlayer()
{
for(new id=1; id<=g_iMaxPlayers; id++)
{
if(g_bConnected[id])
{
return id
}
}
return 0
}


Отредактировал: proff_q, - 6.3.2014, 19:18
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя soob
сообщение 14.8.2018, 14:47
Сообщение #11
Стаж: 9 лет 8 месяцев

Сообщений: 1104
Благодарностей: 383
Полезность: 521

не буду создавать тему новую, а лучше напишу здесь.
тоже столкнулся с данной проблемой.

стоит ReHLDS

текст краша
Код:
FATAL ERROR (shutting down): Host_Error: PF_MessageEnd_I: Refusing to send user message SayText of 194 bytes to client, user message size limit is 192 bytes


стоит такой менеджер:
Прикрепленный файл  chatmanager.sma ( 16,05 килобайт ) Кол-во скачиваний: 13

Прикрепленный файл  chatmanager_addon.sma ( 11,34 килобайт ) Кол-во скачиваний: 4


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