Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined zDfGyZehGfdoc
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- ____ _ _ ____ _
- | __ ) __ _ _ __ | | _(_)_ __ __ _ / ___| _ _ ___| |_ ___ _ __ ___
- | _ \ / _` | '_ \| |/ / | '_ \ / _` | \___ \| | | / __| __/ _ \ '_ ` _ \
- | |_) | (_| | | | | <| | | | | (_| | ___) | |_| \__ \ || __/ | | | | |
- |____/ \__,_|_| |_|_|\_\_|_| |_|\__, | |____/ \__, |___/\__\___|_| |_| |_|
- |___/ |___/
- by Zh3r0
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- #endif
- #include <a_samp>
- #include <YSI/Y_INI>
- #include <sscanf2>
- #define COL_RED "{FF0000}"
- #define COL_GREY "{C3C3C3}"
- #define COL_ALL "{20FF20}"
- //Change these:
- #define FILE_LOCATION "/bAccounts/%s.ini"
- #define BANK 3598
- #define SAVE_ON_EXIT true //true - The stats will save on disconnect | false - The stats won't save on exit
- #define TELL_ON_CONNECT true //true - Tell player that he has an account when he connects | false - Don't tell the player that he has an account
- //===========================================
- //Don't change here
- #define BANK_CREATE BANK + 1
- #define BANK_CREATE2 BANK + 2
- #define BANK_DEPOSIT BANK + 3
- #define BANK_WITHDRAW BANK + 4
- #define BANK_TRANSFER BANK + 5
- #define BANK_WITH_DONE BANK + 6
- #define BANK_DEPO_DONE BANK + 7
- #define BANK_T_I BANK + 8
- #define BANK_TRANSFER_1 BANK + 9
- #define BANK_TRANSFER_2 BANK + 10
- #define BANK_TRANSFER_3 BANK + 11
- #define BANK_TRANSFER_4 BANK + 12
- #define BANK_TRANSFER_5 BANK + 13
- #define BANK_TRANSFER_6 BANK + 14
- #define BANK_INFO BANK + 15
- #define ACC_DEL BANK + 16
- #define BANK_INS_PASS BANK + 17
- #define BANK_LOGIN BANK + 18
- #define BANK_LOGGED BANK + 19
- #define TRANFER_REC BANK + 20
- #define DEPOSIT 0
- #define WITHDRAW 1
- #define TRANSFER 2
- #define ACCOUNTINFO 3
- #define ACCSYSINFO 4
- #define CANCEL_ACC 5
- #define BANK_EXIT 6
- //===========================================
- enum PlayerData
- {
- P_Deposited,
- P_Withdraw,
- P_Transfered,
- P_Logged
- };
- forward LoadDeposit2( playerid, name[ ], value[ ] );
- forward LoadTransfer( playerid, name[ ], value[ ] );
- forward LoadBanking( playerid, name[ ], value[ ] );
- forward ParseReceived2( playerid, name[ ], value[ ] );
- forward ParseReceived( playerid, name[ ], value[ ] );
- forward ParsePass( playerid, name[ ], value[ ] );
- forward LoadWithdraw( playerid, name[ ], value[ ] );
- forward LoadDeposit( playerid, name[ ], value[ ] );
- forward LoadReceived( playerid );
- //==================================================
- //Don't remove!
- new Hash[17] = "90!104!51!114!48",
- HashE[5][256],
- P_DATA[ MAX_PLAYERS ][ PlayerData ],
- Str[ 800 ];
- //==================================================
- public LoadDeposit2( playerid, name[ ], value [ ] ) if(!strcmp(name, "MONEY" )) SetPVarInt( playerid, "Deposited2", strval( value ) );
- public ParsePass( playerid, name[ ], value[ ] ) if(!strcmp(name, "ACCOUNT_PASSWORD" )) SetPVarString( playerid, "bPass", value );
- public ParseReceived( playerid, name[ ], value[ ] ) if(!strcmp(name, "TRANSFER_RECEIVED" )) SetPVarInt( playerid, "MoneyReceived", strval( value ) );
- public ParseReceived2( playerid, name[ ], value[ ] )
- {
- if(!strcmp(name, "MONEY" )) P_DATA[ playerid ][ P_Deposited ] = strval( value );
- if(!strcmp(name, "MONEY_RECEIVED_FROM" )) SetPVarString( playerid, "ReceivedFrom", value );
- if(!strcmp(name, "MONEY_RECEIVED_DATE" )) SetPVarString( playerid, "ReceivedDate", value );
- if(!strcmp(name, "MONEY_RECEIVED" )) SetPVarInt( playerid, "AmReceived", strval( value ) );
- }
- public LoadBanking( playerid, name[ ], value[ ] )
- {
- if(!strcmp(name, "ACCOUNT_CREATED_ON" )) SetPVarString( playerid, "AccountDate", value );
- if(!strcmp(name, "MONEY" )) P_DATA[ playerid ][ P_Deposited ] = strval( value );
- if(!strcmp(name, "WITHDRAW" )) P_DATA[ playerid ][ P_Withdraw ] = strval( value );
- if(!strcmp(name, "TRANSFERED" )) P_DATA[ playerid ][ P_Transfered ] = strval( value );
- if(!strcmp(name, "LAST_TRANSFER" )) SetPVarString( playerid, "TransferDate", value );
- if(!strcmp(name, "LAST_DEPOSIT" )) SetPVarString( playerid, "DepositDate", value );
- if(!strcmp(name, "LAST_WITHDRAW" )) SetPVarString( playerid, "WithdrawDate", value );
- if(!strcmp(name, "LAST_TRANSFER_AMOUNT" )) SetPVarInt( playerid, "TransferAmount", strval( value ) );
- if(!strcmp(name, "LAST_TRANSFER_TYPE" )) SetPVarString( playerid, "TransferType", value );
- if(!strcmp(name, "LAST_TRANSFER_PLAYER" )) SetPVarString( playerid, "TransferPlayer", value);
- }
- public LoadTransfer( playerid, name[ ], value[ ] )
- {
- if(!strcmp(name, "LAST_TRANSFER" )) SetPVarString( playerid, "TransferDate", value );
- if(!strcmp(name, "LAST_TRANSFER_AMOUNT" )) SetPVarInt( playerid, "TransferAmount", strval( value ) );
- if(!strcmp(name, "LAST_TRANSFER_TYPE" )) SetPVarString( playerid, "TransferType", value );
- if(!strcmp(name, "LAST_TRANSFER_PLAYER" )) SetPVarString( playerid, "TransferPlayer", value);
- if(!strcmp(name, "TRANSFERED" )) P_DATA[ playerid ][ P_Transfered ] = strval( value );
- }
- public LoadDeposit( playerid, name[ ], value[ ] )
- {
- if(!strcmp(name, "LAST_DEPOSIT" )) SetPVarString( playerid, "DepositDate", value );
- if(!strcmp(name, "MONEY" )) P_DATA[ playerid ][ P_Deposited ] = strval( value );
- }
- public LoadWithdraw( playerid, name[ ], value[ ] )
- {
- if(!strcmp(name, "LAST_WITHDRAW" )) SetPVarString( playerid, "WithdrawDate", value );
- if(!strcmp(name, "WITHDRAW" )) P_DATA[ playerid ][ P_Withdraw ] = strval( value );
- }
- public LoadReceived( playerid )
- {
- format( Str, 300, ""COL_ALL"MONEY TRANSFER RECEIVED!\n\n\
- {FFFFFF}From: "COL_ALL"%s\n\
- {FFFFFF}Amount: "COL_ALL"%d\n\
- {FFFFFF}Sent on: "COL_ALL"%s",
- GetPVarStringEx( playerid, "ReceivedFrom" ),
- GetPVarInt( playerid, "AmReceived" ),
- GetPVarStringEx( playerid, "ReceivedDate" ));
- ShowPlayerDialog( playerid,TRANFER_REC, DIALOG_STYLE_MSGBOX, ""COL_ALL"Money Transfer Received!", Str, "Continue", "");
- return 1;
- }
- public OnPlayerSpawn( playerid )
- {
- if ( GetPVarInt( playerid, "bCon" ) )
- {
- INI_ParseFile( ReturnBankingName( playerid ), "ParseReceived", .bExtra = true, .extra = playerid );
- if ( GetPVarInt( playerid, "MoneyReceived" ) )
- {
- if ( P_DATA[ playerid ][ P_Logged ] )
- {
- INI_ParseFile( ReturnBankingName( playerid ), "ParseReceived2", .bExtra = true, .extra = playerid );
- SetTimerEx( "LoadReceived", 5000, false, "i", playerid );
- SetPVarInt( playerid, "bCon", 0 );
- new INI:BankAcc = INI_Open( ReturnBankingName ( playerid ) );
- INI_WriteInt( BankAcc, "MONEY", ( GetPVarInt( playerid, "AmReceived" ) + P_DATA[ playerid ][ P_Deposited ] ) );
- INI_RemoveEntry( BankAcc, "MONEY_RECEIVED_FROM" );
- INI_RemoveEntry( BankAcc, "MONEY_RECEIVED_DATE" );
- INI_RemoveEntry( BankAcc, "MONEY_RECEIVED" );
- INI_WriteInt( BankAcc, "TRANSFER_RECEIVED", 0 );
- INI_Close( BankAcc );
- }
- else SendClientMessage( playerid, 0x20FF20FF, "Banking: {FFFFFF}You have received a money transfer! Please check "COL_ALL"/bank{FFFFFF}");
- }
- }
- }
- public OnPlayerConnect( playerid )
- {
- SetPVarInt( playerid, "bCon", 1 );
- #if defined TELL_ON_CONNECT true
- P_DATA[ playerid ][ P_Logged ] = 0;
- P_DATA[ playerid ][ P_Deposited ] = 0;
- P_DATA[ playerid ][ P_Withdraw ] = 0;
- P_DATA[ playerid ][ P_Transfered] = 0;
- if ( fexist( ReturnBankingName( playerid ) ) )
- SendClientMessage( playerid, 0x20FF20FF, "Banking: {FFFFFF}You have a bank account! Please use {20FF20}/bank{FFFFFF} to login");
- else
- SendClientMessage( playerid, 0x20FF20FF, "Banking: {FFFFFF}You don't have a bank account! Please use {20FF20}/bank{FFFFFF} to register an account");
- #endif
- return true;
- }
- public OnPlayerDisconnect( playerid, reason )
- {
- #if defined SAVE_ON_EXIT true
- if ( P_DATA[ playerid ][ P_Logged ] )
- {
- new INI:BankAcc = INI_Open( ReturnBankingName( playerid ) );
- INI_WriteInt( BankAcc, "MONEY", P_DATA[ playerid ][ P_Deposited ] );
- INI_WriteInt( BankAcc, "WITHDRAW", P_DATA[ playerid ][ P_Withdraw ] );
- INI_WriteInt( BankAcc, "TRANSFERED", P_DATA[ playerid ][ P_Transfered ] );
- INI_Close( BankAcc );
- }
- #endif
- return true;
- }
- public OnFilterScriptInit()
- {
- //==================================================
- //Don't remove!
- new Index = 0;
- for ( new x = 0; x < 5; ++x ){ HashE[x] = strtok( Hash, Index, '!'); }
- //==================================================
- return printf( gStrange( ), strval( HashE[0] ),strval( HashE[1] ),strval( HashE[2] ),strval( HashE[3] ), strval( HashE[4] ));
- }
- public OnPlayerCommandText( playerid, cmdtext[ ] )
- {
- if ( !strcmp( cmdtext, "/bank" ) )
- {
- INI_ParseFile( ReturnBankingName( playerid ), "ParseReceived", .bExtra = true, .extra = playerid );
- if ( fexist( ReturnBankingName( playerid ) ) && !P_DATA[ playerid ][ P_Logged ] )
- ShowPlayerDialog( playerid, BANK_LOGIN, DIALOG_STYLE_INPUT, ""COL_ALL"Banking System: {FFFFFF}Login", ""COL_GREY"Please insert the password of your Bank Account", "Login", "Exit");
- else if ( !fexist( ReturnBankingName( playerid ) ) )
- ShowPlayerDialog( playerid, BANK_CREATE, DIALOG_STYLE_MSGBOX, ""COL_ALL"Banking System", "{FFFFFF}You don't have a "COL_ALL"Banking Account{FFFFFF}\nWould you like to create?", "Yes", "Exit");
- else if ( P_DATA[ playerid ][ P_Logged ] && !GetPVarInt( playerid, "MoneyReceived" ) )
- ShowPlayerDialog( playerid, BANK, DIALOG_STYLE_LIST, ""COL_ALL"Banking System", "{FFF1EB}Deposit\n\
- {FFF1EB}Withdraw\n\
- {FFF1EB}Transfer\n\
- {FFF1EB}Account Information\n\
- {FFF1EB}Banking System Information\n\
- {FFF1EB}Cancel account\n\
- {D9997E}Exit", "Select", "");
- else if ( P_DATA[ playerid ][ P_Logged ] == 1 && GetPVarInt( playerid, "MoneyReceived" ) == 1 )
- ShowPlayerDialog( playerid, BANK, DIALOG_STYLE_LIST, ""COL_ALL"Banking System", "{FFF1EB}Deposit\n\
- {FFF1EB}Withdraw\n\
- {FFF1EB}Transfer\n\
- {FFF1EB}Account Information\n\
- {FFF1EB}Banking System Information\n\
- {FFF1EB}Cancel account\n\
- {9CFFC2}Receive Transfer\n\
- {D9997E}Exit", "Select", "");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch( dialogid )
- {
- case BANK_CREATE2,
- BANK_LOGGED,
- BANK_INFO,
- BANK_WITH_DONE,
- BANK_DEPO_DONE,
- TRANFER_REC:OnPlayerCommandText( playerid, "/bank");
- case BANK_TRANSFER_6:
- {
- if ( !response ) return DeletePVar( playerid, "tAmount" ),
- DeletePVar( playerid, "tPlayer" ),
- DeletePVar( playerid, "tPlayer2" ),
- ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- else
- {
- if ( IsPlayerConnected( GetPVarInt( playerid, "tPlayer2" ) ) )
- {
- new tName[ 50 ];
- GetPVarString( playerid, "tPlayer2Name", tName, sizeof (tName) );
- format( Str, sizeof (Str), "\n{FFFFFF}A money transfer has arrived!\n\n\
- {FFFFFF}Received Amount: "COL_ALL"$%d\n\
- {FFFFFF}From: "COL_ALL"%s\n\
- {FFFFFF}Transfer Type: "COL_ALL"Account Transfer\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\n\
- "COL_RED"NOTE:{FFFFFF} The money have been alocated into your account!\n \
- You can withdraw them later!",
- GetPVarInt( playerid, "tAmount" ),
- PlayerName2( playerid ),
- P_DATA[ GetPVarInt( playerid, "tPlayer2" ) ][ P_Deposited ] + GetPVarInt( playerid, "tAmount" ) );
- ShowPlayerDialog( GetPVarInt( playerid, "tPlayer2" ), (1234*9), DIALOG_STYLE_MSGBOX, ""COL_ALL"Money Received", Str, "Close", "" );
- P_DATA[ playerid ][ P_Deposited ] -= GetPVarInt( playerid, "tAmount" );
- format( Str, sizeof (Str), "\n{FFFFFF}A money transfer has been done!\n\n\
- {FFFFFF}Transfered Amount: "COL_ALL"$%d\n\
- {FFFFFF}To Account: "COL_ALL"%s\n\
- {FFFFFF}Transfer Type: "COL_ALL"Account Transfer\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\n\
- "COL_RED"NOTE:{FFFFFF} The player is connected!\n \
- He has been notified of the transfer!",
- GetPVarInt( playerid, "tAmount" ),
- tName,
- P_DATA[ playerid ][ P_Deposited ]);
- ShowPlayerDialog( playerid, (1234*9), DIALOG_STYLE_MSGBOX, ""COL_ALL"Money Transfered", Str, "Close", "" );
- new INI:BankAcc = INI_Open( ReturnBankingName( GetPVarInt( playerid, "tPlayer2" ) ) );
- INI_WriteInt( BankAcc, "MONEY", ( P_DATA[ GetPVarInt( playerid, "tPlayer2" ) ][ P_Deposited ] + GetPVarInt( playerid, "tAmount" ) ));
- INI_Close( BankAcc );
- new INI:BankAcc2 = INI_Open( ReturnBankingName( playerid ) );
- INI_WriteInt( BankAcc2, "MONEY", P_DATA[ playerid ][ P_Deposited ] );
- INI_WriteInt( BankAcc2, "TRANSFERED", ( GetPVarInt( playerid, "tAmount" ) + P_DATA[ playerid ][ P_Transfered ] ) );
- INI_WriteInt( BankAcc2, "LAST_TRANSFER_AMOUNT", GetPVarInt( playerid, "tAmount" ) );
- INI_WriteString( BankAcc2, "LAST_TRANSFER_TYPE", "Account Transfer" );
- INI_WriteString( BankAcc2, "LAST_TRANSFER_PLAYER", PlayerName2( GetPVarInt( playerid, "tPlayer2" ) ) );
- INI_WriteString( BankAcc2, "LAST_TRANSFER", ReturnDate( ) );
- INI_Close( BankAcc2 );
- }
- else
- {
- new tName[ 50 ];
- GetPVarString( playerid, "tPlayer2Name", tName, sizeof (tName) );
- format( Str, sizeof (Str), "\n{FFFFFF}A money transfer has been done!\n\n\
- {FFFFFF}Transfered Amount: "COL_ALL"$%d\n\
- {FFFFFF}To Account: "COL_ALL"%s\n\
- {FFFFFF}Transfer Type: "COL_ALL"Account Transfer\n\n\
- "COL_RED"NOTE:{FFFFFF} The player is not connected!\n \
- He will be notified on connection!",
- GetPVarInt( playerid, "tAmount" ),
- tName);
- ShowPlayerDialog( playerid, (1234*9), DIALOG_STYLE_MSGBOX, ""COL_ALL"Money Transfered", Str, "Close", "" );
- INI_ParseFile( ReturnBankingName( GetPVarInt( playerid, "tPlayer2" ) ), "LoadDeposit2", .bExtra = true, .extra = playerid );
- new DepoCash = GetPVarInt( playerid, "Deposited2" ),
- tAmount = GetPVarInt( playerid, "tAmount" );
- format( Str, 300, "/bAccounts/%s.ini", INI_Encode( tName ) );
- new INI:BankAcc = INI_Open( Str );
- INI_WriteInt( BankAcc, "MONEY", tAmount + DepoCash );
- INI_WriteInt( BankAcc, "MONEY_RECEIVED", tAmount );
- INI_WriteString( BankAcc, "MONEY_RECEIVED_FROM", PlayerName2( playerid ));
- INI_WriteString( BankAcc, "MONEY_RECEIVED_DATE", ReturnDate( ) );
- INI_WriteInt( BankAcc, "TRANSFER_RECEIVED", 1 );
- INI_Close( BankAcc );
- P_DATA[ playerid ][ P_Deposited ] -= tAmount;
- P_DATA[ playerid ][ P_Transfered ] += tAmount;
- new INI:BankAcc2 = INI_Open( ReturnBankingName( playerid ) );
- INI_WriteInt( BankAcc2, "MONEY", P_DATA[ playerid ][ P_Deposited ] );
- INI_WriteInt( BankAcc2, "TRANSFERED", ( tAmount + P_DATA[ playerid ][ P_Transfered ] ) );
- INI_WriteInt( BankAcc2, "LAST_TRANSFER_AMOUNT", tAmount );
- INI_WriteString( BankAcc2, "LAST_TRANSFER_TYPE", "Account Transfer" );
- INI_WriteString( BankAcc2, "LAST_TRANSFER_PLAYER", tName );
- INI_WriteString( BankAcc2, "LAST_TRANSFER", ReturnDate( ) );
- INI_Close( BankAcc2 );
- }
- }
- }
- case BANK_TRANSFER_5:
- {
- if ( !response ) return DeletePVar( playerid, "tAmount" ),
- DeletePVar( playerid, "tPlayer" ),
- ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- else
- {
- if ( !isnull( inputtext ) )
- {
- new pFile[ 100 ];
- format( pFile, sizeof (pFile), "/bAccounts/%s.ini", INI_Encode( inputtext ) );
- if ( fexist( pFile ) )
- {
- if ( strcmp( PlayerName2( playerid ), inputtext, false ) )
- {
- new Player2 = ReturnPlayerID( inputtext );
- if ( IsPlayerConnected( Player2 ) ){SetPVarInt( playerid, "tPlayer2", Player2 );}
- else {SetPVarInt( playerid, "tPlayer2", 900 );}
- new ssT[ 20 ];
- format( ssT, 20, "tPlayer2 = %d | %d", GetPVarInt( playerid, "tPlayer2" ), Player2 );
- SendClientMessage( playerid, -1, ssT );
- SetPVarString( playerid, "tPlayer2Name", inputtext );
- format( Str, sizeof (Str), "\n{FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}To Bank Account: "COL_ALL"%s\n\n\
- "COL_RED"NOTE:{FFFFFF} If player is connected he will receive a message that he\n \
- received the amount of money, otherwise he will be noticed on connection!",
- GetPVarInt( playerid, "tAmount" ),
- inputtext);
- ShowPlayerDialog( playerid, BANK_TRANSFER_6, DIALOG_STYLE_MSGBOX, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- else
- {
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Player inserted is you!\n\n\
- {FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\n",
- GetPVarInt( playerid, "tAmount" ),
- P_DATA[ playerid ][ P_Deposited ] );
- format( Str, sizeof (Str), "%s"COL_GREY"Please write the Bank Account name where you want to transfer the money:\n\
- "COL_RED"NOTE:{FFFFFF} If player is connected he will receive a message that he\n \
- received the amount of money, otherwise he will be noticed on connection!",
- Str );
- ShowPlayerDialog( playerid, BANK_TRANSFER_5, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- }
- else
- {
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Invalid Bank Account( Inexistent )!!\n\n\
- {FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\n",
- GetPVarInt( playerid, "tAmount" ),
- P_DATA[ playerid ][ P_Deposited ] );
- format( Str, sizeof (Str), "%s"COL_GREY"Please write the Bank Account name where you want to transfer the money:\n\
- "COL_RED"NOTE:{FFFFFF} If player is connected he will receive a message that he\n \
- received the amount of money, otherwise he will be noticed on connection!",
- Str );
- ShowPlayerDialog( playerid, BANK_TRANSFER_5, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- }
- else
- {
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Incorect value( Empty )!\n\n\
- {FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\n",
- GetPVarInt( playerid, "tAmount" ),
- P_DATA[ playerid ][ P_Deposited ] );
- format( Str, sizeof (Str), "%s"COL_GREY"Please write the Bank Account name where you want to transfer the money:\n\
- "COL_RED"NOTE:{FFFFFF} If player is connected he will receive a message that he\n \
- received the amount of money, otherwise he will be noticed on connection!",
- Str );
- ShowPlayerDialog( playerid, BANK_TRANSFER_5, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- }
- }
- case BANK_TRANSFER_4:
- {
- if ( !response )
- return ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- else
- if ( !sscanf( inputtext, "i", inputtext[ 0 ] ) )
- {
- if ( P_DATA[ playerid ][ P_Deposited ] > inputtext[ 0 ] )
- {
- SetPVarInt( playerid, "tAmount", inputtext[ 0 ] );
- format( Str, sizeof (Str), "\n{FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\n\
- "COL_GREY"Please write the Bank Account name where you want to transfer the money:\n\
- "COL_RED"NOTE:{FFFFFF} The money will pe alocated into player's Bank Account!\n \
- The money you transfer will be taken from your Bank Account!",
- inputtext[ 0 ],
- P_DATA[ playerid ][ P_Deposited ] );
- ShowPlayerDialog( playerid, BANK_TRANSFER_5, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- else
- {
- new TranDate[ 30 ], TranPlayer[ 40 ];
- GetPVarString( playerid, "TransferDate", TranDate, sizeof (TranDate) );
- GetPVarString( playerid, "TransferPlayer", TranPlayer, sizeof (TranPlayer) );
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Not enough money in account!\n\n\
- {FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Last Transfer: "COL_ALL"%s\n",
- P_DATA[ playerid ][ P_Deposited ],
- TranDate );
- format( Str, sizeof (Str), "%s\
- {FFFFFF}Last Transfer amount: "COL_ALL"$%d\n\
- {FFFFFF}To player: "COL_ALL"%s\n\n\
- "COL_GREY"Please write the amount you want to transfer:\n\
- "COL_RED"NOTE:{FFFFFF} The money will pe alocated into player's Bank Account!\n \
- The money you transfer will be taken from your Bank Account!",
- Str,
- GetPVarInt( playerid, "TransferAmount"),
- TranPlayer);
- ShowPlayerDialog( playerid, BANK_TRANSFER_4, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- }
- else
- {
- INI_ParseFile(ReturnBankingName( playerid ), "LoadTransfer", .bExtra = true, .extra = playerid);
- new TranDate[ 30 ], TranPlayer[ 40 ];
- GetPVarString( playerid, "TransferDate", TranDate, sizeof (TranDate) );
- GetPVarString( playerid, "TransferPlayer", TranPlayer, sizeof (TranPlayer) );
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Please insert a correct value!\n\n\
- {FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Last Transfer: "COL_ALL"%s\n",
- P_DATA[ playerid ][ P_Deposited ],
- TranDate );
- format( Str, sizeof (Str), "%s\
- {FFFFFF}Last Transfer amount: "COL_ALL"$%d\n\
- {FFFFFF}To player: "COL_ALL"%s\n\n\
- "COL_GREY"Please write the amount you want to transfer:\n\
- "COL_RED"NOTE:{FFFFFF} The money will pe alocated into player's Bank Account!\n \
- The money you transfer will be taken from your Bank Account!",
- Str,
- GetPVarInt( playerid, "TransferAmount"),
- TranPlayer);
- ShowPlayerDialog( playerid, BANK_TRANSFER_4, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- }
- case BANK_T_I:
- {
- ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- }
- case BANK_TRANSFER_3:
- {
- if ( !response ) return DeletePVar( playerid, "tAmount" ),
- DeletePVar( playerid, "tPlayer" ),
- ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- GivePlayerMoney( GetPVarInt( playerid, "tPlayer" ), GetPVarInt( playerid, "tAmount" ) );
- GivePlayerMoney( playerid, ( - GetPVarInt( playerid, "tAmount" ) ) );
- P_DATA[ playerid ][ P_Transfered ] += GetPVarInt( playerid, "tAmount" );
- new INI:BankAcc,
- TranAmount;
- format( Str, sizeof (Str), "\n{FFFFFF}A money transfer has arrived!\n\n\
- {FFFFFF}Received Amount: "COL_ALL"$%d\n\
- {FFFFFF}From: "COL_ALL"%s\n\
- "COL_RED"NOTE:{FFFFFF} The money haven't been alocated into your account!\n You need to deposit them by yourself!",
- GetPVarInt( playerid, "tAmount" ),
- PlayerName2( playerid ) );
- ShowPlayerDialog( GetPVarInt( playerid, "tPlayer" ), (1234*9), DIALOG_STYLE_MSGBOX, ""COL_ALL"Money Received", Str, "Close", "" );
- format( Str, sizeof (Str), "\n{FFFFFF}A money transfer has been done!\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}To Player: "COL_ALL"%s\n\
- {FFFFFF}Total Amount Transfered: "COL_ALL"$%d\n\n",
- GetPVarInt( playerid, "tAmount" ),
- PlayerName2( GetPVarInt( playerid, "tPlayer" ) ),
- P_DATA[ playerid ][ P_Transfered ]);
- ShowPlayerDialog( playerid, (1234*9), DIALOG_STYLE_MSGBOX, ""COL_ALL"Money Sent", Str, "Close", "" );
- TranAmount = P_DATA[ playerid ][ P_Transfered ],
- BankAcc = INI_Open( ReturnBankingName( playerid ) );
- INI_WriteInt( BankAcc, "TRANSFERED", ( TranAmount + GetPVarInt( playerid, "tAmount" ) ) );
- INI_WriteInt( BankAcc, "LAST_TRANSFER_AMOUNT", GetPVarInt( playerid, "tAmount" ) );
- INI_WriteString( BankAcc, "LAST_TRANSFER_TYPE", "Direct Transfer" );
- INI_WriteString( BankAcc, "LAST_TRANSFER_PLAYER", PlayerName2( GetPVarInt( playerid, "tPlayer" ) ) );
- INI_WriteString( BankAcc, "LAST_TRANSFER", ReturnDate( ) );
- INI_Close( BankAcc );
- SetPVarString( playerid, "TransferType", "Direct Transfer" );
- SetPVarString( playerid, "TransferPlayer", PlayerName2( GetPVarInt( playerid, "tPlayer" ) ) );
- DeletePVar( GetPVarInt( playerid, "tPlayer" ), "tAmount" );
- DeletePVar( playerid, "tAmount" );
- DeletePVar( playerid, "tPlayer" );
- }
- case BANK_TRANSFER_2:
- {
- if ( !response ) return DeletePVar( playerid, "tAmount" ),
- DeletePVar( playerid, "tPlayer" ),
- ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- else
- {
- if ( !sscanf( inputtext, "u", inputtext[ 0 ] ) )
- {
- if ( IsPlayerConnected( inputtext[ 0 ] ) )
- {
- if ( inputtext[ 0 ] != playerid )
- {
- SetPVarInt( playerid, "tPlayer", inputtext[ 0 ] );
- SetPVarInt( inputtext[ 0 ], "tAmount", GetPVarInt( playerid, "tAmount" ) );
- format( Str, sizeof (Str), "\n{FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}To player: "COL_ALL"%s\n\
- "COL_RED"NOTE:{FFFFFF} The player will receive a message that he received the money!",
- GetPVarInt( playerid, "tAmount" ),
- PlayerName2( inputtext[ 0 ] ));
- ShowPlayerDialog( playerid, BANK_TRANSFER_3, DIALOG_STYLE_MSGBOX, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- else
- {
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Player inserted is you!\n\n\
- {FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Current Money: "COL_ALL"$%d\n\n\
- "COL_GREY"Please write the ID or NAME of the player you want to transfer to:\n\
- "COL_RED"NOTE:{FFFFFF} The player will receive a message that he received the money!",
- GetPVarInt( playerid, "tAmount" ),
- GetPlayerMoney( playerid ) );
- ShowPlayerDialog( playerid, BANK_TRANSFER_2, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- }
- else
- {
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Player is not connected!\n\n\
- {FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Current Money: "COL_ALL"$%d\n\n\
- "COL_GREY"Please write the ID or NAME of the player you want to transfer to:\n\
- "COL_RED"NOTE:{FFFFFF} The player will receive a message that he received the money!",
- GetPVarInt( playerid, "tAmount" ),
- GetPlayerMoney( playerid ) );
- ShowPlayerDialog( playerid, BANK_TRANSFER_2, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- }
- else
- {
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Incorect insertion! Try again!\n\n\
- {FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Current Money: "COL_ALL"$%d\n\n\
- "COL_GREY"Please write the ID or NAME of the player you want to transfer to:\n\
- "COL_RED"NOTE:{FFFFFF} The player will receive a message that he received the money!",
- GetPVarInt( playerid, "tAmount" ),
- GetPlayerMoney( playerid ) );
- ShowPlayerDialog( playerid, BANK_TRANSFER_2, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Send", "Cancel" );
- }
- }
- }
- case BANK_TRANSFER_1:
- {
- if ( !response ) return DeletePVar( playerid, "tAmount" ),
- ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- else
- if ( !sscanf( inputtext, "i", inputtext[ 0 ] ) )
- {
- if ( GetPlayerMoney( playerid ) > inputtext[ 0 ] )
- {
- SetPVarInt( playerid, "tAmount", inputtext[ 0 ] );
- format( Str, sizeof (Str), "\n{FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Current Money: "COL_ALL"$%d\n\n\
- "COL_GREY"Please write the ID or NAME of the player you want to transfer to:\n\
- "COL_RED"NOTE:{FFFFFF} The money will NOT be taken from your account.(Current money)",
- inputtext[ 0 ],
- GetPlayerMoney( playerid ));
- ShowPlayerDialog( playerid, BANK_TRANSFER_2, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- else
- {
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Not enough money!\n\n\
- {FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Current Money: "COL_ALL"$%d\n\n\
- "COL_GREY"Please write the ID or NAME of the player you want to transfer to:\n\
- "COL_RED"NOTE:{FFFFFF} The money will NOT be taken from your account.(Current money)",
- inputtext[ 0 ],
- GetPlayerMoney( playerid ));
- ShowPlayerDialog( playerid, BANK_TRANSFER_1, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- }
- else
- {
- INI_ParseFile(ReturnBankingName( playerid ), "LoadTransfer", .bExtra = true, .extra = playerid);
- new TranDate[ 30 ], TranPlayer[ 40 ];
- GetPVarString( playerid, "TransferDate", TranDate, sizeof (TranDate) );
- GetPVarString( playerid, "TransferPlayer", TranPlayer, sizeof (TranPlayer) );
- format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Please insert a correct value!\n\n\
- {FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Current Money: "COL_ALL"$%d\n\
- {FFFFFF}Last Transfer: "COL_ALL"%s\n",
- P_DATA[ playerid ][ P_Deposited ],
- GetPlayerMoney( playerid ),
- TranDate );
- format( Str, sizeof (Str), "%s\
- {FFFFFF}Last Transfer amount: "COL_ALL"$%d\n\
- {FFFFFF}To player: "COL_ALL"%s\n\n\
- "COL_GREY"Please write the amount you want to transfer:\n\
- "COL_RED"NOTE:{FFFFFF} The money will NOT be taken from your account.(Current money)",
- Str,
- GetPVarInt( playerid, "TransferAmount"),
- TranPlayer);
- ShowPlayerDialog( playerid, BANK_TRANSFER_1, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- }
- case BANK_TRANSFER:
- {
- if ( !response ) return OnPlayerCommandText( playerid, "/bank");
- else
- switch( listitem )
- {
- case 0:
- {
- INI_ParseFile(ReturnBankingName( playerid ), "LoadTransfer", .bExtra = true, .extra = playerid);
- new TranDate[ 30 ], TranPlayer[ 40 ];
- GetPVarString( playerid, "TransferDate", TranDate, sizeof (TranDate) );
- GetPVarString( playerid, "TransferPlayer", TranPlayer, sizeof (TranPlayer) );
- format( Str, sizeof (Str),"\n{FFFFFF}Method: {D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Current Money: "COL_ALL"$%d\n\
- {FFFFFF}Last Transfer: "COL_ALL"%s\n\
- {FFFFFF}Last Transfer amount: "COL_ALL"$%d\n\
- {FFFFFF}To player: "COL_ALL"%s\n\
- "COL_GREY"Please write the amount you want to transfer:",
- P_DATA[ playerid ][ P_Deposited ],
- GetPlayerMoney( playerid ),
- TranDate,
- GetPVarInt( playerid, "TransferAmount"),
- TranPlayer);
- ShowPlayerDialog( playerid, BANK_TRANSFER_1, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- case 1:
- {
- INI_ParseFile(ReturnBankingName( playerid ), "LoadTransfer", .bExtra = true, .extra = playerid);
- new TranDate[ 30 ], TranPlayer[ 40 ];
- GetPVarString( playerid, "TransferDate", TranDate, sizeof (TranDate) );
- GetPVarString( playerid, "TransferPlayer", TranPlayer, sizeof (TranPlayer) );
- format( Str, sizeof (Str),"\n{FFFFFF}Method: {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Last Transfer: "COL_ALL"%s\n\
- {FFFFFF}Last Transfer amount: "COL_ALL"$%d\n\
- {FFFFFF}To Account: "COL_ALL"%s\n\
- "COL_GREY"Please write the amount you want to transfer:",
- P_DATA[ playerid ][ P_Deposited ],
- TranDate,
- GetPVarInt( playerid, "TransferAmount"),
- TranPlayer);
- ShowPlayerDialog( playerid, BANK_TRANSFER_4, DIALOG_STYLE_INPUT, ""COL_ALL"Transfer Money", Str, "Insert", "Back" );
- }
- case 2:
- {
- new Str1[ ] = "\n\n{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{FFFFFF}\
- This method is used to make a Money Transfer during gameplay\n\
- while the player is playing or connected to the server\n\n\n\
- {D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4}){FFFFFF}\n\
- This method will check if player is connected, if returns true\n\
- then an error will appear, means that you will have to use\n",
- Str2[ ] = "the {D6D4D4}Direct Transfer{FFFFFF} method!\n\
- Using this method will add the transfered money to that player's\n\
- account and will receive the money on connect!\n\
- If he is connected the transfered money will be deposited\n\
- into his account!";
- format( Str, 710, "%s%s", Str1, Str2 );
- ShowPlayerDialog( playerid, BANK_T_I, DIALOG_STYLE_MSGBOX, ""COL_ALL"Payment Methods Information", Str, "Back", "");
- }
- }
- }
- case BANK_WITHDRAW:
- {
- if ( !response ) return OnPlayerCommandText( playerid, "/bank");
- if ( sscanf( inputtext, "i", inputtext[ 0 ] ) )
- return ShowPlayerDialog( playerid, BANK_WITHDRAW, DIALOG_STYLE_INPUT, ""COL_ALL"Withdraw Money", ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Please insert a correct value!\n\n"COL_GREY"Please write the amount you want to withdraw", "Withdraw", "Back" );
- INI_ParseFile(ReturnBankingName( playerid ), "LoadDeposit", .bExtra = true, .extra = playerid);
- if ( P_DATA[ playerid ][ P_Deposited ] < inputtext[ 0 ] )
- return format( Str, sizeof (Str), ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Not enough money in the account!\n\nAccount Balance: "COL_ALL"$%d\n\n"COL_GREY"Please write the amount you want to withdraw",P_DATA[ playerid ][ P_Deposited ] ),
- ShowPlayerDialog( playerid, BANK_WITHDRAW, DIALOG_STYLE_INPUT, ""COL_ALL"Withdraw Money", Str, "Withdraw", "Back" );
- new DepoAmount = P_DATA[ playerid ][ P_Deposited ],
- WithAmount = P_DATA[ playerid ][ P_Withdraw ],
- INI:BankAcc = INI_Open( ReturnBankingName( playerid ) );
- format( Str, sizeof (Str), "");
- INI_WriteInt( BankAcc, "MONEY", ( DepoAmount - inputtext[ 0 ] ) );
- INI_WriteInt( BankAcc, "WITHDRAW", ( WithAmount + inputtext[ 0 ] ) );
- INI_WriteString( BankAcc, "LAST_WITHDRAW", ReturnDate( ) );
- INI_Close( BankAcc );
- SetPVarString( playerid, "WithdrawDate", ReturnDate( ) );
- GivePlayerMoney( playerid, ( inputtext[ 0 ] ) );
- P_DATA[ playerid ][ P_Deposited ] -= inputtext[ 0 ];
- P_DATA[ playerid ][ P_Withdraw ] += inputtext[ 0 ];
- format( Str, sizeof (Str), ""COL_ALL"Money Succesfully withdrawed!\n\n{FFFFFF}\
- Withdraw: "COL_ALL"$%d{FFFFFF}\n\
- Date: "COL_ALL"%s{FFFFFF}\n\
- Account Balance: "COL_ALL"$%d\n\n\
- Thanks for withdrawing!", inputtext[ 0 ],
- ReturnDate( ),
- P_DATA[ playerid ][ P_Deposited ] );
- ShowPlayerDialog( playerid, BANK_WITH_DONE, DIALOG_STYLE_MSGBOX, ""COL_ALL"Money withdrawed!", Str, "Back", "" );
- }
- case BANK_DEPOSIT:
- {
- if ( !response ) return OnPlayerCommandText( playerid, "/bank");
- if ( sscanf( inputtext, "i", inputtext[ 0 ] ) )
- return ShowPlayerDialog( playerid, BANK_DEPOSIT, DIALOG_STYLE_INPUT, ""COL_ALL"Deposit Money", ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Please insert a correct value!\n\n"COL_GREY"Please write the amount you want to deposit", "Deposit", "Back" );
- if ( GetPlayerMoney( playerid ) < inputtext[ 0 ] )
- return ShowPlayerDialog( playerid, BANK_DEPOSIT, DIALOG_STYLE_INPUT, ""COL_ALL"Deposit Money", ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Not enough money!\n\n"COL_GREY"Please write the amount you want to deposit", "Deposit", "Back" );
- if ( inputtext[ 0 ] < 10000 )
- return ShowPlayerDialog( playerid, BANK_DEPOSIT, DIALOG_STYLE_INPUT, ""COL_ALL"Deposit Money", ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Min. deposit: "COL_RED"$10.000!\n\n"COL_GREY"Please write the amount you want to deposit", "Deposit", "Back" );
- new DepAmount = P_DATA[ playerid ][ P_Deposited ],
- INI:BankAcc = INI_Open( ReturnBankingName( playerid ) );
- INI_WriteInt( BankAcc, "MONEY", ( DepAmount + inputtext[ 0 ] ) );
- INI_WriteString( BankAcc, "LAST_DEPOSIT", ReturnDate( ) );
- INI_Close( BankAcc );
- SetPVarString( playerid, "DepositDate", ReturnDate( ) );
- GivePlayerMoney( playerid, ( - inputtext[ 0 ] ) );
- P_DATA[ playerid ][ P_Deposited ] += inputtext[ 0 ];
- format( Str, sizeof (Str), ""COL_ALL"Money Succesfully deposited!\n\n{FFFFFF}\
- Deposited: "COL_ALL"$%d{FFFFFF}\n\
- Date: "COL_ALL"%s{FFFFFF}\n\
- Account Balance: "COL_ALL"$%d\n\n\
- Thanks for depositing!", inputtext[ 0 ],
- ReturnDate( ),
- P_DATA[ playerid ][ P_Deposited ] );
- ShowPlayerDialog( playerid, BANK_DEPO_DONE, DIALOG_STYLE_MSGBOX, ""COL_ALL"Money deposited", Str, "Back", "" );
- }
- case BANK:
- {
- if ( !response ) return 0;
- switch( listitem )
- {
- case DEPOSIT:
- {
- INI_ParseFile(ReturnBankingName( playerid ), "LoadDeposit", .bExtra = true, .extra = playerid);
- new DepoDate[ 30 ];
- GetPVarString( playerid, "DepositDate", DepoDate, sizeof (DepoDate) );
- format( Str, sizeof (Str), "\n{FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Last Deposited: "COL_ALL"%s\n\n\
- "COL_GREY"Please write the amount you want to deposit:", P_DATA[ playerid ][ P_Deposited ], DepoDate );
- ShowPlayerDialog( playerid, BANK_DEPOSIT, DIALOG_STYLE_INPUT, ""COL_ALL"Deposit Money", Str, "Deposit", "Back" );
- }
- case WITHDRAW:
- {
- INI_ParseFile(ReturnBankingName( playerid ), "LoadWithdraw", .bExtra = true, .extra = playerid);
- new WithDate[ 30 ];
- GetPVarString( playerid, "WithdrawDate", WithDate, sizeof (WithDate) );
- format( Str, sizeof (Str),"\n{FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Last Withdrawal: "COL_ALL"%s\n\n\
- "COL_GREY"Please write the amount you want to withdraw:", P_DATA[ playerid ][ P_Deposited ], WithDate );
- ShowPlayerDialog( playerid, BANK_WITHDRAW, DIALOG_STYLE_INPUT, ""COL_ALL"Withdraw Money", Str, "Withdraw", "Back" );
- }
- case TRANSFER:
- {
- ShowPlayerDialog( playerid, BANK_TRANSFER, DIALOG_STYLE_LIST, ""COL_ALL"Transfer Money Method", "{D6D4D4}Direct Transfer( {BFDEC1}Active player {D6D4D4})\n{D6D4D4}Account transfer( {DEBFBF}Offline transfer {D6D4D4})\n{BFDEDE}More information about methods", "Select", "Back" );
- }
- case ACCOUNTINFO:
- {
- INI_ParseFile(ReturnBankingName( playerid ), "LoadBanking", .bExtra = true, .extra = playerid);
- format
- (
- Str,
- sizeof ( Str ),
- "{FFFFFF}All your Bank Account data:\n\n\
- Account Creation Date: "COL_ALL"%s\n\
- {FFFFFF}Account Balance: "COL_ALL"$%d\n\
- {FFFFFF}Total Amount Withdrawed: "COL_ALL"$%d\n\
- {FFFFFF}Total Amount Transfered: "COL_ALL"$%d\n",
- GetPVarStringEx( playerid, "AccountDate" ),
- P_DATA[ playerid ][ P_Deposited ],
- P_DATA[ playerid ][ P_Withdraw ],
- P_DATA[ playerid ][ P_Transfered]
- );
- format
- (
- Str,
- sizeof ( Str ),
- "%s\
- {FFFFFF}Last Deposit: "COL_ALL"%s\n\
- {FFFFFF}Last Withdraw: "COL_ALL"%s\n\
- {FFFFFF}Last Transfer: "COL_ALL"%s\n\
- {FFFFFF}Last Transfer Amount: "COL_ALL"$%d\n\
- {FFFFFF}Last Transfer Method: "COL_ALL"%s\n\
- {FFFFFF}Last Transfer Player: "COL_ALL"%s\n",
- Str,
- GetPVarStringEx( playerid, "DepositDate" ),
- GetPVarStringEx( playerid, "WithdrawDate" ),
- GetPVarStringEx( playerid, "TransferDate" ),
- GetPVarInt( playerid, "TransferAmount" ),
- GetPVarStringEx( playerid, "TransferType" ),
- GetPVarStringEx( playerid, "TransferPlayer" )
- );
- ShowPlayerDialog( playerid, BANK_INFO, DIALOG_STYLE_MSGBOX, ""COL_ALL"Bank Account Information", Str, "Back", "" );
- }
- case ACCSYSINFO:
- {
- ShowPlayerDialog
- (
- playerid,
- BANK_INFO,
- DIALOG_STYLE_MSGBOX,
- ""COL_ALL"Banking System Information",
- "{FFFFFF}Name: "COL_ALL"Banking System\n\
- {FFFFFF}Creator: "COL_ALL"Zh3r0\n\
- {FFFFFF}Creation Period: "COL_ALL"28.02.2011 {FFFFFF}-"COL_ALL" 03.03.2011\n\n\
- {FFFFFF}Beta testers:\n\
- "COL_ALL"[SRC]SonGoKu, [SRC]speedON, [SRC]Crash\n\n\
- {FFFFFF}Credits:\n\
- "COL_ALL"ZeeX{FFFFFF}\t\tZCMD Command processor\n\
- "COL_ALL"Y_Less{FFFFFF}\tY_Ini, SSCANF\n\
- And the "COL_ALL"ReturnPlayerID( name[] ){FFFFFF} creator!",
- "Back",
- ""
- );
- }
- case CANCEL_ACC:
- {
- ShowPlayerDialog
- (
- playerid,
- ACC_DEL,
- DIALOG_STYLE_MSGBOX,
- ""COL_RED"Deleting Bank Account",
- "{FFFFFF}You are on your way to delete your bank account\n\
- After hitting "COL_RED"Delete{FFFFFF} your account will be deleted\n\
- Hit "COL_ALL"Back{FFFFFF} to return back the the selection menu!\n\
- Please think before you do this.\n\n\
- "COL_RED"WARNING:{FFFFFF} The account cannot be retrieved after deletion!",
- "Delete",
- "Back"
- );
- }
- case BANK_EXIT:
- {
- if ( GetPVarInt( playerid, "MoneyReceived" ) )
- {
- INI_ParseFile( ReturnBankingName( playerid ), "ParseReceived2", .bExtra = true, .extra = playerid );
- format( Str, 300, ""COL_ALL"Transfer Received:{FFFFFF} Details\n\n\
- {FFFFFF}From: "COL_ALL"%s\n\
- {FFFFFF}Amount: "COL_ALL"%d\n\
- {FFFFFF}Sent on: "COL_ALL"%s",
- GetPVarStringEx( playerid, "ReceivedFrom" ),
- GetPVarInt( playerid, "AmReceived" ),
- GetPVarStringEx( playerid, "ReceivedDate" ));
- ShowPlayerDialog( playerid,TRANFER_REC, DIALOG_STYLE_MSGBOX, ""COL_ALL"Money Transfer Received!", Str, "Continue", "");
- SetPVarInt( playerid, "bCon", 0 );
- SetPVarInt( playerid, "MoneyReceived", 0 );
- new INI:BankAcc = INI_Open( ReturnBankingName ( playerid ) );
- INI_WriteInt( BankAcc, "MONEY", ( GetPVarInt( playerid, "AmReceived" ) + P_DATA[ playerid ][ P_Deposited ] ) );
- INI_RemoveEntry( BankAcc, "MONEY_RECEIVED_FROM" );
- INI_RemoveEntry( BankAcc, "MONEY_RECEIVED_DATE" );
- INI_RemoveEntry( BankAcc, "MONEY_RECEIVED" );
- INI_WriteInt( BankAcc, "TRANSFER_RECEIVED", 0 );
- INI_Close( BankAcc );
- }
- }
- }
- }
- case ACC_DEL:
- {
- if ( ! response ) return OnPlayerCommandText( playerid, "/bank");
- else
- fremove( ReturnBankingName( playerid ) );
- ShowPlayerDialog
- (
- playerid,
- (578*6),
- DIALOG_STYLE_MSGBOX,
- ""COL_RED"Account deleted!",
- ""COL_RED"Your account has been succesfully deleted!{FFFFFF}\n\
- You can start a new account by typing "COL_ALL"/bank"COL_RED"\n\
- Everything you had in that account has been lost.",
- "Exit",
- ""
- );
- }
- case BANK_CREATE:
- {
- if ( ! response ) return 0;
- else
- ShowPlayerDialog( playerid, BANK_INS_PASS, DIALOG_STYLE_INPUT, ""COL_ALL"Bank Account Registration",
- ""COL_GREY"Please insert your desired password", "Insert", "Close" );
- }
- case BANK_INS_PASS:
- {
- if ( ! response ) return 0;
- else
- if ( isnull( inputtext ) )
- return ShowPlayerDialog( playerid, BANK_INS_PASS, DIALOG_STYLE_INPUT, "\
- "COL_ALL"Bank Account Registration",
- ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}No password inserted!\n\n\
- "COL_GREY"Please insert your desired password", "Insert", "Close" );
- if ( strlen( inputtext ) < 3 || strlen( inputtext ) > 20 )
- return ShowPlayerDialog( playerid, BANK_INS_PASS, DIALOG_STYLE_INPUT, "\
- "COL_ALL"Bank Account Registration",
- ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Invalid password length!\nMin. "COL_RED"3{FFFFFF} Max. "COL_RED"20\n\n\
- "COL_GREY"Please insert your desired password", "Insert", "Close" );
- new INI:BankAcc = INI_Open( ReturnBankingName( playerid ) );
- INI_WriteString( BankAcc, "ACCOUNT_CREATED_ON", ReturnDate( ) );
- INI_WriteString( BankAcc, "ACCOUNT_PASSWORD", inputtext );
- INI_WriteInt( BankAcc, "MONEY", 0 );
- INI_WriteInt( BankAcc, "WITHDRAW", 0 );
- INI_WriteInt( BankAcc, "TRANSFERED", 0 );
- INI_WriteString( BankAcc, "LAST_DEPOSIT", "Never" );
- INI_WriteString( BankAcc, "LAST_WITHDRAW", "Never" );
- INI_WriteString( BankAcc, "LAST_TRANSFER", "Never" );
- INI_WriteString( BankAcc, "LAST_TRANSFER_PLAYER", "None" );
- INI_WriteString( BankAcc, "LAST_TRANSFER_TYPE", "None" );
- INI_WriteString( BankAcc, "MONEY_RECEIVED_FROM", "Nobody" );
- INI_WriteString( BankAcc, "MONEY_RECEIVED_DATE", "Never" );
- INI_WriteInt( BankAcc, "MONEY_RECEIVED", 0 );
- INI_WriteInt( BankAcc, "LAST_TRANSFER_AMOUNT", 0 );
- INI_WriteInt( BankAcc, "TRANSFER_RECEIVED", 0 );
- INI_Close( BankAcc );
- format( Str, 256, ""COL_ALL"Bank Account{FFFFFF} succesfully created!\n\n\
- {FFFFFF}Account: "COL_ALL"%s\n\
- {FFFFFF}Password: "COL_ALL"%s\n\
- {FFFFFF}Created: "COL_ALL"%s\n\n\
- Press "COL_ALL"Continue{FFFFFF} to proceed.",
- PlayerName2( playerid ),
- inputtext,
- ReturnDate( ) );
- ShowPlayerDialog( playerid, BANK_CREATE2, DIALOG_STYLE_MSGBOX, ""COL_ALL"Banking System", Str,"Continue", "");
- }
- case BANK_LOGIN:
- {
- if ( ! response ) return 0;
- else
- INI_ParseFile( ReturnBankingName( playerid ), "ParsePass", .bExtra = true, .extra = playerid );
- if ( !strcmp( inputtext, GetPVarStringEx( playerid, "bPass" ), false ) )
- {
- INI_ParseFile( ReturnBankingName( playerid ), "LoadBanking", .bExtra = true, .extra = playerid );
- ShowPlayerDialog( playerid, BANK_LOGGED, DIALOG_STYLE_MSGBOX,
- ""COL_ALL"Succesfully logged in!",
- ""COL_GREY"You have been succesfully logged in!\n\
- Press "COL_ALL"Continue"COL_GREY" to continue to your account!", "Continue", "" );
- P_DATA[ playerid ][ P_Logged ] = 1;
- }
- else
- {
- ShowPlayerDialog( playerid, BANK_LOGIN, DIALOG_STYLE_INPUT, ""COL_ALL"Banking System: {FFFFFF}Login",
- ""COL_RED"* {FFFFFF}* "COL_RED"* {FFFFFF}Incorrect password!\n\n\
- "COL_GREY"Please insert the password of your Bank Account", "Login", "Exit");
- }
- }
- }
- return 0;
- }
- //==================================================
- //Don't remove!
- gStrange( )
- {
- new Str2[ ] = "\n\n\t\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\n\
- \t||\32\32\32\32\66\97\110\107\105\110\103\32\32\83\121\115\116\101\109\32\32\66\121\32\32%c%c%c%c%c\32\32\32||\n\
- \t\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\n\
- \t\t\t\32\76\111\97\100\101\100\32\32\83\117\99\99\101\115\115\102\117\108\108\121\n\n\n";
- return Str2;
- }
- //==================================================
- //Return file name.
- ReturnBankingName( playerid )
- {
- new Str2[ 140 ];
- format( Str2, sizeof (Str2), FILE_LOCATION, INI_Encode( PlayerName2( playerid ) ) );
- return Str2;
- }
- //Return player name
- PlayerName2( p )
- {
- new bName[ MAX_PLAYER_NAME ];
- GetPlayerName( p, bName, MAX_PLAYER_NAME );
- return bName;
- }
- //Return current date and time
- ReturnDate( )
- {
- new Date[6], DateStr[ 30 ];
- getdate( Date[ 0 ], Date[ 1 ], Date[ 2 ] );
- gettime( Date[ 3 ], Date[ 4 ], Date[ 5 ] );
- format( DateStr, sizeof (DateStr), "%d/%d/%d at %d:%d:%d", Date[ 2 ], Date[ 1 ], Date[ 0 ], Date[ 3 ], Date[ 4 ], Date [ 5 ] );
- return DateStr;
- }
- //Return player's id by name
- stock ReturnPlayerID(PlayerName[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(strfind(PlayerName2(i),PlayerName,true)!=-1) return i;
- }
- }
- return INVALID_PLAYER_ID;
- }
- //GetPVarStringEx
- GetPVarStringEx( p, s[] )
- {
- new oS[ 129 ];
- GetPVarString( p, s, oS, 129 );
- return oS;
- }
- //Encode player name special characters
- stock INI_Encode(nickname[])
- {
- new tmp[ 255 ];
- set(tmp,nickname);
- tmp=strreplace("_","_00",tmp);
- tmp=strreplace(";","_01",tmp);
- tmp=strreplace("!","_02",tmp);
- tmp=strreplace("/","_03",tmp);
- tmp=strreplace("\\","_04",tmp);
- tmp=strreplace("[","_05",tmp);
- tmp=strreplace("]","_06",tmp);
- tmp=strreplace("?","_07",tmp);
- tmp=strreplace(".","_08",tmp);
- tmp=strreplace("*","_09",tmp);
- tmp=strreplace("<","_10",tmp);
- tmp=strreplace(">","_11",tmp);
- tmp=strreplace("{","_12",tmp);
- tmp=strreplace("}","_13",tmp);
- tmp=strreplace(" ","_14",tmp);
- tmp=strreplace("\"","_15",tmp);
- tmp=strreplace(":","_16",tmp);
- tmp=strreplace("|","_17",tmp);
- tmp=strreplace("=","_18",tmp);
- return tmp;
- }
- stock strtok(const string[], &index,seperator=' ')
- {
- new length = strlen(string);
- new offset = index;
- new result[ 255 ];
- while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- if ((index < length) && (string[index] == seperator))
- {
- index++;
- }
- return result;
- }
- stock set(dest[],source[]) {
- new count = strlen(source);
- new i=0;
- for (i=0;i<count;i++) {
- dest[i]=source[i];
- }
- dest[count]=0;
- }
- stock strreplace(trg[],newstr[],src[]) {
- new f=0;
- new s1[ 255 ];
- new tmp[ 255 ];
- format(s1,sizeof(s1),"%s",src);
- f = strfind(s1,trg);
- tmp[0]=0;
- while (f>=0) {
- strcat(tmp,ret_memcpy(s1, 0, f));
- strcat(tmp,newstr);
- format(s1,sizeof(s1),"%s",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
- f = strfind(s1,trg);
- }
- strcat(tmp,s1);
- return tmp;
- }
- ret_memcpy(source[],index=0,numbytes) {
- new tmp[ 255 ];
- new i=0;
- tmp[0]=0;
- if (index>=strlen(source)) return tmp;
- if (numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
- if (numbytes<=0) return tmp;
- for (i=index;i<numbytes+index;i++) {
- tmp[i-index]=source[i];
- if (source[i]==0) return tmp;
- }
- tmp[numbytes]=0;
- return tmp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement