Raised This Month: $32 Target: $400
 8% 

[Request] Change Ammo Bank To Money Bank


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-29-2020 , 07:12   [Request] Change Ammo Bank To Money Bank
Reply With Quote #1

Hello Guys...
I have many plugins for Money Bank but there is no new design so I got a new design, it Made for ammo Bank, i tried to edit it but i got 3 hours trying but i didn't that , everytime i got some problems so can some one help me for this ?

PHP Code:
#include <amxmodx>   
#include <amxmisc>   
#include <cstrike>   
#include <hamsandwich>   
#include <basebuilder>   
#include <fun>   
#include < ColorChat > 
#include < fvault >    

#pragma dynamic 32768    
#define is_valid_player(%1) (1 <= %1 <= 32)    

///////#define STEAM     
#define NICK     
///////#define IP     

new g_AP[33]   
new 
g_DonateID[33]  

native bb_get_user_ammo_packs(id)
native bb_set_user_ammo_packs(idamount

public 
plugin_init()   
{   
    
register_plugin("Bank Menu","2.1","Fixed By PlayBoy")   

    
register_clcmd("takeAmount""cmdTakeAmount")   
    
register_clcmd("saveAmount""cmdSaveAmount")   
    
register_clcmd("donate","menuDonate")  
    
register_clcmd("say donate""menuDonate")   
    
register_clcmd("say /donate""menuDonate")   

       
    
register_clcmd("say /bank""PlayBoyBank")   
    
register_clcmd("say bank""PlayBoyBank")   
    
register_clcmd("say_team /bank""PlayBoyBank")   
       
}   

public 
PlayBoyBank(id)   
{       
    if(
is_valid_player(id))   
    {   
        new 
title[100]   
        
formatex(title99"\yBank Menu \r[Protected] ^n \yYou have %i Ammo packs"g_AP[id])   
           
           
        new 
bankMenu menu_create(title"menuBankHandler")   
           
        
menu_additem(bankMenu"\wWithdraw""1")   
        
menu_additem(bankMenu"\wWithdraw All^n""2")   
           
        
menu_additem(bankMenu"\wDeposit""3")   
        
menu_additem(bankMenu"\wDeposit All^n""4")   
           
        
menu_additem(bankMenu"\yManage Your Account^n^n""5")

        
menu_additem(bankMenu"\rTransfer Ammo Packs^n""6")   
      
        
menu_display(idbankMenu0)   
    }   
    return 
PLUGIN_HANDLED;   
}   

public 
menuBankHandler(idmenuitem)   
{           
    new 
data[6], iName[64], accesscallback   
    menu_item_getinfo
(menuitemaccessdata5iName63callback)   
       
    new 
key str_to_num(data)   
       
    switch(
key)   
    {   
        case 
1:   
        {   
            
client_cmd(id"messagemode takeAmount")   
        }   
        case 
2:   
        {   
            
cmdTakeAll(id)   
        }   
        case 
3:   
        {   
            
client_cmd(id"messagemode saveAmount")   
        }   
        case 
4:   
        {   
            
cmdSaveAll(id)   
        }   
        case 
5:   
        {   
            
client_cmd (id"say /register")
        }
        case 
6:
        {
            
menuDonate(id)
        }   
    }   
}   

public 
cmdTakeAmount(id)   
{   
    new 
szAps[11]   
    
read_args(szAps10)   
    
remove_quotes(szAps)   
       
    if(
equal(szAps"") || equal(szAps" "))   
        return 
PLUGIN_HANDLED   
       
    
new iAps str_to_num(szAps)   
       
    if(
iAps 1) return PLUGIN_HANDLED   
       
    
new iApsSum iAps bb_get_user_ammo_packs(id)   
       
    if(
iAps <= g_AP[id] && iApsSum <= 999)   
    {   
        
bb_set_user_ammo_packs(idiApsSum)   
        
g_AP[id] -= iAps   
           
        ColorChat
(0RED"^3[G#D] ^1You Took ^3%i ^1Ammopacks From Your Bank. Now You Have ^3%i ^1Ammopacks In Your Bank."iApsg_AP[id])   
           
        return 
PLUGIN_CONTINUE   
    
}   
    else   
    {   
        
ColorChat(0RED"^3[G#D] ^1You Dont Have Enough Ammopacks Or You Wanted To Take Too Much Ammopacks.")   
    }   
       
    return 
PLUGIN_CONTINUE   
}   

public 
cmdTakeAll(id)   
{   
    new 
iApsSum bb_get_user_ammo_packs(id) + g_AP[id]   
       
    if(
iApsSum <= 999)   
    {   
        
bb_set_user_ammo_packs(idiApsSum)   
           
        
ColorChat(0RED"^3[G#D] ^1You Took All ^3%i ^1Ammopacks From Your Bank."g_AP[id])   
           
        
g_AP[id] = 0   
    
}   
    else if(
iApsSum 999)   
    {   
        new 
giveAps 999 bb_get_user_ammo_packs(id)   
           
        if(
giveAps <= g_AP[id])   
        {   
            
bb_set_user_ammo_packs(idgiveAps bb_get_user_ammo_packs(id))   
            
g_AP[id] -= giveAps   
               
            ColorChat
(0RED"^3[G#D] ^1You Took ^3%i ^1Ammopacks From Your Bank. Now You Have %i Ammopacks In Your Bank."giveApsg_AP[id])   
        }   
    }   
}   

public 
cmdSaveAmount(id)   
{   
    new 
szAps[11]   
    
read_args(szAps10)   
    
remove_quotes(szAps)   
       
    if(
equal(szAps"") || equal(szAps" "))   
        return 
PLUGIN_HANDLED   
       
    
new iAps str_to_num(szAps)   
       
    if(
iAps 1) return PLUGIN_HANDLED   
       
    
new haveAps bb_get_user_ammo_packs(id)   
       
    if(
iAps <= haveAps)   
    {   
        
bb_set_user_ammo_packs(idhaveAps iAps)   
        
g_AP[id] += iAps   
           
        ColorChat
(0RED"^3[G#D] ^1You Saved ^3%i Ammopacks In Your Bank. Now You Have ^3%i ^1Ammopacks In Your Bank."iApsg_AP[id])   
    }   
    else   
    {   
        
ColorChat(0RED"^3[G#D] ^1You Dont Have Enough Ammopacks")   
    }   
       
    return 
PLUGIN_CONTINUE   
}   

public 
cmdSaveAll(id)   
{   
    new 
haveAps bb_get_user_ammo_packs(id)   
       
    
bb_set_user_ammo_packs(id0)   
    
g_AP[id] += haveAps   
       
    ColorChat
(0RED"^3[G#D] ^1You Saved ^3%i ^1Ammopacks To Your Bank. Now You Have ^3%i ^1Ammopacks In Your Bank."haveApsg_AP[id])   
}   

public 
menuDonate(id)   
{   
    new 
DonateMenu menu_create("\r[G#D] \wChoose A Player To Donate:""menuDonateHandler")   
       
    new 
players[32], pnumtempid   
       
    
new szName[32], szTempid[10]   
       
    
get_players(playerspnum)   
       
    for( new 
ii<pnumi++ )   
    {   
        
tempid players[i]   
           
        if(
id != tempid)   
        {   
            
get_user_name(tempidszName31)   
            
num_to_str(tempidszTempid9)   
               
            
menu_additem(DonateMenuszNameszTempid0)   
        }   
    }   
       
    
menu_display(idDonateMenu0)   
}   

public 
menuDonateHandler(idmenuitem)   
{       
    new 
data[6], iName[64];   
    new 
accesscallback;   
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);   
       
    new 
tempid str_to_num(data);   
       
    
g_DonateID[id] = tempid   
       
    client_cmd
(id"messagemode donate")   
       
    
menu_destroy(menu);   
    return 
PLUGIN_HANDLED;   
}   

public 
cmdDonate(id)   
{   
    if(
g_DonateID[id] == 0) return PLUGIN_HANDLED   
       
    
new szAps[11]   
    
read_args(szAps10)   
    
remove_quotes(szAps)   

       
    new 
iAps str_to_num(szAps)   
       
    if(
iAps 1) return PLUGIN_HANDLED   
       
    
if(iAps <= g_AP[id])   
    {   
        
// Take iAps away   
        
g_AP[id] -= iAps   
           
        
new NameDonate[45]   
        
get_user_name(g_DonateID[id], NameDonate44)   
        new 
Name[45]   
        
get_user_name(g_DonateID[id], Name44)   
           
        
ColorChat(0RED"^3[G#D] ^1You Donated ^3%i ^1Ammopacks To ^3%s^1. Now You Have %i ammopacks In Your Bank."iApsNameDonateg_AP[id])   
           
        
// give iAps to Donateid   
        
g_AP[g_DonateID[id]] += iAps   
        ColorChat
(g_DonateID[id], RED"^3[G#D] ^3%s ^1Donated ^3%i ^1Ammopacks To You. Now You Have ^3%i ^1Ammopacks In Your Bank."NameiApsg_AP[g_DonateID[id]])   
    }   
    else   
    {   
        
ColorChat(0RED"^3[G#D] ^1You Dont Have Enough Ammopacks")   
    }   
       
    return 
PLUGIN_CONTINUE   
}   

public 
SaveData(id)     
{     
    new 
szMethod65 ];    
        
    
#if defined STEAM    
    
get_user_authididszMethod34 );    
    
#endif    
        
    #if defined NICK    
    
get_user_nameidszMethod34 );    
    
#endif    
        
    #if defined IP    
    
get_user_ipidszMethod34);    
    
#endif    
        
    
new vaultkey[64], vaultdata[328];     
    
format(vaultkey63"bb_%s"szMethod);     
    
format(vaultdata327"%i"g_AP[id]);     
        
    
fvault_set_data"bbVault"vaultkeyvaultdata );    
}     

// Load data function     
public LoadData(id)     
{     
    new 
szMethod65 ];    
        
    
#if defined STEAM    
    
get_user_authididszMethod34 );    
    
#endif    
        
    #if defined NICK    
    
get_user_nameidszMethod34 );    
    
#endif    
        
    #if defined IP    
    
get_user_ipidszMethod34);    
    
#endif    
        
    
new vaultkey[64], vaultdata[328];     
    
format(vaultkey63"bb_%s"szMethod);     
    
format(vaultdata327"%i"g_AP[id]);     
        
    
fvault_get_data"bbVault"vaultkeyvaultdatacharsmaxvaultdata ) );    
        
    
g_APid ] = str_to_numvaultdata );    
}     
// When client enter on server     
public client_putinserver(id)     
{     
    
LoadData(id);     
}     

// When client disconnect     
public client_disconnect(id)     
{     
    
SaveData(id);     

Supremache is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-29-2020 , 13:13   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #2

I could give this a little remake, what exactly are you trying to do and what isn't working?

EDIT: can u please give me the bb_(get)(set)_user_ammo_packs() natives.
__________________

Last edited by Napoleon_be; 04-29-2020 at 13:57.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-29-2020 , 21:02   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
I could give this a little remake, what exactly are you trying to do and what isn't working?

EDIT: can u please give me the bb_(get)(set)_user_ammo_packs() natives.
I want change it to money bank not ammo bank so change code like from bb_get_user_ammo_packs to cs_get_user_money and change what is needed
And remove in #include <basebuilder> , because you dont need it after change bb_(get)(set)_user_ammo_packs() codes, and i uploaded basebuilder.inc if you want to check something

Ps: This Bank Have new desgin, it have regester bank system, donate money, save all moneys, get all moneys,
Attached Files
File Type: inc basebuilder.inc (9.4 KB, 31 views)
Supremache is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 04-30-2020 , 02:37   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #4

Make the following changes

PHP Code:
native bb_get_user_ammo_packs(id)               =  Remove
native bb_set_user_ammo_packs
(idamount)       =  Remove

bb_get_user_ammo_packs
(id)   Change To      cs_get_user_money(id)
bb_set_user_ammo_packs(id)   Change To      cs_set_user_money(id

Last edited by alferd; 04-30-2020 at 02:38.
alferd is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-30-2020 , 05:07   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #5

Quote:
Originally Posted by alferd View Post
Make the following changes

PHP Code:
native bb_get_user_ammo_packs(id)               =  Remove
native bb_set_user_ammo_packs
(idamount)       =  Remove

bb_get_user_ammo_packs
(id)   Change To      cs_get_user_money(id)
bb_set_user_ammo_packs(id)   Change To      cs_set_user_money(id
I tried to do it but i had got some problems
Supremache is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 04-30-2020 , 05:27   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #6

Quote:
Originally Posted by Supremache View Post
I tried to do it but i had got some problems
What problem?
alferd is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-30-2020 , 06:29   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #7

I'll get back to this when i get home from work, in like 10 hours.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-30-2020 , 14:45   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #8

Quote:
Originally Posted by alferd View Post
What problem?
Bro I didn't remvoe them i just edit codes like this
From
PHP Code:
native bb_get_user_ammo_packs(id)               =  Remove
native bb_set_user_ammo_packs
(idamount)       =  Remove 
PHP Code:
native cs_get_user_money(id
native cs_set_user_money(idamount
Because there's something like requester system in this plugin but it do register account for bank so i think should use native save data

Quote:
Originally Posted by Napoleon_be View Post
I'll get back to this when i get home from work, in like 10 hours.
Okey Bro <3
Supremache is offline
Old 04-30-2020, 14:59
Supremache
This message has been deleted by Supremache.
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
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-30-2020 , 18:23   Re: [Request] Change Ammo Bank To Money Bank
Reply With Quote #10

Quote:
Originally Posted by Napoleon_be View Post
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[10], 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) {


Not worked...
When i type /bank i only see menu but when i press on any choose,
didn't happening anything..
Ps: Thanks Alot for your time
Supremache 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 03:36.


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