ID:266886
 


I have created a shop, gold peaces for your inventory that are worth something, a bank for the money and more, i just cant figure out how to make people buy and sell things at a store. So far i have it so that when you talk to a bartender, he'll say wana buy a beer only 50 gp, if u say yes u get a beer and 50 gp is deleted from your inventory, and if you say no he leaves u alone. The problem i have is that after the user gets to 0 gold peaces, he goes into the negatives! Please if you can help me at all i would deeply appretiate it!

just have something like this


turf
Bartender
icon = 'bartender.dmi'
density =1
verb
Buy_A_Beer()
set src in oview(1)
switch(input("Do you want a beer?", "Bartender",text) in list ("Yes","No"))
if("Yes")
if(usr.gold <= 9)
alert("You need 10 gold.)
return
if(usr.gold >=10)
usr.gold -=10
usr.contents += new/obj/beer
alert("You buy a beer.")
if("No")
alert("Then go play DBZeta...")




that's how.
p.s. i prefer to make all people in the world turfs, so you cant attack them, it makes things easier
Just to let you know, this thread was moved from Code Problems because you're not asking for help debugging your code, but asking for someone else to provide code.
check out the statpanel shopkeeper demo at BYOND Code Client .


-ST

PS - Yes, I am praticing my HTML skills. Hehe