Raised This Month: $7 Target: $400
 1% 

Bank System Nvault/SQL Support


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-05-2020 , 13:50   Bank System Nvault/SQL Support
Reply With Quote #1

Bank System 2.0
Release: September, 05, 2020 | Last Update: April, 15, 2022

Table of Contents

Description top

The plugin adds save players money in the form of the bank.

1.Bank System features:
  • Deposit (Save Cash).
  • Deposit All (Save All Cash).
  • Withdraw (Take Cash).
  • Withdraw All (Take All Cash).
  • Bank balance (Check how much cash you have in your bank).
  • Donate Cash (Transforming cashs).
  • Reset Bank (Opens a menu that shows online players for reset bank).
Images top
Spoiler


Installation top

To install the plugin:
  1. Download the zip file..
  2. Put BankSystem.ini in cstrike/addons/amxmodx/confings
  3. Open addons/amxmodx/configs/plugins.ini and add at the end of this file BankSystem.amxx
  4. Restart the server/change map.

To compile locally:

Credits top
Using this plugin with other currencies top

The plugin also has the option to use native plugins in place of money. In simple words - you can make this plugin work with Ammo Packs, BaseBuilder Credits, JBPacks and more. To do this, you need to edit the following lines (11/12):
Spoiler


ChangeLog top
  • V 1.0 ( September, 05,2020 ):
    • Initial release.
  • V 1.1 ( September, 09,2020 ):
    • Fixed some codes.
    • Added bank system.
    • Added doante money from bank to bank.
  • V 1.2 ( September, 10,2020 ):
    • Added time presents.
  • V 1.3 ( September, 10,2020 ):
    • Edited Codes to use native plugins in place of money, You can make this plugin work with Ammo Packs, BaseBuilder Credits, JBPacks and Other's.
  • V 1.4 ( September, 14,2020 ):
    • Fixed Some codes.
    • Added Lang file.
    • Added CFG file.
    • Transformed define's to cvar's
  • V 1.5 ( September, 16,2020 ):
    • Edited Some codes.
  • V 1.6 ( October, 10,2020 ):
    • Code cleaned.
    • New cvar's for enable/disable options.
    • Used CromChat.
  • V 1.7 ( August, 8, 2021 ):
    • Plugin Remaded.
    • Code Optimized.
    • Add SQL support.
    • Add ini file.
    • Removed GIVE/TAKE/TIMEPRESENT became as bank.
    • Added Natives get_user_bank_cash.
    • Added Natives set_user_bank_cash.
  • V 1.8 ( February, 08, 2022 ):
    • Code Optimized.
    • Natives has been edited to get_user_bank & set_user_bank.
  • V 1.9 ( February, 11, 2022 ):
    • Added an option to to select MySql or Sqlite.
    • Added an option to name nvault.
  • V 2.0 ( April, 15, 2022 ):
    • Added option to save SQL date using IP, name.
Downloads top
  • Need to download CromChat file to compile this plugin.
Attached Files
File Type: ini BankSystem.ini (961 Bytes, 254 views)
File Type: sma Get Plugin or Get Source (Bank.sma - 483 views - 17.4 KB)

Last edited by Supremache; 04-15-2022 at 14:59. Reason: Edited New Updates v2.0
Supremache is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 09-05-2020 , 14:29   Re: Money System [Donate | Give | Take]
Reply With Quote #2

Thanks, works great
HowToRuski is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-05-2020 , 14:41   Re: Money System [Donate | Give | Take]
Reply With Quote #3

Quote:
Originally Posted by HowToRuski View Post
Thanks, works great
Enjoy, I will try to add bank system to this plugin when i do new updates
Supremache is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 09-05-2020 , 16:09   Re: Money System [Donate | Give | Take]
Reply With Quote #4

Some optimization:
1.
Code:
client_print(id, print_console
-->>
console_print()
Code:
sizeof() -1 ???
->>
charsmax()
Code:
format(filename, sizeof(filename) - 1, "%s/MoneySystem_%s.log", dir, filename); -->> static log_file[64]; formatex(log_file, charsmax(log_file), "%s/MoneySystem_%s.log", dir, filename); /* Much faster than what format() can do */ log_to_file(log_file, "%s", message);

stock ChatColor /* ???? client_print_color() */

And you can get the name of player in a global var ( or a hash map ). When he's connecting you retrive his name and use it instead of this:
Code:
get_user_name( id, ... )
get_user_name( iTarget, ... )
Same thing with the steamid
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 09-05-2020 at 16:09.
Shadows Adi is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-05-2020 , 16:53   Re: Money System [Donate | Give | Take]
Reply With Quote #5

Quote:
Originally Posted by Shadows Adi View Post
Some optimization:
1.
Code:
client_print(id, print_console
-->>
console_print()
Code:
sizeof() -1 ???
->>
charsmax()
Code:
format(filename, sizeof(filename) - 1, "%s/MoneySystem_%s.log", dir, filename); -->> static log_file[64]; formatex(log_file, charsmax(log_file), "%s/MoneySystem_%s.log", dir, filename); /* Much faster than what format() can do */ log_to_file(log_file, "%s", message);

stock ChatColor /* ???? client_print_color() */

And you can get the name of player in a global var ( or a hash map ). When he's connecting you retrive his name and use it instead of this:
Code:
get_user_name( id, ... )
get_user_name( iTarget, ... )
Same thing with the steamid
Thx i understand you, But client_print_color() working only for amxmodx 1.8.3 so i can't use it because i want my plugin working on all versions and thanks and again i will edit all that when i add new updates

Last edited by Supremache; 09-05-2020 at 17:11.
Supremache is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-06-2020 , 21:10   Re: Money System [Donate | Give | Take]
Reply With Quote #6

Quote:
Originally Posted by Supremache View Post
Thx i understand you, But client_print_color() working only for amxmodx 1.8.3 so i can't use it because i want my plugin working on all versions and thanks and again i will edit all that when i add new updates
He never mentioned client_print_color
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-07-2020 , 08:06   Re: Money System [Donate | Give | Take]
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
He never mentioned client_print_color
Check it again, i think he mean, why i used stock chatcolor and there's client_print_color for amxmodx

Quote:
stock ChatColor /* ???? client_print_color() */
Supremache is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 09-08-2020 , 10:57   Re: Money System [Donate | Give | Take]
Reply With Quote #8

Using amx 1.9> you can do something like:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
#define PLUGIN "Money Donate"
#define VERSION "1.0"
#define AUTOR "iceeedR"

new const Prefix[] = "Allied Donators"
new DonateTarget[MAX_PLAYERS +1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTOR);
    
register_clcmd("say /donate""DonateCmd")
    
register_clcmd("plugin_donate""DonateHandler")
}
 
public 
client_disconnected(id)
{
    
DonateTarget[id] = -// just for secure
}

public 
client_putinserver(id)
{
    
DonateTarget[id] = -// just for secure
}

public 
DonateCmd(id)
{
    new 
iMenu menu_create(fmt("\y[\w%s\d - \rDonate Menu \y ]"Prefix), "donate_handler")

    new 
iPlayers[MAX_PLAYERS], iNum
    get_players_ex
(iPlayersiNumGetPlayers_MatchTeam, (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" "CT")
    for(new 
iszTempid[10], iPlayer;iNum;i++)
    {
        
iPlayer iPlayers[i]

        if(
iPlayer != id)
        {
            
num_to_str(iPlayerszTempidcharsmax(szTempid))

            
menu_additem(iMenufmt("%n"iPlayer), szTempid)
        }
    }
    
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
donate_handler(idiMenuiItem)
{
    if(
iItem == MENU_EXIT)
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
    new 
iData[6], szItemName[MAX_PLAYERS 2], iAccessiCallback
    menu_item_getinfo
(iMenuiItemiAccessiDatacharsmax(iData), szItemNamecharsmax(szItemName), iCallback)
    
    
DonateTarget[id] = str_to_num(iData)
    
    if(!
DonateTarget[id])
    {
        
client_print_color(idprint_team_default"%s This player does not exist."Prefix)
        
menu_display(idiMenu)
        
DonateTarget[id] = -1
        
return PLUGIN_HANDLED
    
}
    
    
client_cmd(id"messagemode plugin_donate")
            
    
client_print_color(idprint_team_default"%s Type how much you want to give."Prefix)
    return 
PLUGIN_HANDLED
}

public 
DonateHandler(id)
{
    new 
iValue read_argv_int(1)
        
    new 
iPlayerMoney cs_get_user_money(id)
    
    if( 
iPlayerMoney iValue || iValue <= 0)
    {
        
client_print_color(idprint_team_default"%s You do not have enough money or invalid value."Prefix)
        return 
PLUGIN_CONTINUE
    
}
    
    
cs_set_user_moneyDonateTarget[id], cs_get_user_money(DonateTarget[id]) + iValue)
    
cs_set_user_moneyidcs_get_user_money(id) - iValue)
    
    new 
iPlayers[MAX_PLAYERS], iNum
    get_players_ex
(iPlayersiNumGetPlayers_MatchTeam, (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" "CT")
    for(new 
i;iNum;i++)
    {
        
client_print_color(iPlayers[i], print_team_default"%s^x04 %n^x01 donated^x04 $%i^x01 for^x04 %n."PrefixidiValueDonateTarget[id])
    }
    
client_cmd(DonateTarget[id], "spk ^"items/9mmclip1.wav^"")
    
    
DonateTarget[id] = -1
    
return PLUGIN_HANDLED

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-08-2020 , 16:23   Re: Money System [Donate | Give | Take]
Reply With Quote #9

Quote:
Originally Posted by iceeedr View Post
Using amx 1.9> you can do something like:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
#define PLUGIN "Money Donate"
#define VERSION "1.0"
#define AUTOR "iceeedR"

new const Prefix[] = "Allied Donators"
new DonateTarget[MAX_PLAYERS +1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTOR);
    
register_clcmd("say /donate""DonateCmd")
    
register_clcmd("plugin_donate""DonateHandler")
}
 
public 
client_disconnected(id)
{
    
DonateTarget[id] = -// just for secure
}

public 
client_putinserver(id)
{
    
DonateTarget[id] = -// just for secure
}

public 
DonateCmd(id)
{
    new 
iMenu menu_create(fmt("\y[\w%s\d - \rDonate Menu \y ]"Prefix), "donate_handler")

    new 
iPlayers[MAX_PLAYERS], iNum
    get_players_ex
(iPlayersiNumGetPlayers_MatchTeam, (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" "CT")
    for(new 
iszTempid[10], iPlayer;iNum;i++)
    {
        
iPlayer iPlayers[i]

        if(
iPlayer != id)
        {
            
num_to_str(iPlayerszTempidcharsmax(szTempid))

            
menu_additem(iMenufmt("%n"iPlayer), szTempid)
        }
    }
    
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
donate_handler(idiMenuiItem)
{
    if(
iItem == MENU_EXIT)
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
    new 
iData[6], szItemName[MAX_PLAYERS 2], iAccessiCallback
    menu_item_getinfo
(iMenuiItemiAccessiDatacharsmax(iData), szItemNamecharsmax(szItemName), iCallback)
    
    
DonateTarget[id] = str_to_num(iData)
    
    if(!
DonateTarget[id])
    {
        
client_print_color(idprint_team_default"%s This player does not exist."Prefix)
        
menu_display(idiMenu)
        
DonateTarget[id] = -1
        
return PLUGIN_HANDLED
    
}
    
    
client_cmd(id"messagemode plugin_donate")
            
    
client_print_color(idprint_team_default"%s Type how much you want to give."Prefix)
    return 
PLUGIN_HANDLED
}

public 
DonateHandler(id)
{
    new 
iValue read_argv_int(1)
        
    new 
iPlayerMoney cs_get_user_money(id)
    
    if( 
iPlayerMoney iValue || iValue <= 0)
    {
        
client_print_color(idprint_team_default"%s You do not have enough money or invalid value."Prefix)
        return 
PLUGIN_CONTINUE
    
}
    
    
cs_set_user_moneyDonateTarget[id], cs_get_user_money(DonateTarget[id]) + iValue)
    
cs_set_user_moneyidcs_get_user_money(id) - iValue)
    
    new 
iPlayers[MAX_PLAYERS], iNum
    get_players_ex
(iPlayersiNumGetPlayers_MatchTeam, (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" "CT")
    for(new 
i;iNum;i++)
    {
        
client_print_color(iPlayers[i], print_team_default"%s^x04 %n^x01 donated^x04 $%i^x01 for^x04 %n."PrefixidiValueDonateTarget[id])
    }
    
client_cmd(DonateTarget[id], "spk ^"items/9mmclip1.wav^"")
    
    
DonateTarget[id] = -1
    
return PLUGIN_HANDLED

I can do the same but with amxmodx 1.8.x , i want my plugin working on any versions

Last edited by Supremache; 09-08-2020 at 16:43.
Supremache is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 09-08-2020 , 17:54   Re: Money System [Donate | Give | Take]
Reply With Quote #10

Quote:
Originally Posted by Supremache View Post
I can do the same but with amxmodx 1.8.x , i want my plugin working on any versions
At no time did I say otherwise, I just left a version for amx 1.9 in case anyone wants to, if you want I delete it.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
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 23:50.


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