mirror of
https://github.com/hypervortex/VH-Bombsquad-Modded-Server-Files
synced 2025-10-16 12:02:51 +00:00
Update CoinCmds.py
This commit is contained in:
parent
703955f333
commit
c94f86da32
1 changed files with 12 additions and 6 deletions
|
|
@ -255,12 +255,18 @@ def buy(arguments, clientid, accountid):
|
||||||
if havecoins >= costofeffect:
|
if havecoins >= costofeffect:
|
||||||
customers = pdata.get_custom()['paideffects']
|
customers = pdata.get_custom()['paideffects']
|
||||||
if accountid not in customers:
|
if accountid not in customers:
|
||||||
dayss = settings["Paideffects"]["timedelta"]
|
setdate = settings["Paideffects"]["timedelta"]
|
||||||
settime = settings["Paideffects"]["ExpriyPaideffectTime"]
|
settime = int(settings["Paideffects"]["ExpriyPaideffectTime"])
|
||||||
expiry = datetime.now() + timedelta(dayss=settime)
|
# Map unit string to timedelta attribute
|
||||||
customers[accountid] = {'effect': effect, 'expiry': expiry.strftime('%d-%m-%Y %H:%M:%S')}
|
unit_map = {'years': 'years', 'days': 'days', 'hours': 'hours', 'minutes': 'minutes', 'seconds': 'seconds'}
|
||||||
addcoins(accountid, costofeffect * -1)
|
if setdate in unit_map:
|
||||||
_ba.chatmessage(f"Success! That cost you {str(costofeffect)}{tic}")
|
setdate_attr = unit_map[setdate]
|
||||||
|
expiry = datetime.now() + timedelta(**{setdate_attr: settime})
|
||||||
|
customers[accountid] = {'effect': effect, 'expiry': expiry.strftime('%d-%m-%Y %H:%M:%S')}
|
||||||
|
addcoins(accountid, costofeffect * -1)
|
||||||
|
_ba.chatmessage(f"Success! That cost you {str(costofeffect)}{tic}")
|
||||||
|
else:
|
||||||
|
_ba.chatmessage("Invalid timedelta unit in settings.")
|
||||||
else:
|
else:
|
||||||
activeeffect = customers[accountid]['effect']
|
activeeffect = customers[accountid]['effect']
|
||||||
till = customers[accountid]['expiry']
|
till = customers[accountid]['expiry']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue