chat manager problem.

Сообщения
33
Реакции
1
Ошибка
Function "is_status_visible" was not found
[AMXX] Run time error 19 (plugin "chat_manager.amxx") - debug not enabled!
[AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
[AMXX] Run time error -1 (plugin "chat_manager.amxx") - debug not enabled!
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5293 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Oct 7 2021 17:13:53
Built from: https://github.com/alliedmodders/amxmodx/commit/8e8dfa3
Build ID: 5293:8e8dfa3
Core mode: JIT+ASM32
Билд
ReHLDS version: 3.10.0.761-dev
Build date: 14:03:01 Jul 25 2021 (2661)
Build from: https://github.com/dreamstalker/rehlds/commit/aaffe43
ReGamedll
ReGameDLL version: 5.21.0.534-dev
Build date: 18:28:48 Sep 02 2021
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/9233f85
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Rechecker RUN - rechecker_mm_i386.so v2.7 ini Chlvl ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.92d ini Start Never
[ 3] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 4] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5293 ini Start ANY
[ 5] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 6] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 7] Print Center Fix RUN - printcenterfix_mm_i386.so v1.0.1 ini ANY Never
[ 8] MySQL RUN - mysql_amxx_i386.so v1.9.0.5293 pl4 ANY ANY
[9] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5293 pl4 ANY ANY
[10] Fun RUN - fun_amxx_i386.so v1.9.0.5293 pl4 ANY ANY
[11] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5293 pl4 ANY ANY
11 plugins, 11 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Chat Manager 1.0.3 dost chat_manager.am debug
[ 2] Admin Base 1.9.0.5293 AMXX Dev Team admin.amxx running
[ 3] Admin Commands 1.9.0.5293 AMXX Dev Team admincmd.amxx running
[ 4] Admin Help 1.9.0.5293 AMXX Dev Team adminhelp.amxx running
[ 5] Slots Reservation 1.9.0.5293 AMXX Dev Team adminslots.amxx running
[ 6] Multi-Lingual System 1.9.0.5293 AMXX Dev Team multilingual.am running
[ 7] Menus Front-End 1.9.0.5293 AMXX Dev Team menufront.amxx running
[ 8] Commands Menu 1.9.0.5293 AMXX Dev Team cmdmenu.amxx running
[ 9] Players Menu 1.9.0.5293 AMXX Dev Team plmenu.amxx running
[ 10] Maps Menu 1.9.0.5293 AMXX Dev Team mapsmenu.amxx running
[ 11] Plugin Menu 1.9.0.5293 AMXX Dev Team pluginmenu.amxx running
[ 12] Admin Chat 1.9.0.5293 AMXX Dev Team adminchat.amxx running
[ 13] Anti Flood 1.9.0.5293 AMXX Dev Team antiflood.amxx running
[ 14] Scrolling Message 1.9.0.5293 AMXX Dev Team scrollmsg.amxx running
[ 15] Info. Messages 1.9.0.5293 AMXX Dev Team imessage.amxx running
[ 16] Admin Votes 1.9.0.5293 AMXX Dev Team adminvote.amxx running
[ 17] NextMap 1.9.0.5293 AMXX Dev Team nextmap.amxx running
[ 18] Nextmap Chooser 1.9.0.5293 AMXX Dev Team mapchooser.amxx running
[ 19] TimeLeft 1.9.0.5293 AMXX Dev Team timeleft.amxx running
[ 20] Pause Plugins 1.9.0.5293 AMXX Dev Team pausecfg.amxx running
[ 21] Stats Configuration 1.9.0.5293 AMXX Dev Team statscfg.amxx running
[ 22] VipMenu 0.1 dost vipmenu_knife.a running
22 plugins, 22 running
Автор плагина
dost
Версия плагина
1.0.3
Исходный код
/*
bt = [Luca]
bcdefghijklmnopqrstuv = ^3[John]^1
*/

#include < amxmodx >
#include < amxmisc >
#include < regex >
#include < sqlx >

#define ALLOW_PREFIX // shows custom prefix if player has the right flags.
#define SHOW_DEAD_PREFIX // shows *DEAD* if player is dead
#define SHOW_SAYTEAM_PREFIX // shows (Terrorist), (Counter-Terrorist) or (Spectator) if sayteam.
//#define READ_DEAD_CHAT // comment to disable dead and alive players possibility to read messages.
#define GREEN_CHAT ADMIN_RESERVATION // "b" flag. comment to disable green chat. // VIP
new const VERSION[] = "1.0.3";

new const host[] = "";
new const user[] = "";
new const pass[] = "";
new const db[] = "";

new Handle:tuple;

enum _:eActions
{
KICK,
BAN,
HIDE,
WHITELIST,
REPLACE
}

enum _:eSayTypes
{
NORMAL = 0,
SAYTEAM,
PSAY,
CMDCHAT
}

new Array:szWhitePatterns;
new Array:szPatterns;
new Array:iBlock;
new Array:iTime;
new Array:szReason;

new g_iSizeWhite;
new g_iSizePatterns;

new Array:szReplace;
new Array:szReplaceWith;

new g_iSizeReplace;

new bool:hasFinished;
new pBanPattern;
new pSaveLogs;

#if defined ALLOW_PREFIX
// prefix
new Array:hPrefix;
new Array:hFlags;
new g_iItems = -1;
new g_iPrefix[ 33 ];

new bool:g_toggle[33];

#endif

public plugin_init()
{
register_plugin( "Chat Manager", VERSION, "DusT" );

register_cvar( "Chat_Manager_Dust", VERSION, FCVAR_SPONLY | FCVAR_SERVER );

pBanPattern = register_cvar( "cm_ban_pattern", "amx_ban [user] [time] [reason]" );
pSaveLogs = register_cvar( "cm_logs", "0" );

register_clcmd( "say", "CmdCheckSay" );
register_clcmd( "say_team", "CmdCheckSay" );
register_clcmd( "amx_tsay", "CmdCheckSay" );
register_clcmd( "amx_csay", "CmdCheckSay" );
register_clcmd( "amx_say" , "CmdCheckSay" );
register_clcmd( "amx_chat", "CmdCheckSay" );
register_clcmd( "amx_csay", "CmdCheckSay" );
register_clcmd( "amx_psay", "CmdCheckSay" );

//register_event( "SayText", "CmdSayText", "b" );
tuple = SQL_MakeDbTuple( host, user, pass, db );

#if defined ALLOW_PREFIX
arrayset( g_iPrefix, -1, sizeof g_iPrefix );
register_concmd( "amx_reloadadmins", "CmdReloadAdmins", ADMIN_CFG );

register_clcmd("say /hideme", "CmdHideMe");
register_clcmd("say_team /hideme", "CmdHideMe");

#endif
}


public CmdHideMe(id)
{
if( g_iPrefix[ id ] >= 0 )
{
if(g_toggle[id])
{
g_toggle[id] = false
client_print(id, print_chat, "Status: Hidden")

}
else
{
g_toggle[id] = true
client_print(id, print_chat, "Status: Visible")
}
}

return PLUGIN_HANDLED;
}

public plugin_natives()
{
register_native("cm_is_status_visible", "is_status_visible");
}

public _is_status_visible(plugin, argc) return is_status_visible(get_param(1));
is_status_visible(id)
{
return g_toggle[id];
}

public plugin_end()
{
ArrayDestroy( szPatterns );
ArrayDestroy( szWhitePatterns );
ArrayDestroy( iBlock );
ArrayDestroy( iTime );
ArrayDestroy( szReason );
ArrayDestroy( szReplace );
ArrayDestroy( szReplaceWith );
}
public plugin_cfg()
{
set_task( 0.1, "SQL_Init" );
szPatterns = ArrayCreate( 128, 1 );
szWhitePatterns = ArrayCreate( 128, 1 );
iBlock = ArrayCreate( 1, 1 );
iTime = ArrayCreate( 1, 1 );
szReason = ArrayCreate( 64, 1 );
szReplace = ArrayCreate( 128, 1 );
szReplaceWith = ArrayCreate( 64, 1 );

#if defined ALLOW_PREFIX
hPrefix = ArrayCreate( 30, 1 );
hFlags = ArrayCreate( 1, 1 );
ReadINI();
#endif
}

public SQL_Init()
{
new query[ 512 ];

formatex( query, charsmax( query ), "\
CREATE TABLE IF NOT EXISTS `db_patterns`\
( id INT NOT NULL AUTO_INCREMENT, pattern VARCHAR(128) NOT NULL, block_type INT NOT NULL, time INT, reason VARCHAR(64), PRIMARY KEY( id ) );" );

SQL_ThreadQuery( tuple, "IgnoreHandle", query );

formatex( query, charsmax( query ), "SELECT * FROM `db_patterns`" );

SQL_ThreadQuery( tuple, "SQL_LoadData", query );
}

public IgnoreHandle( failState, Handle:query, error[], errNum )
{
if( errNum )
set_fail_state( error );

SQL_FreeHandle( query );
}

public SQL_LoadData( failState, Handle:query, error[], errNum )
{
if( errNum )
set_fail_state( error );

new max = SQL_NumResults( query );
new blockType, time, pattern[ 128 ], reason[ 64 ];

for( new i; i < max; i++ )
{
SQL_ReadResult( query, 1, pattern, charsmax( pattern ) );
blockType = SQL_ReadResult( query, 2 );

if( blockType == REPLACE )
{
SQL_ReadResult( query, 1, pattern, charsmax( pattern ) );
ArrayPushString( szReplace, pattern );
SQL_ReadResult( query, 4, reason, charsmax( reason ) );
ArrayPushString( szReplaceWith, reason );
}
else if( blockType == WHITELIST )
{
SQL_ReadResult( query, 1, pattern, charsmax( pattern ) );
ArrayPushString( szWhitePatterns, pattern );
}
else
{
ArrayPushCell( iBlock, blockType )
ArrayPushString( szPatterns, pattern );
if( blockType != HIDE )
{
SQL_ReadResult( query, 4, reason, charsmax( reason ) );
time = SQL_ReadResult( query, 3 );
}
else
{
time = 0;
reason[ 0 ] = 0;
}
ArrayPushCell( iTime, time );
ArrayPushString( szReason, reason );
}
SQL_NextRow( query );
}
g_iSizeWhite = ArraySize( szWhitePatterns );
g_iSizePatterns = ArraySize( szPatterns );
g_iSizeReplace = ArraySize( szReplace );
hasFinished = true;
}

public CmdCheckSay( id )
{
if( !hasFinished )
return PLUGIN_CONTINUE;

new argv[ 10 ];
new sayType;

read_argv( 0, argv, charsmax( argv ) );

if( equali( argv, "amx_psay" ) )
sayType = PSAY;
else if( equali( argv, "say_team" ) )
sayType = SAYTEAM;
else if( !equali( argv, "say" ) )
sayType = CMDCHAT;

new args[ 192 ];

read_args( args, charsmax( args ) );
remove_quotes( args );

if( !args [ 0 ] )
return PLUGIN_HANDLED;

if( args[ 0 ] == '@' )
sayType = CMDCHAT;

if( sayType == PSAY ) // remove nick from the message
{
read_argv( 1, argv, charsmax( argv ) );
format( args, charsmax( args ), "%s", args[ strlen( argv ) + 1 ] );
}

new pattern[ 128 ];
new i;
new Regex:rPattern;
for( i = 0; i < g_iSizeWhite; i++ )
{
ArrayGetString( szWhitePatterns, i, pattern, charsmax( pattern ) );

if( _:( rPattern = regex_match( args, pattern ) ) > 0 )
{
regex_free( rPattern );
if( sayType > SAYTEAM )
return PLUGIN_CONTINUE;

DisplayMessage( id, args, sayType == SAYTEAM );
return PLUGIN_HANDLED_MAIN;
}
}

new time, blockType, reason[ 64 ];

for( i = 0; i < g_iSizePatterns; i++ )
{
ArrayGetString( szPatterns, i, pattern, charsmax( pattern ) );

if( _:( rPattern = regex_match( args, pattern ) ) > 0 )
{
blockType = ArrayGetCell( iBlock, i );
regex_free( rPattern );
if( blockType != HIDE )
{
time = ArrayGetCell( iTime, i );
ArrayGetString( szReason, i, reason, charsmax( reason ) );

if( blockType == KICK )
server_cmd( "kick #%d %s", get_user_userid( id ), reason );
else if( blockType == BAN )
{
new banPattern[ 128 ];
get_pcvar_string( pBanPattern, banPattern, charsmax( banPattern ) );

replace_all( banPattern, charsmax( banPattern ), "[user]", fmt( "#%d", get_user_userid( id ) ) );
replace_all( banPattern, charsmax( banPattern ), "[reason]", reason );
replace_all( banPattern, charsmax( banPattern ), "[time]", fmt( "%d", time ) );

client_print_color( id, print_team_red, "^3[CM]^1 ^4Chat Triggered:^1 %s", args );
server_cmd( banPattern );
}
}
if( get_pcvar_bool( pSaveLogs ) )
log_amx( "%N Triggered. Chat: [%s], Pattern: [%s]", id, args, pattern );

if( !sayType )
return PLUGIN_HANDLED_MAIN;
else
return PLUGIN_HANDLED;
}
}
for( i = 0; i < g_iSizeReplace; i++ )
{
ArrayGetString( szReplace, i, pattern, charsmax( pattern ) );

rPattern = regex_match( args, pattern );

while( _:rPattern > 0 )
{
regex_substr( rPattern, 0, reason, charsmax( reason ) );
replace( args, charsmax( args ), reason, fmt( "%a", ArrayGetStringHandle( szReplaceWith, i ) ) );
regex_free( rPattern );
rPattern = regex_match( args, pattern );
}
}

if( sayType > SAYTEAM )
return PLUGIN_CONTINUE;

DisplayMessage( id, args, sayType == SAYTEAM );
return PLUGIN_HANDLED_MAIN;
}

DisplayMessage( id, message[], bool:is_say_team = false )
{
new szMessage[ 196 ];
new iTeam = get_user_team( id );

#if defined SHOW_DEAD_PREFIX
if( !is_user_alive( id ) )
add( szMessage, charsmax( szMessage ), "*DEAD*" );
#endif

#if defined SHOW_SAYTEAM_PREFIX
static szTeam[][] = { "", "Terrorist", "Counter-Terrorist", "Spectator" };
if( is_say_team )
add( szMessage, charsmax( szMessage ), fmt( "(%s) ", szTeam[ iTeam ] ) );
#endif
#if defined ALLOW_PREFIX
if(g_toggle[id])
{
if( g_iPrefix[ id ] >= 0 )
{
new szPrefix[ 64 ];
ArrayGetString( hPrefix, g_iPrefix[ id ], szPrefix, charsmax( szPrefix ) );
replace_all( szPrefix, charsmax( szPrefix ), "!g", "^4" );
replace_all( szPrefix, charsmax( szPrefix ), "!t", "^3" );
replace_all( szPrefix, charsmax( szPrefix ), "!y", "^1" );
add( szMessage, charsmax( szMessage ), fmt( "%s^1 ", szPrefix ) );
}
}
#endif
if( !szMessage[ 0 ] )
szMessage[ 0 ] = ' ';
#if defined GREEN_CHAT
format( szMessage, charsmax( szMessage ), "%s^3%n^1 : %s%s", szMessage, id, (( get_user_flags( id ) & GREEN_CHAT ) && g_toggle[ id ])? "^4":"", message )
#else
format( szMessage, charsmax( szMessage ), "%s^3%n^1 : %s", szMessage, id, message )
#endif

new players[ 32 ], num;

#if defined READ_DEAD_CHAT
if( is_say_team )
get_players( players, num );
else
{
players[ 0 ] = 0;
num = 1;
}

#else
get_players( players, num, fmt( "%c", is_user_alive( id )? 'a':'b' ) );
#endif

for( new i; i < num; i++ )
{
if( !is_say_team || iTeam == get_user_team( players[ i ] ) )
{
client_print_color( players[ i ], id, szMessage );
}
}
}

#if defined ALLOW_PREFIX
public CmdReloadAdmins( id, level )
{
if( !id || ( get_user_flags( id ) & level ) )
{
new players[ 32 ], num;
get_players( players, num );
for( new i; i < num; i++ )
{
UpdatePrefix( id );
}
}
return PLUGIN_CONTINUE;
}

public UpdatePrefix( id )
{
if( g_iItems > 0 )
{
new flags = get_user_flags( id );
g_iPrefix[ id ] = -1;

for( new i; i < g_iItems; i++ )
{
if( flags == ArrayGetCell( hFlags, i ) )
g_iPrefix[ id ] = i;
}
}
else if( g_iItems == 0 ) // if readini hasn't finished, retry in 1 second
set_task( 1.0, "UpdatePrefix", id );
}

public client_putinserver( id )
{
set_task( 1.0, "UpdatePrefix", id );
g_toggle[id] = true;
}

public client_disconnected( id )
{
if( task_exists( id ) )
remove_task( id );
g_toggle[id] = true;

}

public ReadINI()
{
new szDir[ 128 ];
get_configsdir( szDir, charsmax( szDir ) );

add( szDir, charsmax( szDir ), "/CM_Prefix.ini" );

if( !file_exists( szDir ) )
{
return;
}
g_iItems = 0;
new fp = fopen( szDir, "rt" );
new szData[ 100 ], szToken[ 32 ], szValue[ 32 ];
while( fgets( fp, szData, charsmax( szData ) ) )
{
if( szData[ 0 ] == '/' && szData[ 1 ] == '/' )
continue;
if( szData[ 0 ] == ';' )
continue;
trim( szData );
if( !szData[ 0 ] )
continue;

strtok2( szData, szToken, charsmax( szToken ), szValue, charsmax( szValue ), '=' );
trim( szValue );
trim( szToken );


ArrayPushCell( hFlags, read_flags( szToken ) );
ArrayPushString( hPrefix, szValue );
}
fclose( fp );
g_iItems = ArraySize( hFlags );
}
#endif
Привет,

Можно ли создать CFG с переменными внутри? Я не хочу компилировать плагин каждый раз, когда что-то меняю, я тоже не хочу использовать server.cfg.

Thanks!
 
Сообщения
458
Реакции
263
Помог
9 раз(а)
BeJ,
register_native("cm_is_status_visible", "is_status_visible");
public _is_status_visible(plugin, argc)
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу