View Single Post
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 05-02-2022 , 22:01   Re: Bank System Nvault/SQL Support
Reply With Quote #59

Quote:
Originally Posted by Supremache View Post
Have you used this edition? If so, it works with two currencies, I tested it
To use this plugin, you need to replace this line in the config file that starts with "BANK_MENU" to
BANK_MENU = say /bank, say_team /bank, say /banktwo , say_team /banktwo

First currency:
Code:
#define get_cash(%1) cs_get_user_money(%1)
#define set_cash(%1,%2) cs_set_user_money(%1, %2)
  • Command that show the first bank menu:
    • /bank // You can not change it

Sec currency:
Code:
#define get_cash2(%1) cs_get_user_money(%1)
#define set_cash2(%1,%2) cs_set_user_money(%1, %2)
  • Command that show the sec bank menu:
    • /banktwo // You can change it to whatever you want but it must have a bank name


Show me what you did! Because I already fixed it in the modified plugin and you are saying "I used the modified plugin"
Oh, sorry for the delay, I've been trying to test before posting. The plugin you modified works fine, but It seems It does not save the values, I use mysql databases for both currencies, one table for bank and another for bank two. I use ocixcrom rank system in banktwo.

Quote:
Show me what you did! Because I already fixed it in the modified plugin and you are saying "I used the modified plugin"
I downloaded the plugin in the first page https://forums.alliedmods.net/attach...5&d=1650049174 then I modifie It with the code you provided [In the code I deleted the part: Remove these lines]

PHP Code:
@OnPlayerDonationsid )
{
    new 
szValueMAX_CASH_LENGTH ], szPlayerNameMAX_NAME_LENGTH ], szTargetNameMAX_NAME_LENGTH ];
    
read_argv1szValuecharsmaxszValue ) );
    
    new 
iValue str_to_numszValue ), iCash get_cashid ), iPlayer g_iPlayerid ][ Donate ]; 

    if( 
iCash iValue || iValue <= )
    {
        
CC_SendMessageid,"You do not have enough cash or invalid value." );
        return 
PLUGIN_CONTINUE;
    }
    
    
get_user_nameidszPlayerNamecharsmaxszPlayerName ) );
    
get_user_nameiPlayerszTargetNamecharsmaxszTargetName ) );
    
    
set_cashidiCash iValue )
    
set_cashiPlayerget_cashiPlayer ) + iValue )
    
    
CC_SendMessage(0,"Player^4 %s^1 donated^4 $%d^1 for^4 %s."szPlayerNameiValueszTargetName );
    
client_cmd(iPlayer"spk ^"items/9mmclip1.wav^"")
    
ReadDataid );
    
    return 
PLUGIN_HANDLED;

All the plugin:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <nvault>
#include <sqlx>
#include <cromchat>

/* You can make this plugin work with Ammo Packs,
 * BaseBuilder Credits, JBPacks, Points and more */

#define get_cash(%1) cs_get_user_money(%1)
#define set_cash(%1,%2) cs_set_user_money(%1, %2) 

#if !defined client_disconnected
    #define client_disconnected client_disconnect
#endif

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32
#endif

#if !defined MAX_MENU_LENGTH
    
const MAX_MENU_LENGTH 512
#endif

#if !defined MAX_NAME_LENGTH
    
const MAX_NAME_LENGTH 32
#endif

#if !defined MAX_AUTHID_LENGTH
    
const MAX_AUTHID_LENGTH 64
#endif

#if !defined MAX_IP_LENGTH
    
const MAX_IP_LENGTH 16
#endif
  
const MAX_QUERY_LENGTH 256;
const 
MAX_CASH_LENGTH 16;

new const 
g_iFile[ ] = "BankSystem.ini";
new const 
Version[ ] = "2.0";

enum _:SaveTypes
{
    
NICKNAME,
    
IP,
    
STEAMID
}

enum _:SaveMethods
{
    
Nvault,
    
MySQL,
    
SQLite
}

enum eSettings
{
    
PREFIX_CHATMAX_NAME_LENGTH ],
    
SQL_HOSTMAX_NAME_LENGTH ],
    
SQL_USERMAX_NAME_LENGTH ],
    
SQL_PASSMAX_NAME_LENGTH ],
    
SQL_DATABASEMAX_NAME_LENGTH ],
    
SQL_TABLEMAX_NAME_LENGTH ],
    
NVAULT_DATABASEMAX_NAME_LENGTH ],
    
USE_SQL,
    
SAVE_TYPE,
    
MAX_CASH,
    
MAX_CASH_SAVE,
    
MENU_DONATE_ACCESS,
    
MENU_RESET_ACCESS,
}

enum PlayerData
{
    
SaveInfoMAX_AUTHID_LENGTH ],
    
Bank,
    
Donate,
    
bool:BotOrHLTV
}

new 
g_iPlayerMAX_PLAYERS ][ PlayerData ],
    
g_iSettingseSettings ],
    
g_iFUserNameChanged,
    
Handle:g_SQLTuple,
    
g_szSQLErrorMAX_QUERY_LENGTH ],
    
g_iVault;
    
public 
plugin_init( ) 
{
    
register_plugin"Bank System"Version"Supremache" );
    
register_cvar"BankSystem"VersionFCVAR_SERVER FCVAR_SPONLY FCVAR_UNLOGGED );
    
    
register_clcmd"EnterAmount""@OnPlayerDonations" );
    
register_clcmd"DepositCash""@OnDepositCash" );
    
register_clcmd"TakeCash""@OnWithdrawCash" );
    
    
register_event"SayText""OnSayText""a""2=#Cstrike_Name_Change" )
    
    
ReadFile( );
    
    switch( 
g_iSettingsUSE_SQL ] )
    {
        case 
Nvault:
        {
            if ( ( 
g_iVault nvault_openg_iSettingsNVAULT_DATABASE ] ) ) == INVALID_HANDLE )
                
set_fail_state("BANK: Failed to open the vault.");
        }
        case 
MySQLSQLite
        {
            if( 
g_iSettingsUSE_SQL ] == SQLite )
                
SQL_SetAffinity"sqlite" );
                
            
g_SQLTuple SQL_MakeDbTupleg_iSettingsSQL_HOST ], g_iSettingsSQL_USER ], g_iSettingsSQL_PASS ], g_iSettingsSQL_DATABASE ] );
                
            new 
szQueryMAX_QUERY_LENGTH ], Handle:SQLConnectioniErrorCode;
            
SQLConnection SQL_Connectg_SQLTupleiErrorCodeg_szSQLErrorcharsmaxg_szSQLError ) );
                
            if( 
SQLConnection == Empty_Handle )
                
set_fail_stateg_szSQLError );
    
            
formatexszQuerycharsmaxszQuery ), "CREATE TABLE IF NOT EXISTS `%s` (`Player` VARCHAR(%i) NOT NULL,\
            `Cash` INT(%i) NOT NULL, PRIMARY KEY(Player));"
g_iSettingsSQL_TABLE ], MAX_AUTHID_LENGTHMAX_CASH_LENGTH );
            
            
RunQuerySQLConnectionszQueryg_szSQLErrorcharsmaxg_szSQLError ) );
        }
    }
}

public 
OnSayTextiMsgiDestinationiEntity )
{
    
g_iFUserNameChanged register_forward(FM_ClientUserInfoChanged"OnNameChange")
}

public 
OnNameChangeid )
{
    if( !
is_user_connectedid ) )
    {
        return;
    }

    new 
szNameMAX_NAME_LENGTH ]
    
get_user_nameidszNamecharsmaxszName ) )

    if( 
g_iSettingsSAVE_TYPE ] == NICKNAME )
    {
        
ReadDataid );
        
copyg_iPlayerid ][ SaveInfo ], charsmaxg_iPlayer[ ][ SaveInfo ] ), szName )

        if( 
g_iSettingsUSE_SQL ] != Nvault )
        {
            
ResetDataid )
        }

        
ReadDataidfalse );
    }

    
unregister_forwardFM_ClientUserInfoChangedg_iFUserNameChanged )
}

public 
client_connectid )
{
    if ( !( 
g_iPlayerid ][ BotOrHLTV ] = bool:( is_user_botid ) || is_user_hltvid ) ) ) )
    {
        
ResetDataid )
        
        switch( 
g_iSettingsSAVE_TYPE ] )
        {
            case 
NICKNAMEget_user_nameidg_iPlayerid ][ SaveInfo ], charsmaxg_iPlayer[ ][ SaveInfo ] ) )
            case 
IP:       get_user_ipidg_iPlayerid ][ SaveInfo ], charsmaxg_iPlayer[ ][ SaveInfo ]), )
            case 
STEAMID:  get_user_authididg_iPlayerid ][ SaveInfo ], charsmaxg_iPlayer[ ][ SaveInfo ] ) )
        }
        
        
ReadDataidfalse );
    }
}

public 
client_disconnectedid )
{
    if ( !
g_iPlayerid ][ BotOrHLTV ] )
    {
        
ReadDataid );
    }
}

@
BankMenuid )
{
    new 
iMenu menu_create"\yBank System: \r[Protected]""@BankHandler" );
    
    
menu_additemiMenu"Deposit" );
    
menu_additemiMenu"Deposit All^n" );
    
menu_additemiMenu"Withdraw" );
    
menu_additemiMenu"Withdraw All^n" );
    
menu_additemiMenu"Bank balance" );
    
menu_additemiMenu"Donate" );
    
menu_additemiMenu"Reset Bank" );
    
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED;
}

@
BankHandleridiMenuiItem 
{
    if( 
iItem != MENU_EXIT 
    {
        switch(
iItem
        {
            case 
0
            {
                
client_cmdid"messagemode DepositCash" );
                
set_hudmessage255255850.010.1820.56.00.050.05, -);
                
show_hudmessage(id" Type how much you want to deposit." );
            }
            case 
1: @OnDepositAllCashid );
            case 
2
            {
                
client_cmdid"messagemode TakeCash" );
                
set_hudmessage255255850.010.1820.56.00.050.05, -);
                
show_hudmessageid"Type how much you want to withdraw." );
            }
            case 
3: @OnWithdrawAllCashid );
            case 
4CC_SendMessageid,"Your Cash is:^4 %d"g_iPlayerid ][ Bank ] );
            case 
5: @DonateMenuid );
            case 
6: @ResetMenuid );
        }
    }
    
menu_destroyiMenu );
    return 
PLUGIN_HANDLED;
}

@
DonateMenuid )
{        
    if( ~
get_user_flagsid ) & g_iSettingsMENU_DONATE_ACCESS ] )
    {
        
CC_SendMessage(id"You don't have access to this command.");
        return 
PLUGIN_HANDLED;
    }
        
    new 
szPlayersMAX_PLAYERS ], iNumszIDMAX_PLAYERS ], szNameMAX_NAME_LENGTH ];
            
    new 
iMenu menu_create"Players List:""@DonateHandler" );
    
get_playersszPlayersiNum"ch" );
    
    for( new 
iPlayeriiNumi++ )
    {
        if( ( 
iPlayer szPlayers] ) != id )
        {
            
num_to_striPlayerszIDcharsmaxszID ) );
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
menu_additemiMenuszNameszID )
        }
    }
    
menu_displayidiMenu );
    return 
PLUGIN_HANDLED;
}

@
DonateHandleridiMenuiItem 
{
    if(
iItem != MENU_EXIT
    {
        new 
szData10 ], iUnused;
        
menu_item_getinfoiMenuiItemiUnusedszDatacharsmaxszData ), .callback iUnused )
        
        
g_iPlayerid ][ Donate ] = find_player"k"str_to_numszData ) ); 

        if ( ! 
g_iPlayerid ][ Donate ] )
        {
            
CC_SendMessageid,"This player does not exist." );
            return 
PLUGIN_HANDLED;
        }
        
        
client_cmd(id"messagemode EnterAmount");
        
        
set_hudmessage255255850.010.1820.56.00.050.05, -);
        
show_hudmessageid"Type how much you want to give." );
    }
    
menu_destroy(iMenu);
    return 
PLUGIN_HANDLED;
}

@
OnPlayerDonationsid )
{
    new 
szValueMAX_CASH_LENGTH ], szPlayerNameMAX_NAME_LENGTH ], szTargetNameMAX_NAME_LENGTH ];
    
read_argv1szValuecharsmaxszValue ) );
    
    new 
iValue str_to_numszValue ), iCash get_cashid ), iPlayer g_iPlayerid ][ Donate ]; 

    if( 
iCash iValue || iValue <= )
    {
        
CC_SendMessageid,"You do not have enough cash or invalid value." );
        return 
PLUGIN_CONTINUE;
    }
    
    
get_user_nameidszPlayerNamecharsmaxszPlayerName ) );
    
get_user_nameiPlayerszTargetNamecharsmaxszTargetName ) );
    
    
set_cashidiCash iValue )
    
set_cashiPlayerget_cashiPlayer ) + iValue )
    
    
CC_SendMessage(0,"Player^4 %s^1 donated^4 $%d^1 for^4 %s."szPlayerNameiValueszTargetName );
    
client_cmd(iPlayer"spk ^"items/9mmclip1.wav^"")
    
ReadDataid );
    
    return 
PLUGIN_HANDLED;


@
ResetMenuid )
{        
    if( ~
get_user_flagsid ) & g_iSettingsMENU_RESET_ACCESS ] )
    {
        
CC_SendMessage(id"You don't have access to this command.");
        return 
PLUGIN_HANDLED;
    }
        
    new 
szPlayersMAX_PLAYERS ], iNumszIDMAX_PLAYERS ], szNameMAX_NAME_LENGTH ];
            
    new 
iMenu menu_create"Players List:""@ResetHandler" );
    
get_playersszPlayersiNum"ch" );
    
    for( new 
iPlayeriiNumi++ )
    {
        if( ( 
iPlayer szPlayers] ) != id )
        {
            
num_to_striPlayerszIDcharsmaxszID ) );
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
menu_additemiMenuszNameszID )
        }
    }
    
menu_displayidiMenu );
    return 
PLUGIN_HANDLED;
}

@
ResetHandleridiMenuiItem 
{
    if(
iItem != MENU_EXIT
    {
        new 
szData10 ], iUnusedszPlayerNameMAX_NAME_LENGTH ], szTargetNameMAX_NAME_LENGTH ];
        
menu_item_getinfoiMenuiItemiUnusedszDatacharsmaxszData ), .callback iUnused )
        
        new 
iPlayer find_player"k"str_to_numszData ) ); 
        
        if( !
iPlayer )
        {
            
CC_SendMessageid,"This player does not exist." );
            return 
PLUGIN_HANDLED;
        }
        
        
get_user_nameidszPlayerNamecharsmaxszPlayerName ) );
        
get_user_nameiPlayerszTargetNamecharsmaxszTargetName ) );
    
        
g_iPlayeriPlayer ][ Bank ] = 0;
        
CC_SendMessage0,"[ADMIN]^4 %s:^1 reset bank of^4 %s."szPlayerNameszTargetName );
        
ReadDataid );
    }
    
menu_destroy(iMenu);
    return 
PLUGIN_HANDLED;
}

@
OnDepositAllCashid 
{
    new 
iCash clampget_cashid ), 0g_iSettingsMAX_CASH_SAVE ] );
    
    if( 
iCash <= 0)
    {
        
CC_SendMessage(id,"You do not have enough cash or invalid value.");
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_iPlayerid ][ Bank ] > g_iSettingsMAX_CASH_SAVE ] )
    {
        
CC_SendMessageid,"Your bank is full." );
        return 
PLUGIN_CONTINUE;
    }

    
g_iPlayerid ][ Bank ] += iCash;
    
set_cash(idiCash get_cashid ) );
    
CC_SendMessageid,"You have deposit^4 %i"iCash );
    
ReadDataid );
    return 
PLUGIN_HANDLED;
}

@
OnWithdrawAllCashid )
{
    new 
iCash get_cashid );
    
    if( 
g_iPlayerid ][ Bank ] <= )
    {
        
CC_SendMessage(id,"You do not have enough cash or invalid value.");
        return 
PLUGIN_CONTINUE;
    }
    
    new 
iMax maxiCashg_iSettingsMAX_CASH ] );
    
    if( 
g_iSettingsMAX_CASH ] && g_iPlayerid ][ Bank ] > iMax )
    {
        
set_cash(idiCash iMax );
        
g_iPlayerid ][ Bank ] -= iMax;
        
CC_SendMessageid,"You have withdraw^4 %i"iMax );
    }
    else
    {
        
CC_SendMessageid,"You have withdraw^4 %i"g_iPlayerid ][ Bank ] );
        
set_cashidiCash g_iPlayerid ][ Bank ] );
        
g_iPlayerid ][ Bank ] = 0;
    }
    
    
ReadDataid );

    return 
PLUGIN_HANDLED;
}

@
OnDepositCashid 
{
    new 
szValueMAX_CASH_LENGTH ];
    
read_argv1szValuecharsmaxszValue ) );
    new 
iValue clampstr_to_numszValue ), 0g_iSettingsMAX_CASH_SAVE ] ), iCash get_cashid );
    
    if( 
iCash iValue || iValue <= 0)
    {
        
CC_SendMessage(id,"You do not have enough cash or invalid value.");
        return 
PLUGIN_CONTINUE;
    }

    if( 
g_iPlayerid ][ Bank ] > g_iSettingsMAX_CASH_SAVE ] )
    {
        
CC_SendMessageid,"Your bank is full." );
        return 
PLUGIN_CONTINUE;
    }
    
    
g_iPlayerid ][ Bank ] += iValue;
    
set_cashidiCash iValue );
    
CC_SendMessage(id,"You have deposit^4 %i"iValue );
    
ReadDataid );
    
    return 
PLUGIN_HANDLED;
}

@
OnWithdrawCashid )
{
    new 
szValueMAX_CASH_LENGTH ];
    
read_argv1szValuecharsmaxszValue ) );
    new 
iValue g_iSettingsMAX_CASH ] ? clampstr_to_numszValue ), 0g_iSettingsMAX_CASH ] ) : str_to_numszValue )
    new 
iCash get_cashid );
    
    if( 
g_iPlayerid ][ Bank ] < iValue || iValue <= )
    {
        
CC_SendMessage(id,"You do not have enough cash or invalid value.");
        return 
PLUGIN_CONTINUE;
    }
    
    
g_iPlayerid ][ Bank ] -= iValue;
    
set_cashidiCash iValue );
    
CC_SendMessageid,"You have withdraw^4 %i"iValue );
    
ReadDataid );
    
    return 
PLUGIN_HANDLED;
}

ReadFile( )
{
    new 
szConfings128 ], szFile128 ];
    
get_configsdirszConfingscharsmaxszConfings ) )
    
formatexszFilecharsmaxszFile ), "%s/%s"szConfingsg_iFile );
    
    new 
iFile fopenszFile"rt" );
    
    if( 
iFile )
    {
        new 
szData256 ], szKey32 ], szValue128 ];
            
        while( 
fgetsiFileszDatacharsmaxszData ) ) )
        {
            
trimszData );
            
            switch( 
szData] )
            {
                case 
EOS'#'';''/''[': continue;
                default:
                {
                    
strtokszDataszKeycharsmaxszKey ), szValuecharsmaxszValue ), '=' );
                    
trimszKey ); trimszValue );
                            
                    if( !
szValue] || !szKey] )
                        continue;
                        
                    if( 
equalszKey"BANK_MENU" ) )
                    {
                        while( 
szValue] != && strtokszValueszKeycharsmaxszKey ), szValuecharsmaxszValue ), ',' ) )
                        {
                            
trimszKey ); trimszValue );
                            
register_clcmdszKey"@BankMenu" );
                        }
                    }
                    else if( 
equalszKey"PREFIX_CHAT" ) )
                    {
                        
copyg_iSettingsPREFIX_CHAT ], charsmaxg_iSettingsPREFIX_CHAT ] ), szValue );
                    }
                    else if(
equal(szKey"SQL_HOST"))
                    {
                        
copyg_iSettings[SQL_HOST], charsmaxg_iSettings[SQL_HOST] ), szValue );
                    }
                    else if(
equal(szKey"SQL_USER"))
                    {
                        
copyg_iSettingsSQL_USER ], charsmaxg_iSettingsSQL_USER ] ), szValue );
                    }
                    else if(
equal(szKey"SQL_PASS"))
                    {
                        
copyg_iSettingsSQL_PASS ], charsmaxg_iSettingsSQL_PASS ] ), szValue );
                    }
                    else if(
equal(szKey"SQL_DATABASE"))
                    {
                        
copyg_iSettingsSQL_DATABASE ], charsmaxg_iSettingsSQL_DATABASE ] ), szValue );
                    }
                    else if(
equal(szKey"SQL_TABLE"))
                    {
                        
copyg_iSettingsSQL_TABLE ], charsmaxg_iSettingsSQL_TABLE ] ), szValue );
                    }
                    else if(
equal(szKey"NVAULT_DATABASE"))
                    {
                        
copyg_iSettingsNVAULT_DATABASE ], charsmaxg_iSettingsNVAULT_DATABASE ] ), szValue );
                    }
                    else if( 
equal(szKey"SAVE_METHOD") )
                    {
                        
g_iSettingsUSE_SQL ] = clampstr_to_numszValue ), NvaultSQLite );
                    }
                    else if( 
equalszKey"SAVE_TYPE" ) )
                    {
                        
g_iSettingsSAVE_TYPE ] = clampstr_to_numszValue ), NICKNAMESTEAMID );
                    }
                    else if( 
equalszKey"MAX_CASH" ) )
                    {
                        
g_iSettingsMAX_CASH ] = str_to_numszValue );
                    }
                    else if( 
equalszKey"MAX_CASH_SAVE" ) )
                    {
                        
g_iSettingsMAX_CASH_SAVE ] = str_to_numszValue );
                    }
                    else if( 
equalszKey"MENU_RESET_ACCESS" ) )
                    {
                        
g_iSettingsMENU_RESET_ACCESS ] = szValue] == '0' ADMIN_ALL read_flagsszValue );
                    }
                    else if( 
equalszKey"MENU_DONATE_ACCESS" ) )
                    {
                        
g_iSettingsMENU_DONATE_ACCESS ] = szValue] == '0' ADMIN_ALL read_flagsszValue );
                    }
                }
            }
        }
        
fcloseiFile )
    }
    else 
log_amx"File %s does not exists"szFile )
    
    
CC_SetPrefixg_iSettingsPREFIX_CHAT ] );
}

ReadDataidbool:bSave true )
{
    new 
szQueryMAX_QUERY_LENGTH ];

    if( 
bSave )
    {
        switch( 
g_iSettingsUSE_SQL ] )
        {
            case 
Nvault:
            {
                new 
szValueMAX_CASH_LENGTH ];
                
num_to_strg_iPlayerid ][ Bank ], szValuecharsmaxszValue ) )
                
nvault_setg_iVaultg_iPlayerid ][ SaveInfo ], szValue );
            }
            case 
MySQLSQLite:
            {
                
formatexszQuery charsmaxszQuery ), "REPLACE INTO `%s` (`Player`, `Cash`) VALUES ('%s', '%i');",\
                
g_iSettingsSQL_TABLE ], g_iPlayerid ][ SaveInfo ], g_iPlayerid ][ Bank ] );
                
SQL_ThreadQueryg_SQLTuple"QueryHandle"szQuery );
            }
        }
    }
    else
    {
        switch( 
g_iSettingsUSE_SQL ] )
        {
            case 
Nvaultg_iPlayerid ][ Bank ] = nvault_getg_iVaultg_iPlayerid ][ SaveInfo ] );
            case 
MySQLSQLite:
            {
                
formatexszQuery charsmaxszQuery ), "SELECT Cash FROM `%s` WHERE Player = '%s';",\
                
g_iSettingsSQL_TABLE ], g_iPlayerid ][ SaveInfo ] );
                new 
szData]; szData] = id
                SQL_ThreadQuery
g_SQLTuple"QueryHandle"szQueryszDatasizeofszData ) );
            }
        }
    }
}

RunQueryHandle:SQLConnection, const szQuery[ ], szSQLError[ ], iErrLen )
{
    new 
Handle:iQuery SQL_PrepareQuerySQLConnection szQuery );
    
    if( !
SQL_ExecuteiQuery ) )
    {
        
SQL_QueryErroriQueryszSQLErroriErrLen );
        
set_fail_stateszSQLError );
    }
    
    
SQL_FreeHandleiQuery );
}

public 
QueryHandleiFailStateHandle:iQuery, const szError[ ], iErrCode, const szData[ ], iDataSize )
{
    switch( 
iFailState )
    {
        case 
TQUERY_CONNECT_FAILED: { log_amx"[SQL Error] Connection failed (%i): %s"iErrCodeszError ); return; }
        case 
TQUERY_QUERY_FAILED: { log_amx"[SQL Error] Query failed (%i): %s"iErrCodeszError ); return; }
    }
    
    if( 
SQL_NumResultsiQuery ) )
    {
        
g_iPlayerszData] ][ Bank ] = SQL_ReadResultiQuery );
    }


ResetData( const id )
{
    
g_iPlayerid ][ Bank ] = 0;
    
g_iPlayerid ][ Donate ] = 0;
    
g_iPlayerid ][ BotOrHLTV ] = false;
}

public 
plugin_natives( )
{
    
register_library("Bank");
    
register_native("get_user_bank""_get_user_bank")
    
register_native("set_user_bank""_set_user_bank")
}

public 
_get_user_bankiPlugin iParams )
{
    return 
g_iPlayerget_param) ][ Bank ]
}

public 
_set_user_bankiPlugin iParams )
{
    new 
id get_param)
    
g_iPlayerid ][ Bank ] = get_param);
    
ReadDataid );
}

public 
plugin_end( )
{
    if( 
g_iSettingsUSE_SQL ] )
    {
        
SQL_FreeHandleg_SQLTuple );
    }
    else
    {
        
nvault_closeg_iVault );
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ fbidis\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ ltrpar\\ lang3073\\ f0\\ fs16 \n\\ par }
*/ 
sigerman is offline