#include < amxmodx >
#include < cstrike >
 
new const g_sFile[ ] = "addons/amxmodx/configs/palyers.ini";
new Array: g_daPlayers, g_iSize, bool: g_bCommand[ MAX_PLAYERS + 1 ], g_sAuthId[ MAX_PLAYERS + 1 ][ 32 ];
 
public plugin_init( )
{
    register_plugin( "", "1.0", "Demon" );
    
    g_daPlayers = ArrayCreate( );
    
    Load( );
    
    register_clcmd( "say /penz", "cmdMoney" );
}
 
public cmdMoney( iPlayerId )
{
    if ( g_bCommand[ iPlayerId ] )
    {
        g_bCommand[ iPlayerId ] = false;
        ArrayPushString( g_daPlayers, g_sAuthId[ iPlayerId ] );
        cs_set_user_money( iPlayerId, 16000 );
        client_print( iPlayerId, print_chat, "Penzed 16000-re allitva, ma mar tobbet nem hasznalhatod ezt a prancsot!" );
        return;
    }
    client_print( iPlayerId, print_chat, "Ma mar hasznaltad ezt a parancsot!" );
}
 
public client_authorized( iPlayerId, const sSteamId[ ] )
{
    if ( sSteamId[ 0 ] != 'B' )
    {
        copy( g_sAuthId[ iPlayerId ], charsmax( g_sAuthId[ ] ), sSteamId );
        
        g_bCommand[ iPlayerId ] = ( ArrayFindString( g_daPlayers, sSteamId ) != -1 ) ? false : true;
    }
}
 
public Load( )
{
    new pFile = fopen( g_sFile, "rt" );
    
    if ( pFile )
    {
        new sLine[ 36 ];
        
        while ( !feof( pFile ) )
        {
            fgets( pFile, sLine, charsmax( sLine ) );
            trim( sLine );
            remove_quotes( sLine );
            
            ArrayPushString( g_daPlayers, sLine );
        }
        fclose( pFile );
        g_iSize = ArraySize( g_daPlayers );
    }
}
 
public Save( )
{
    if ( file_exists( g_sFile ) ) delete_file( g_sFile );
    
    new pFile = fopen( g_sFile, "wt" );
    
    if ( pFile )
    {
        new sLine[ 40 ];
        for ( new i; i < g_iSize; ++i )
        {
            formatex( sLine, charsmax( sLine ), "^"%a^"", ArrayGetStringHandle( g_daPlayers, i ) );
            
            fputs( pFile, sLine );
        }
        fclose( pFile );
    }
    ArrayDestroy( g_daPlayers );
}
 
public plugin_end( ) { Save( ); }