ID:175075
 
hi everyone for some reason my bank code lets me with draw as much money as i want. could anyone helpp me out?


heres my code:
mob
var/list/contents2
New()
..()
contents2=list()
Stat()
if(locate(/mob/Bank) in oview(3))
statpanel("Bank")
stat("Money in bank:",usr.bank_wealth)
stat("Deposit Box:"," ")
stat(contents2)
..()
Bank
icon='shopkeeper_m1.dmi'
verb
Deposit_item()
set category="Bank"
set src in oview(3)
var/O=input(usr,"What do you want to Deposit?","Choose:") in usr.contents+"Nevermind"
if(O=="Nevermind")
usr <<"Ok"
return
else
usr.contents2+=O
usr.contents-=O
usr << "You Deposit [O]"
Deposit_item()
Withdraw_item()
var/O=input(usr,"What do you want to Withdraw?","Choose:") in usr.contents2+"Nevermind"
set src in oview(3)
set category="Bank"
if(O=="Nevermind")
usr <<"Ok"
return
else
usr.contents+=O
usr.contents2-=O
usr << "You withdraw [O]"
Withdraw_item()
Gold_Deposit(mob/A as num)
set src in oview(3)
set category="Bank"
if(A<=usr.Gold && A>=0)
usr.bank_wealth+=A
usr.Gold-=A
usr << "You deposit [A] Gold"
else usr << "You dont have that much to deposit!"
Gold_Withdraw(mob/A as num)
set src in oview(3)
set category="Bank"
if(A>=usr.bank_wealth && A>=0)
usr.bank_wealth-=A
usr.Gold+=A
usr <<"You withdraw [A] Gold"
else usr <<"You dont have that much to withdraw!"
Thank you for posting all that unnecessary code for me to look at.

In answer to your problem, look at this line of code:

<code>if(A>=usr.bank_wealth && A>=0)</code>

Now if(A >= usr.bank_wealth), whats that asking? If the value you're trying to withdraw is greater than or equal to the amount of money you have in the bank, withdraw it. That > should be a <.

Simple as that.
In response to Foomer
Too much code is often better than too little code. Unless there's 3+ pages of it and none of the tags are closed so the code ends up looking bold, italic, red, and in 36-point font... =S
In response to Crispy
well, i guess i found a error in one of the demos = )
In response to Nave
umm.. yea... oops... Tis fixed now :)
In response to Nick231
LMAO was that your demo?
In response to Nave
Well, if it wasnt.. someone made an all-too close duplicate.....