View Single Post
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-30-2020 , 17:52   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #9

This is how far i got today, be aware, this is just a 2 hour work you're looking at, it won't work yet. Just to show you i'm working on it.

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

#pragma semicolon 1

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

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");

      
pExceedLimit =     register_cvar("bank_limit""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) {

}

public 
LoadData(id) {

}

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

    new 
iBankMenu menu_create(szHeader"BankHandler");

    
menu_additem(iBankMenu"\wWithdraw");
    
menu_additem(iBankMenu"\wWithdraw All^n");

    
menu_additem(iBankMenu"\wDeposit");
    
menu_additem(iBankMenu"\wDeposit All^n");

    
menu_additem(iBankMenu"\yManage Your Account^n^n");

    
menu_additem(iBankMenu"\rDonate Cash^n");

    
menu_display(idiBankMenu);
}

public 
BankHandler(idiBankMenuiItem) {
    if(
is_user_connected(id) && iItem != MENU_EXIT) {
        switch(
iItem) {
            case 
0client_cmd(id"TakeCashFromBank");
            case 
1WithdrawAllCash(id);
            case 
2DepositCash(id);
            case 
3DepositAllCash(id);
            case 
4client_cmd(id"say /register");
            case 
5DonateCash(id);
        }
    }

    
menu_destroy(iBankMenu);
}

public 
WithdrawMessageModeHandler(id) {
    new 
szAmount[9], iAmount// Max would be 9 999 999 999
    
read_argv(0szAmountcharsmax(szAmount));

    
iAmount str_to_num(szAmount);

    if(
iAmount 16000) {
        if(
pExceedLimit) {
            
// +16K$ possible.
        
}

        else {
            
// Not possible.
        
}
    }

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

public 
WithdrawAllCash(id) {
    if(
iMoney[id] > 16000) {
        if(
pExceedLimit) {
            
// Allowed.
        
}

        else {
            
// Not Allowed.
        
}
    }
}

public 
DepositCash(id) {

}

public 
DepositAllCash(id) {

}

public 
DonateCash(id) {


__________________

Last edited by Napoleon_be; 04-30-2020 at 18:46.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be