MySQL not connected

Статус
В этой теме нельзя размещать новые ответы.

arise'

Пользователь
Регистрация
29 Июн 2017
Сообщения
10
Симпатии
0
Пол
Мужской
Hello!
This plugin has something to do with this bug:

HTML:
L 08/02/2017 - 21:26:26: Start of error session.
L 08/02/2017 - 21:26:26: Info (map "zm_killdust2") (file "addons/amxmodx/logs/error_20170802.log")
L 08/02/2017 - 21:26:26: [AMXX] Plugin ("RangSystem_new.amxx") is setting itself as failed.
L 08/02/2017 - 21:26:26: [AMXX] Plugin says: Nem tudtam csatlakozni az adatbazishoz.
L 08/02/2017 - 21:26:26: [AMXX] Run time error 1 (plugin "RangSystem_new.amxx") - forced exit
Everything is well typed in sql info. The plugin contains Hungarian text.
Nem tudtam csatlakozni az adatbazishoz. = I could not connect to the database.

SMA:

HTML:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < engine >
#include < sqlx >
#include < ichat >

#pragma semicolon 1

#define MinOnlineTime 18000
#define SubPoint 200
#define MaxRang 19

new const g_sPrefix[ ] = "Prefix";

new const g_sTable[ ] = "rang_system_new";
new const g_sSQL_INFOS[ ][ ] =
{
    "host",    // HOST
    "user",    // USERNAME
    "pass",    // PASSWORD
    "database"    // DATABASE
};
new Handle: g_iSqlTuple;

enum _:ePlayerInfos { iOnlineTime, iOnlineTimeW, iKills, iDeaths, iPoints, iFCTime, sPrefix[ 16 ] };
enum _:eRangInfos { sRangName[ 32 ], iRangPoint };

new g_iUserData[ 33 ][ ePlayerInfos ];
new const g_iRangs[ MaxRang ][ eRangInfos ] =
{
    { "Újonc", 0 },
    { "Honvéd", 300 },
    { "Õrvezetõ", 500 },
    { "Tizedes", 700 },
    { "Szakaszvezetõ", 900 },
    { "Õrmester", 1100 },
    { "Törzsõrmester", 1400 },
    { "Fõtörzsõrmester", 1700 },
    { "Hadnagy", 2100 },
    { "Fõhadnagy", 2600 },
    { "Százados", 3300 },
    { "Õrnagy", 4000 },
    { "Alezredes", 4600 },
    { "Ezredes", 5300 },
    { "Dadártábornok", 6500 },
    { "Vezérnagy", 8000 },
    { "Altábornok", 10000 },
    { "Vezérezredes", 12000 },
    { "Egyedi prefix", 15000 }
};
new g_iRoundKills[ 33 ], g_iRang[ 33 ], g_sAuthID[ 33 ][ 32 ], g_sUsername[ 33 ][ 32 ], bool: g_bHud[ 33 ];

public plugin_init( )
{
    register_plugin( "Rang System", "1.0", "Demon" );
    register_cvar( "Rang System", "By Demon", FCVAR_SERVER );
    
    register_dictionary( "RangSystem.txt" );
    
    g_iSqlTuple = SQL_MakeDbTuple( g_sSQL_INFOS[ 0 ], g_sSQL_INFOS[ 1 ], g_sSQL_INFOS[ 2 ], g_sSQL_INFOS[ 3 ] );
    
    new sThread[ 512 ];
    formatex( sThread, charsmax( sThread ), "CREATE TABLE IF NOT EXISTS `%s` (`authid` varchar(32) NOT NULL,`online_time` INT(11) NOT NULL DEFAULT 0,`online_timew` INT(11) NOT NULL DEFAULT 0,`kills` INT(11) NOT NULL DEFAULT 0,`deaths` INT(11) NOT NULL DEFAULT 0,`points` INT(11) NOT NULL DEFAULT 0,`first_con_time` INT(15) NOT NULL,`prefix` varchar(16) NOT NULL,`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY);", g_sTable );
    
    SQL_ThreadQuery( g_iSqlTuple, "ThreadHandler", sThread, { 0 }, 1 );
    
    Load( );
    
    register_event( "SendAudio", "evCTWin", "a", "2&%!MRAD_ctwin" );
    register_event( "SendAudio", "evTEWin", "a", "2&%!MRAD_terwin" );
    register_event( "DeathMsg", "evDeath", "a" );
    
    register_clcmd( "say /hud", "cmdHud" );
    register_clcmd( "say /rang", "cmdRang" );
    register_clcmd( "say /myrank", "cmdRang" );
    register_clcmd( "say /rangok", "cmdRangs" );
    register_clcmd( "say /ranks", "cmdRangs" );
    register_clcmd( "say /prefix", "cmdPrefix" );
    register_clcmd( "reset_prefix", "cmdResetPrefix", ADMIN_RCON, "<jatekos> - Reset prefix." );
    
    register_concmd( "PREFIX", "GetPrefix" );
    
    register_forward( FM_ClientUserInfoChanged, "fwClientUserInfoChanged" );
}

public plugin_natives( )
{
    register_library( "rang_sys" );
    register_native( "get_user_rang", "_get_rang", 1 );
}
 
public _get_rang( iId, sRang[ ], iLen )
{
    param_convert( 2 );
    if ( g_iRang[ iId ] >= MaxRang ) copy( sRang, iLen, g_iUserData[ iId ][ sPrefix ] );
    else copy( sRang, iLen, g_iRangs[ g_iRang[ iId ] - 1 ][ sRangName ] );
}

public SaveDatas( iId, iMode )
{
    static sText[ 512 ];
    
    if ( iMode == 1 ) formatex( sText, charsmax( sText ), "INSERT INTO `%s` (`authid`,`first_con_time`,`prefix`) VALUES (^"%s^",^"%d^",^"%s^");", g_sTable, g_sAuthID[ iId ], get_systime( ), g_iRangs[ MaxRang - 1 ][ sRangName ] );
    else if ( iMode == 2 ) formatex( sText, charsmax( sText ), "UPDATE `%s` SET online_time = ^"%d^", online_timew = ^"%d^", kills = ^"%d^", deaths = ^"%d^", points = ^"%d^", prefix = ^"%s^" WHERE authid = ^"%s^";", g_sTable, g_iUserData[ iId ][ iOnlineTime ], g_iUserData[ iId ][ iOnlineTimeW ], g_iUserData[ iId ][ iKills ], g_iUserData[ iId ][ iDeaths ], g_iUserData[ iId ][ iPoints ], g_iUserData[ iId ][ sPrefix ], g_sAuthID[ iId ] );
    else if ( iMode == 3 ) formatex( sText, charsmax( sText ), "UPDATE `%s` SET online_timew = ^"0^";", g_sTable );
    else formatex( sText, charsmax( sText ), "UPDATE `%s` SET points = points - %d WHERE %d - first_con_time > 604799 AND online_timew < %d AND points > %d;", g_sTable, SubPoint, get_systime( ), MinOnlineTime, ( SubPoint - 1 ) );
    
    SQL_ThreadQuery( g_iSqlTuple, "ThreadHandler", sText, { 0 }, 1 );
}

public LoadDatas( iId )
{
    static sText[ 128 ], iArray[ 1 ];
    
    formatex( sText, charsmax( sText ), "SELECT * FROM `%s` WHERE authid = ^"%s^";", g_sTable, g_sAuthID[ iId ] );
    iArray[ 0 ] = iId;
    
    SQL_ThreadQuery( g_iSqlTuple, "ThreadHandler", sText, iArray, sizeof ( iArray ) );
}

public ThreadHandler( iFailState, Handle:iQuery, const sErrorMsg[ ], iErrorCode, const iARRAY[ ], iArraySize, Float:fQueueTime )
{
    if ( iFailState == TQUERY_CONNECT_FAILED )
    {
        set_fail_state( "Nem tudtam csatlakozni az adatbazishoz." );
        return;
    }
    else if ( iFailState == TQUERY_QUERY_FAILED )
    {
        set_fail_state( "Query Error" );
        return;
    }
    
    if ( iErrorCode )
    {
        log_amx( "%i - %s", iErrorCode, sErrorMsg );
        return;
    }
    
    new iId = iARRAY[ 0 ];
    if ( iId )
    {
        if ( SQL_NumResults( iQuery ) > 0 )
        {
            g_iUserData[ iId ][ iOnlineTime ] = SQL_ReadResult( iQuery, 1 );
            g_iUserData[ iId ][ iOnlineTimeW ] = SQL_ReadResult( iQuery, 2 );
            g_iUserData[ iId ][ iKills ] = SQL_ReadResult( iQuery, 3 );
            g_iUserData[ iId ][ iDeaths ] = SQL_ReadResult( iQuery, 4 );
            g_iUserData[ iId ][ iPoints ] = SQL_ReadResult( iQuery, 5 );
            g_iUserData[ iId ][ iFCTime ] = SQL_ReadResult( iQuery, 6 );
            SQL_ReadResult( iQuery, 7, g_iUserData[ iId ][ sPrefix ], charsmax( g_iUserData[ ][ sPrefix ] ) );
            
            g_iRang[ iId ] = 0;
            for ( new i; i < MaxRang; ++i ) if ( g_iUserData[ iId ][ iPoints ] >= g_iRangs[ i ][ iRangPoint ] ) ++g_iRang[ iId ];
            
            if ( g_iRang[ iId ] >= MaxRang ) iChatSendCustomData( iId, 0, g_iUserData[ iId ][ sPrefix ] );
            else iChatSendCustomData( iId, 0, g_iRangs[ g_iRang[ iId ] - 1 ][ sRangName ] );
        }
        else SaveDatas( iId, 1 );
    }
    
    return;
}

public evCTWin( ) { GivePoint( "CT" ); }
public evTEWin( ) { GivePoint( "TERRORIST" ); }

public GivePoint( const sTeam[ ] )
{
    static iPlayers[ 32 ], iPlrNum, iId;
    
    get_players( iPlayers, iPlrNum, "ech", sTeam );
    
    for ( new i; i < iPlrNum; ++i )
    {
        iId = iPlayers[ i ];
        
        if ( g_iRoundKills[ iId ] == 0 ) continue;
        
        if ( get_playersnum( ) > 11 )
        {
            if ( 14400 <= g_iUserData[ iId ][ iOnlineTimeW ] < 21600 )
                g_iRoundKills[ iId ] *= 2;
            else if ( 21600 <= g_iUserData[ iId ][ iOnlineTimeW ] < 28800 )
                g_iRoundKills[ iId ] *= 3;
            else if ( g_iUserData[ iId ][ iOnlineTimeW ] >= 28800 )
                g_iRoundKills[ iId ] *= 4;
        }
        
        g_iUserData[ iId ][ iPoints ] += g_iRoundKills[ iId ];
        if ( g_iRang[ iId ] < MaxRang )
        {
            if ( g_iUserData[ iId ][ iPoints ] >= g_iRangs[ g_iRang[ iId ] ][ iRangPoint ] )
            {
                ++g_iRang[ iId ];
                if ( g_iRang[ iId ] >= MaxRang ) iChatSendCustomData( iId, 0, g_iUserData[ iId ][ sPrefix ] );
                else iChatSendCustomData( iId, 0, g_iRangs[ g_iRang[ iId ] - 1 ][ sRangName ] );
            }
        }
    }
    arrayset( g_iRoundKills, 0, sizeof( g_iRoundKills ) );
}

public evDeath( )
{
    new iKiller = read_data( 1 );
    new iVictim = read_data( 2 );
    
    if ( ( iKiller != iVictim ) && !( get_user_team( iKiller ) == get_user_team( iVictim ) ))
    {
        ++g_iUserData[ iKiller ][ iKills ];
        ++g_iUserData[ iVictim ][ iDeaths ];
        ++g_iRoundKills[ iKiller ];
    }   
}

public cmdHud( iId ) { ChatColor( iId, "%L", iId, "HUD", iId, ( g_bHud[ iId ] ^= true ) ? "ON" : "OFF" ); }

public cmdRang( iId )
{
    static sCurRang[ 32 ], sNextRang[ 32 ], iLen = 0, sMotd[ 2048 ], iMotdLen = charsmax( sMotd ), iTime;
    copy( sCurRang, charsmax( sCurRang ), g_iRangs[ g_iRang[ iId ] - 1 ][ sRangName ] );
    
    iTime = get_systime( ) - g_iUserData[ iId ][ iFCTime ];
    
    if ( g_iRang[ iId ] >= MaxRang )
        format( sCurRang, charsmax( sCurRang ), "%s (%s)", sCurRang, g_iUserData[ iId ][ sPrefix ] );
    
    if ( g_iRang[ iId ] < MaxRang )
        copy( sNextRang, charsmax( sNextRang ), g_iRangs[ g_iRang[ iId ] ][ sRangName ] );
        
    iLen = formatex( sMotd, iMotdLen, "<meta charset=utf-8><body bgcolor=#000000><font color=#FFB000><pre>" );
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n", iId, "MOTD0", iTime / 3600,( iTime / 60 ) % 60, iTime % 60 );
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n", iId, "MOTD1", g_iUserData[ iId ][ iOnlineTime ] / 3600,(g_iUserData[ iId ][ iOnlineTime ] / 60 ) % 60, g_iUserData[ iId ][ iOnlineTime ] % 60 );
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n", iId, "MOTD2", g_iUserData[ iId ][ iOnlineTimeW ] / 3600, (g_iUserData[ iId ][ iOnlineTimeW ] / 60 ) % 60, g_iUserData[ iId ][ iOnlineTimeW ] % 60 );
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n%L^n%L^n", iId, "MOTD3", g_iUserData[ iId ][ iKills ], iId, "MOTD4", g_iUserData[ iId ][ iDeaths ], iId, "MOTD5", g_iUserData[ iId ][ iPoints ] );
    
    if ( g_iRang[ iId ] >= MaxRang ) iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n^n", iId, "MOTD6", sCurRang );
    else iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n%L^n^n", iId, "MOTD6", sCurRang, iId, "MOTD7", sNextRang, ( g_iRangs[ g_iRang[ iId ] ][ iRangPoint ] - g_iUserData[ iId ][ iPoints ] ) );
    
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n", iId, "MOTD8", MinOnlineTime / 3600 );
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n", iId, "MOTD9" );
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L^n", iId, "MOTD13" );
    iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "%L", iId, "MOTD10" );
    
    show_motd( iId, sMotd, "Rangrendszer info" );
}

public cmdRangs( iId )
{
    static sRang[ 32 ], iLen = 0, sMotd[ 2048 ], iMotdLen = charsmax( sMotd );

    iLen = formatex( sMotd, iMotdLen, "<meta charset=utf-8><style>table{color:#FFB000;} td,th{border:1px solid #666;text-align:center;}</style><body bgcolor=#000000><center><h1><font color=#FFB000>%L</h1><br><table width='400'><tr><th>%L</th><th>%L</th><tr>", iId, "MOTD11", iId, "RANG", iId, "MOTD12" );
    
    for ( new i; i < MaxRang; ++i )
    {
        copy( sRang, charsmax( sRang ), g_iRangs[ i ][ sRangName ] );
        
        if ( i < g_iRang[ iId ] - 1 )
            iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "<tr><td>%s</td><td>0</td><tr>", sRang );
        else if ( i == g_iRang[ iId ] - 1 )
            iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "<tr style='background-color:#666;'><td>%s</td><td>0</td><tr>", sRang );
        else
            iLen += formatex( sMotd[ iLen ], iMotdLen - iLen, "<tr><td>%s</td><td>%d</td><tr>", sRang, ( g_iRangs[ i ][ iRangPoint ] - g_iUserData[ iId ][ iPoints ] ) );
    }
    
    show_motd( iId, sMotd, "Rangrendszer info" );
}

public cmdPrefix( iId )
{
    if ( g_iRang[ iId ] < MaxRang )
    {
        ChatColor( iId, "%L", iId, "PREFIX1" );
        return;
    }
    ChatColor( iId, "%L", iId, "PREFIX2" );
    client_cmd( iId, "messagemode PREFIX" );
}

public cmdResetPrefix( iId, iLevel, iCid )
{
    if ( !cmd_access( iId, iLevel, iCid, 2 ) ) return PLUGIN_HANDLED;
 
    static sUser[ 32 ], iPlrId;
    read_argv( 1, sUser, charsmax( sUser ) );
    
    iPlrId = cmd_target( iId, sUser, ( CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF ) );
    
    if ( !iPlrId )
    {
        ChatColor( iId, "Nincs %s nevezetű játékos.", sUser );
        return PLUGIN_HANDLED;
    }
    
    copy( g_iUserData[ iPlrId ][ sPrefix ], charsmax( g_iUserData[ ][ sPrefix ] ), g_iRangs[ MaxRang - 1 ][ sRangName ] );
    
    iChatSendCustomData( iPlrId, 0, g_iRangs[ MaxRang - 1 ][ sRangName ] );
    
    ChatColor( iId, "Sikeresen resetelted a jatekos prefixet." );
    
    return PLUGIN_CONTINUE;
}

public GetPrefix( iId )
{
    if ( g_iRang[ iId ] < MaxRang ) return PLUGIN_HANDLED;
    
    static sString[ 17 ], iLen;
    read_args( sString, charsmax( sString ) );
    remove_quotes( sString );
    
    replace_all( sString, charsmax( sString ), "'", "" );
    replace_all( sString, charsmax( sString ), "^"", "" );
    replace_all( sString, charsmax( sString ), "`", "" );
    
    iLen = strlen( sString );
    
    if ( iLen < 3 || iLen > 15 )
    {
        ChatColor( iId, "%L", iId, "PREFIX3" );
        
        return PLUGIN_HANDLED;
    }
    format( sString, charsmax( sString ), "%s", sString );
    copy( g_iUserData[ iId ][ sPrefix ], charsmax( g_iUserData[ ][ sPrefix ] ), sString );
    
    iChatSendCustomData( iId, 0, sString );
    ChatColor( iId, "%L", iId, "PREFIX4", sString );
    
    return PLUGIN_CONTINUE;
}

public fwClientUserInfoChanged( iId, iBuffer )
{
    if ( !is_user_connected( iId ) ) return FMRES_IGNORED;
    
    static sOldName[ 32 ], sNewName[ 32 ];
    get_user_name( iId, sOldName, charsmax( sOldName ) );
    
    engfunc( EngFunc_InfoKeyValue, iBuffer, "name", sNewName, charsmax( sNewName ) );
    
    if ( equal( sNewName, sOldName ) ) return FMRES_IGNORED;
    
    engfunc( EngFunc_SetClientKeyValue, iId, iBuffer, "name", sOldName );
    client_cmd( iId, "name ^"%s^"; setinfo name ^"%s^"", sOldName, sOldName );
    
    return FMRES_SUPERCEDE;
}

public OnlineTimeCounter( iId )
{
    ++g_iUserData[ iId ][ iOnlineTime ];
    ++g_iUserData[ iId ][ iOnlineTimeW ];
    
    if ( g_bHud[ iId ] )
    {
        if ( !is_user_alive( iId ) )
        {
            set_hudmessage( 0, 255, 0, 0.01, 0.20, 0, 6.0, 0.9 );
            new iTarget = entity_get_int( iId, EV_INT_iuser2 );
    
            if ( iTarget != 0 )
            {
                show_hudmessage( iId, "%L^n%L^n%L^n%L^n%L^n%L^n%L", iId, "HUD1",
                g_sUsername[ iTarget ], iId, "HUD2",
                g_iUserData[ iTarget ][ iOnlineTime ] / 3600,( g_iUserData[ iTarget ][ iOnlineTime ] / 60 ) % 60, g_iUserData[ iTarget ][ iOnlineTime ] % 60, iId, "HUD3",
                g_iUserData[ iTarget ][ iOnlineTimeW ] / 3600, ( g_iUserData[ iTarget ][ iOnlineTimeW ] / 60 ) % 60, g_iUserData[ iTarget ][ iOnlineTimeW ] % 60, iId, "HUD4",
                g_iUserData[ iTarget ][ iKills ], iId, "HUD5", g_iUserData[ iTarget ][ iDeaths ], iId, "HUD6", g_iRangs[ g_iRang[ iTarget ] - 1 ][ sRangName ], g_iUserData[ iTarget ][ iPoints ], iId, "MOTD10" );
            }
            else
            {
                show_hudmessage( iId, "%L^n%L^n%L^n%L^n%L^n%L^n%L", iId, "HUD7", iId, "HUD2",
                g_iUserData[ iId ][ iOnlineTime ] / 3600,( g_iUserData[ iId ][ iOnlineTime ] / 60 ) % 60, g_iUserData[ iId ][ iOnlineTime ] % 60, iId, "HUD3",
                g_iUserData[ iId ][ iOnlineTimeW ] / 3600, ( g_iUserData[ iId ][ iOnlineTimeW ] / 60 ) % 60, g_iUserData[ iId ][ iOnlineTimeW ] % 60, iId, "HUD4",
                g_iUserData[ iId ][ iKills ], iId, "HUD5", g_iUserData[ iId ][ iDeaths ], iId, "HUD6", g_iRangs[ g_iRang[ iId ] - 1 ][ sRangName ], g_iUserData[ iId ][ iPoints ], iId, "MOTD10" );
            }
        }
    }
}

public Save( iNum )
{
    new sNewLine[ 16 ];
    
    formatex( sNewLine, charsmax( sNewLine ), "^"%d^"", iNum );
    write_file( "addons/amxmodx/configs/rangsys.ini", sNewLine, 0 );
}

public Load( )
{
    new pFile = fopen( "addons/amxmodx/configs/rangsys.ini", "rt" );
    
    if ( pFile )
    {
        new sLine[ 16 ], sTime[ 64 ], iNum;
        fgets( pFile, sLine, charsmax( sLine ) );
        
        trim( sLine );
        remove_quotes( sLine );
        
        iNum = str_to_num( sLine );
        
        get_time( "%a", sTime, charsmax( sTime ) );
        
        if ( equal( sTime, "Mon" ) )
        {
            if ( iNum == 0 )
            {
                SaveDatas( 0, 4 );
                Save( 1 );
                set_task( 2.5, "ResetOTimeW" );
            }
        }
        else { if ( iNum == 1 ) Save( 0 ); }
        
        fclose(pFile);
    }
    else Save( 0 );
}

public ResetOTimeW( ) { SaveDatas( 0, 3 ); }

public client_putinserver( iId )
{
    if ( is_user_bot( iId ) || is_user_hltv( iId ) ) return;
    
    g_iRoundKills[ iId ] = 0;
    g_bHud[ iId ] = true;
    g_iRang[ iId ] = 1;
    
    arrayset( g_iUserData[ iId ], 0, sizeof( g_iUserData[ ] ) );
    copy( g_iUserData[ iId ][ sPrefix ], charsmax( g_iUserData[ ][ sPrefix ] ), g_iRangs[ MaxRang - 1 ][ sRangName ] );
    
    iChatSendCustomData( iId, 0, g_iRangs[ 0 ][ sRangName ] );
    
    get_user_name( iId, g_sUsername[ iId ], charsmax( g_sUsername[ ] ) );
    get_user_authid( iId, g_sAuthID[ iId ], charsmax( g_sAuthID[ ] ) );
    
    LoadDatas( iId );
    set_task( 1.0, "OnlineTimeCounter", iId, _, _, "b" );
}

public client_disconnect( iId ) { if ( task_exists( iId ) ) remove_task( iId ); SaveDatas( iId, 2 ); }
public plugin_end( ) { SQL_FreeHandle( g_iSqlTuple ); }

stock ChatColor( iId, const sMessage[ ], any:... )
{
    static iPlrNum, iPlayers[ 32 ], sMsg[ 256 ], iIdMsg, iMsgLen = charsmax( sMsg );
    
    vformat( sMsg, iMsgLen, sMessage, 3 );
    format( sMsg, iMsgLen, "!g[%s]!y %s", g_sPrefix, sMsg );
    
    replace_all( sMsg, iMsgLen, "!g", "^4" );
    replace_all( sMsg, iMsgLen, "!y", "^1" );
    replace_all( sMsg, iMsgLen, "!t", "^3" );
 
    if ( !iIdMsg ) iIdMsg = get_user_msgid( "SayText" );
 
    if ( iId )
    {
        iPlayers[ 0 ] = iId;
        iPlrNum = 1;
    }
    else get_players( iPlayers, iPlrNum, "ch" );
 
    for ( new i, iPId; i < iPlrNum; ++i )
    {
        iPId = iPlayers[ i ];
        
        if ( !is_user_connected( iPId ) ) continue;
        
        message_begin( MSG_ONE, iIdMsg, _, iPId );
        write_byte( iPId );
        write_string( sMsg );
        message_end( );
    }
}
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу