Raised This Month: $23 Target: $400
 5% 

bank from Napoleon be ( money ) help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pizzadaking
Member
Join Date: Oct 2019
Old 05-02-2020 , 07:19   bank from Napoleon be ( money ) help
Reply With Quote #1

So i want this plugin ( bank from napoleon be Basebuilder bank )
to give confirmations when deposited or withdrawed
so for example if deposited or withdrawed to say :

You have just deposited !g %i !n in your bank account!
You have just withdrawed !g %i !n in your bank account!

The edited bank code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <basebuilder>
#include <cstrike>
#include <nvault>

#pragma semicolon 1

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

#define MAXCASH 16000
#define MAXBANKCASH 1000000000

new const szVersion[] = "1.0.0";

new 
iVault;
new 
iMoney[MAX_PLAYERS 1];


new 
pExceedLimit;

public 
plugin_init() {
      
register_plugin("BankMenu"szVersion"NapoleoN#");

      
iVault nvault_open("BaseBuilderBank");

      
register_clcmd("say /bank""ShowBankMenu");


      
register_clcmd("TakeCashFromBank""WithdrawMessageModeHandler");
      
register_clcmd("DepositCashToBank""DepositMessageModeHandler");
      
register_clcmd("EnterAmount""DonateMessageModeHandler");

      
pExceedLimit =     register_cvar("bank_cashlimit""1"); // Change to 0 if u want to be able to withdraw / deposit more than 16k$
}


public 
plugin_end() {
    
nvault_close(iVault);
}

#if AMXX_VERSION_NUM < 183
public client_disconnect(id) {
#else
public client_disconnected(id) {
#endif
    
SaveData(id);
}

public 
client_authorized(id) {
    
LoadData(id);
}

public 
SaveData(id) {
    new 
szAuth[35], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
formatex(szTempcharsmax(szTemp), "%i"iMoney[id]);

    
nvault_set(iVaultszAuthszTemp);
}

public 
LoadData(id) {
    new 
szAuth[35], szMoney[10], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
nvault_get(iVaultszAuthszTempcharsmax(szTemp));

    
parse(szTempszMoneycharsmax(szMoney));

    
iMoney[id] = str_to_num(szMoney);
}

public 
ShowBankMenu(id) {
    new 
szHeader[70];
    
formatex(szHeadercharsmax(szHeader), "\y[\rDFC] \yBank \wMenu ^n\yYou have \r %i$"iMoney[id]);

    new 
iBankMenu menu_create(szHeader"BankHandler");
    
    
menu_additem(iBankMenu"\wDeposit^n");
    
menu_additem(iBankMenu"\wWithdraw");
    
    
menu_display(idiBankMenu);
}

public 
BankHandler(idiBankMenuiItem) {
    if(
is_user_connected(id) && iItem != MENU_EXIT) {
        switch(
iItem) {
            case 
0client_cmd(id"messagemode DepositCashToBank");
            case 
1client_cmd(id"messagemode TakeCashFromBank");

        }
    }

    
menu_destroy(iBankMenu);
}

public 
WithdrawMessageModeHandler(id) {
    new 
szAmount[10], iAmountiCashiTotalCash;
    
read_argv(1szAmountcharsmax(szAmount));

    
iAmount str_to_num(szAmount);
    
iCash cs_get_user_money(id);
    
iTotalCash iAmount iCash;

    if(
iAmount <= iMoney[id]) {
        if(
iAmount MAXCASH) {
            if(!
get_pcvar_num(pExceedLimit)) {
                
iMoney[id] -= iAmount;
                
cs_set_user_money(idiTotalCash);
            }

            else {
                
ColorChat(idGREEN"^3[^4DFC^3]^1 Max withdrawal amount is 16.000$");
            }
        }

        else {
            if(
iTotalCash <= MAXCASH) {
                
iMoney[id] -= iAmount;
                
cs_set_user_money(idiTotalCash);
            }

            else {
                
ColorChat(idGREEN"^3[^4DFC^3]^1 Max cash limit exceeded.");
            }
        }

    }

    else {
        
ColorChat(idGREEN"^3[^4DFC^3]^1 You can't withdraw more than you currently have banked.");
    }

    
ColorChat(idGREEN"Test: szAmount = %i"iAmount);
}




public 
DepositMessageModeHandler(id) {
    new 
szAmount[10], iAmountiCash;
    
read_argv(1szAmountcharsmax(szAmount));

    
iAmount str_to_num(szAmount);
    
iCash cs_get_user_money(id);

    if(
iAmount 0) {
        if(
iAmount <= iCash) {
            
iMoney[id] += iAmount;
            
cs_set_user_money(idclamp(iCash iAmount0_));
        }

        else {
            
ColorChat(idGREEN"^3[^4DFC^3]^1 You don't have that much cash.");
        }
    }

    else {
        
ColorChat(idGREEN"^3[^4DFC^3]^1 Specify a minimum of 1$");
    }

Pizzadaking is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-02-2020 , 07:24   Re: bank from Napoleon be ( money ) help
Reply With Quote #2

Post in the thread from where you got the plugin. Do not make another one.
__________________
HamletEagle is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-02-2020 , 07:34   Re: bank from Napoleon be ( money ) help
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <basebuilder>
#include <cstrike>
#include <nvault>

#pragma semicolon 1

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

#define MAXCASH 16000
#define MAXBANKCASH 1000000000

new const szVersion[] = "1.0.0";

new 
iVault;
new 
iMoney[MAX_PLAYERS 1];


new 
pExceedLimit;

public 
plugin_init() {
      
register_plugin("BankMenu"szVersion"NapoleoN#");

      
iVault nvault_open("BaseBuilderBank");

      
register_clcmd("say /bank""ShowBankMenu");


      
register_clcmd("TakeCashFromBank""WithdrawMessageModeHandler");
      
register_clcmd("DepositCashToBank""DepositMessageModeHandler");
      
register_clcmd("EnterAmount""DonateMessageModeHandler");

      
pExceedLimit =     register_cvar("bank_cashlimit""1"); // Change to 0 if u want to be able to withdraw / deposit more than 16k$
}


public 
plugin_end() {
    
nvault_close(iVault);
}

#if AMXX_VERSION_NUM < 183
public client_disconnect(id) {
#else
public client_disconnected(id) {
#endif
    
SaveData(id);
}

public 
client_authorized(id) {
    
LoadData(id);
}

public 
SaveData(id) {
    new 
szAuth[35], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
formatex(szTempcharsmax(szTemp), "%i"iMoney[id]);

    
nvault_set(iVaultszAuthszTemp);
}

public 
LoadData(id) {
    new 
szAuth[35], szMoney[10], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
nvault_get(iVaultszAuthszTempcharsmax(szTemp));

    
parse(szTempszMoneycharsmax(szMoney));

    
iMoney[id] = str_to_num(szMoney);
}

public 
ShowBankMenu(id) {
    new 
szHeader[70];
    
formatex(szHeadercharsmax(szHeader), "\y[\rDFC] \yBank \wMenu ^n\yYou have \r %i$"iMoney[id]);

    new 
iBankMenu menu_create(szHeader"BankHandler");
    
    
menu_additem(iBankMenu"\wDeposit^n");
    
menu_additem(iBankMenu"\wWithdraw");
    
    
menu_display(idiBankMenu);
}

public 
BankHandler(idiBankMenuiItem) {
    if(
is_user_connected(id) && iItem != MENU_EXIT) {
        switch(
iItem) {
            case 
0client_cmd(id"messagemode DepositCashToBank");
            case 
1client_cmd(id"messagemode TakeCashFromBank");

        }
    }

    
menu_destroy(iBankMenu);
}

public 
WithdrawMessageModeHandler(id) {
    new 
szAmount[10], iAmountiCashiTotalCash;
    
read_argv(1szAmountcharsmax(szAmount));

    
iAmount str_to_num(szAmount);
    
iCash cs_get_user_money(id);
    
iTotalCash iAmount iCash;

    if(
iAmount <= iMoney[id]) {
        if(
iAmount MAXCASH) {
            if(!
get_pcvar_num(pExceedLimit)) {
                
iMoney[id] -= iAmount;
                
cs_set_user_money(idiTotalCash);
                
ColorChat(idGREEN,"^3[^4DFC^3]^1 You have withdrawn^4 %i$^1 from your bank account."iAmount);
            }

            else {
                
ColorChat(idGREEN"^3[^4DFC^3]^1 Max withdrawal amount is 16.000$");
            }
        }

        else {
            if(
iTotalCash <= MAXCASH) {
                
iMoney[id] -= iAmount;
                
cs_set_user_money(idiTotalCash);
                
ColorChat(idGREEN,"^3[^4DFC^3]^1 You have withdrawn^4 %i$^1 from your bank account."iAmount);
            }

            else {
                
ColorChat(idGREEN"^3[^4DFC^3]^1 Max cash limit exceeded.");
            }
        }

    }

    else {
        
ColorChat(idGREEN"^3[^4DFC^3]^1 You can't withdraw more than you currently have banked.");
    }

    
ColorChat(idGREEN"Test: szAmount = %i"iAmount);
}




public 
DepositMessageModeHandler(id) {
    new 
szAmount[10], iAmountiCash;
    
read_argv(1szAmountcharsmax(szAmount));

    
iAmount str_to_num(szAmount);
    
iCash cs_get_user_money(id);

    if(
iAmount 0) {
        if(
iAmount <= iCash) {
            
iMoney[id] += iAmount;
            
cs_set_user_money(idclamp(iCash iAmount0_));
            
ColorChat(idGREEN,"^3[^4DFC^3]^1 You deposited^4 %i$^1 in your bank account."iAmount);
        }

        else {
            
ColorChat(idGREEN"^3[^4DFC^3]^1 You don't have that much cash.");
        }
    }

    else {
        
ColorChat(idGREEN"^3[^4DFC^3]^1 Specify a minimum of 1$");
    }

__________________

Last edited by Napoleon_be; 05-02-2020 at 07:44.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Pizzadaking
Member
Join Date: Oct 2019
Old 05-02-2020 , 07:34   Re: bank from Napoleon be ( money ) help
Reply With Quote #4

Oh, thanks and sorry.
Pizzadaking is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:30.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode