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

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

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

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

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

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

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

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

lite_translit.amxx

, Падает от длинных сообщений
Статус пользователя OneNovikoff
сообщение 15.8.2015, 16:17
Сообщение #1
Стаж: 10 лет

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

Доброго времени суток! Подскажите пожалуйста есть ли альтернатива или решение проблемы на lite_translit.amxx от падения. Захожу в спектры и пишу длинное сообщение, а сервера падают.

вот что использую

/*
Lite Translit - легкая версия транслита aka Fuck you SkaJlbneJlb :D
Доп плюшки(отключаются):
* Теги в чате Гл. Админ | Админ | VIP
* Поддержка системы армейских званий - AES ( )
* Поддержка системы военных званий - Army System ( Army System (EA) 3.0 Fix 1 )
* Зеленый чат для админов и випов
Credits:
* Спасибо serfreeman1337 за помощь по коду и профилирование.
* Спасибо WarDeN4ik и его клавиатуре :D за различные тесты
* А так же спасибо всем тем, кто помогал тестировать и скидывал баг-репорты
*/

#include <amxmodx>

#define TAGS // Теги в чате Гл. Админ | Админ | VIP [ По умолчанию включен ]
#define GREEN_MSG // Зеленый цвет чата админов и випов [ По умолчанию выключен ]
//#define AS // Поддержка префиксов Военных званий Army System ( EA ) от 2.1.5 версии
#define AES // Поддержка системы армейских званий - AES ( ) [ По дефолту выключен ]
#define DEF_RUS // Русский язык по умолчанию [ По умолчанию английский ]
#define GL_ADMIN ADMIN_RCON // Флаг доступа для тега "Гл. Админ" в чате
#define ADMIN ADMIN_BAN // Флаг доступа для тега "Админ" в чате || Просмотр всего чата
#define VIP ADMIN_LEVEL_H // Флаг доступа для тега "VIP" в чате
// #define LOG_MESSAGE // Логирование чата в HLDS логи
#define FIX_CRASH // Костыль от падения сервера с ошибкой о превышении 192 байтов. Дак вот, включать ТОЛЬКО если сервер падает.
// у меня так и не получилось уронить свой без фикса...

#if defined AES
#include <aes_main>
#endif

#if defined AS
new const ranknames [ ][ ] =
{

#if defined LANG_ENG
"Rookie", "Soldier", "Lance-corporal", "L.Sergeant", "Sergeant", "Older sergeant",
"Petty officer", "Ensign", "Senior Warrant Officer", "Junior lieutenant", "Lieutenant",
"Older lieutenant", "Captain", "Major", "Lt.Colonel", "Colonel",
"Major-general", "Lieutenant-general", "Colonel-general", "General-Army", "Marshal"
#else
"Новобранец", "Рядовой", "Ефрейтор", "Мл.Сержант", "Сержант", "Ст.Сержант",
"Старшина", "Прапорщик", "Ст.Прапорщик", "Мл.Лейтенант", "Лейтенант",
"Ст.Лейтенант", "Капитан", "Майор", "Подполковник", "Полковник",
"Генерал-Майор", "Генерал-Лейтенант", "Генерал-Полковник", "Генерал-Армии", "Маршал"
#endif

};
native get_as_level ( id )
#endif

#define get_bit(%1,%2) (%1 & (1 << (%2 & 31)))
#define set_bit(%1,%2) %1 |= (1 << (%2 & 31))
#define clr_bit(%1,%2) %1 &= ~(1 << (%2 & 31))

new iPlayerRus[33]
new iIgnorePlayer

new const eng[][] = { "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","}",":",'"',"<",">","~","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","[","]",";","'",",",".","`","?","/","@","$","^^","&" };
new const rus[][] = { "Ф","И","С","В","У","А","П","Р","Ш","О","Л","Д","Ь","Т","Щ","З","Й","К","Ы","Е","Г","М","Ц","Ч","Н","Я","Х","Ъ","ж","Э","Б","Ю","Ё","ф","и","с","в","у","а","п","р","ш","о","л","д","ь","т","щ","з","й","к","ы","е","г","м","ц","ч","н","я","х","ъ","ж","э","б","ю","ё",",",".","'",";", ":","?" };

public plugin_init()
{
#define VERSION "2.5.7b"
register_plugin("Lite Translit", VERSION, "neygomon")
register_cvar("lt_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY)

register_clcmd("say /rus", "LangRus")
register_clcmd("say /eng", "LangEng")
register_clcmd("say", "Say_Handler")
register_clcmd("say_team", "SayTeam_Handler")
}

public client_putinserver(id)
{
if(is_user_hltv(id) || is_user_bot(id))
{
set_bit(iIgnorePlayer, id)
return
}
#if defined DEF_RUS
iPlayerRus[id] = true
#endif
}

public client_disconnect(id)
clr_bit(iIgnorePlayer, id)

public LangRus(id)
{
if(!iPlayerRus[id])
{
iPlayerRus[id] = true
client_print(id, print_center, "*** [LT] Русский чат активирован! ***")
}
else client_print(id, print_center, "*** [LT] Русский чат УЖЕ активирован! ***")
}

public LangEng(id)
{
if(iPlayerRus[id])
{
iPlayerRus[id] = false
client_print(id, print_center, "*** [LT] Английский чат активирован! ***")
}
else client_print(id, print_center, "*** [LT] Английский чат УЖЕ активирован! ***")
}

public Say_Handler(id)
return FormatMsg(id, false)

public SayTeam_Handler(id)
return FormatMsg(id, true)

public FormatMsg(id, bool:is_say_team)
{
if(get_bit(iIgnorePlayer, id)) return PLUGIN_CONTINUE
static szMessage[128]
read_args(szMessage, charsmax(szMessage))
remove_quotes(szMessage)

if(!szMessage[0] || szMessage[0] == '/') return PLUGIN_HANDLED_MAIN // блочим пустую мессагу и слеш в чате

if(iPlayerRus[id])
{
for(new i; i < sizeof eng; i++)
replace_all2(szMessage, charsmax(szMessage), eng[i], rus[i])
}

static iLen, szFormatTags[96], iAlive, iTeam; iAlive = is_user_alive(id), iTeam = get_user_team(id)
if(is_say_team)
{
switch(iTeam)
{
case 1: iLen = formatex(szFormatTags, charsmax(szFormatTags), "^1%s(Террорист) ", iAlive ? "" : "* Мертвый * ")
case 2: iLen = formatex(szFormatTags, charsmax(szFormatTags), "^1%s(Мент) ", iAlive ? "" : "* Мертвый * ")
case 3: iLen = formatex(szFormatTags, charsmax(szFormatTags), "^1(Наблюдатель) ")
}
}
else
{
if(iTeam == 3) iLen = formatex(szFormatTags, charsmax(szFormatTags), "^1(Наблюдатель) ")
else iLen = formatex(szFormatTags, charsmax(szFormatTags), "%s", iAlive ? "^1" : "^1*Мертвый* ")
}
#if defined AES
static AESLvl[33][64], aStats[AES_ST_END]
aes_get_player_stats(id, aStats)
aes_get_level_name(aStats[AES_ST_LEVEL], AESLvl[id], 63, LANG_SERVER)
iLen += formatex(szFormatTags[iLen], charsmax(szFormatTags) - iLen, "^4[%s] ", AESLvl[id])
#endif

#if defined AS
new level = get_as_level ( id )
iLen += formatex ( szFormatTags [ iLen ], charsmax ( szFormatTags ) - iLen, "^4[%s] ", ranknames [ level ] )
#endif

#if defined TAGS
static const szAdminPrefix[][] = { "", "^4[Гл. Админ] ", "^4[Админ] ", "^4[VIP] " }
iLen += formatex(szFormatTags[iLen], charsmax(szFormatTags) - iLen, "%s", szAdminPrefix[CheckFlags(id)])
#endif
#if defined GREEN_MSG
if(CheckFlags(id)) iLen += formatex(szFormatTags[iLen], charsmax(szFormatTags) - iLen, "^3%%s1^1 : ^4")
else iLen += formatex(szFormatTags[iLen], charsmax(szFormatTags) - iLen, "^3%%s1^1 : ")
#else
iLen += formatex(szFormatTags[iLen], charsmax(szFormatTags) - iLen, "^3%%s1^1 : ")
#endif
#if defined FIX_CRASH
/* Костыль :D || "Fix" crash on 192 bytes */
if(strlen(szFormatTags) + strlen(szMessage) >= 190)
{
client_print(id, print_center, "*** Ай-яй-яй! Сообщение слишком длинное;) ***");
return PLUGIN_HANDLED;
}
/* End fix */
#endif
static players[32], pcount; get_players(players, pcount, "c")
if(is_say_team)
{
for(new i; i < pcount; i++)
if(get_user_flags(id) & ADMIN || (iTeam == get_user_team(players[i]) && iAlive == is_user_alive(players[i])))
PrintChat(players[i], id, szFormatTags, szMessage)
}
else
{
for(new i; i < pcount; i++)
PrintChat(players[i], id, szFormatTags, szMessage)
}
#if defined LOG_MESSAGE
static authid[32], userteam[16], username[32]
get_user_name(id, username, 31)
get_user_authid(id, authid, 31)
get_user_team(id, userteam, 15)
log_message("^"%s<%d><%s><%s>^" %s ^"%s^"", username, get_user_userid(id), authid, userteam, is_say_team ? "say_team" : "say" , szMessage)
#endif
return PLUGIN_HANDLED
}

stock PrintChat(const iReceiver, const iSender, const szTags[], const szMessage[])
{
static StrSend[191]; formatex(StrSend, charsmax(StrSend), "%s %%s2", szTags)
message_begin(MSG_ONE_UNRELIABLE, 76, _, iReceiver)
write_byte(iSender)
write_string(StrSend)
write_string("")
write_string(szMessage)
message_end()
}
stock CheckFlags(id)
{
static iFlags
iFlags = get_user_flags(id)
if(iFlags & GL_ADMIN) return 1
else if(iFlags & ADMIN) return 2
else if(iFlags & VIP) return 3
return 0
}

stock replace_all2(string[], len, const what[], const with[])
{
new pos
if((pos = contain(string, what)) == -1) return 0
new total, with_len = strlen(with), diff = strlen(what) - with_len, total_len = strlen(string), temp_pos
while(total_len + with_len < len && replace(string[pos], len - pos, what, with) != 0)
{
total++
pos += with_len
total_len -= diff
if (pos >= total_len) break
temp_pos = contain(string[pos], what)
if (temp_pos == -1) break
pos += temp_pos
}
return total
}


Отредактировал: Bloo, - 15.8.2015, 21:37
Причина: Выдано устное предупреждение!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя OneNovikoff
сообщение 15.8.2015, 16:44
Сообщение #2
Стаж: 10 лет

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

2. И колор транслит если ставить что будет с ним лишним:

плагины
; AMX Mod X plugins
; Admin Base - Always one has to be activated
opengl32.amxx
admin.amxx ; admin base (required for any admin-related)
;admin_sql.amxx ; admin base - SQL version (comment admin.amxx)
; Basic
fresh_bans.amxx
admincmd.amxx ; basic admin console commands
;adminhelp.amxx ; help command for admin console commands
;adminslots.amxx ; slot reservation
;multilingual.amxx ; Multi-Lingual management
alias_detector.amxx
aim_detector.amxx
hackdetector.amxx
; Menus
menufront.amxx ; front-end for admin menus
cmdmenu.amxx ; command menu (speech, settings)
plmenu.amxx ; players menu (kick, ban, client cmds.)
;telemenu.amxx ; teleport menu (Fun Module required!)
mapsmenu.amxx ; maps menu (vote, changelevel)
pluginmenu.amxx ; Menus for commands/cvars organized by plugin
; Chat / Messages
adminchat.amxx ; console chat commands
antiflood.amxx ; prevent clients from chat-flooding the server
;scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages
adminvote.amxx ; vote commands
; Map related
;nextmap.amxx ; displays next map in mapcycle
;mapchooser.amxx ; allows to vote for next map
;timeleft.amxx ; displays time left on map
; Configuration
pausecfg.amxx ; allows to pause and unpause some plugins
statscfg.amxx ; allows to manage stats plugins via menu and commands
; Counter-Strike
;restmenu.amxx ; restrict weapons menu
aes_statsx_cstrike.amxx
statsx.amxx ; stats on death or round end (CSX Module required!)
;miscstats.amxx ; bunch of events announcement for Counter-Strike
;stats_logging.amxx ; weapons stats logging (CSX Module required!)
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here
vip_new.amxx debug
dhud.amxx
best_player.amxx
backweapons.amxx
anti_advert.amxx
amx_kiker.amxx
antiblock.amxx
ad_manager.amxx
info_rank.amxx debug
killa_hp.amxx
resetscore.amxx debug
ufps_mapchooser.amxx
hud_text_blocker.amxx
top_awards.amxx
descriptive_fire_in_the_holeRUS.amxx
amx_vipmodel.amxx debug
mute_menu.amxx
admin_esp.amxx
amxgag.amxx
csnadedrops.amxx
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя ThePhoenix
сообщение 15.8.2015, 21:19
Сообщение #3


Стаж: 11 лет

Сообщений: 2723
Благодарностей: 533
Полезность: 40

На счёт лишнего не скажу,у вас очень много всего лишнего на мой взгляд :)
У Автора есть новая версия на сайте,там уже есть фикс от падений)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя OneNovikoff
сообщение 15.8.2015, 21:32
Сообщение #4
Стаж: 10 лет

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

Цитата(ThePhoenix @ 15.8.2015, 21:15) *
На счёт лишнего не скажу,у вас очень много всего лишнего на мой взгляд :)
У Автора есть новая версия на сайте,там уже есть фикс от падений)


а конкретней можно за лишнее?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя ex3m777
сообщение 15.8.2015, 21:58
Сообщение #5


Стаж: 13 лет
Город: Москва

Сообщений: 2037
Благодарностей: 1135
Полезность: 968

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

if(strlen(szFormatTags) + strlen(szMessage) >= 190)
->
if(strlen(szFormatTags) + strlen(szMessage) >= 180)

а вообще последняя версия 2,8 находится на сайте неугомона


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