mob/ShopKeepers/verb/Sell()
set category = "ShopKeeper"
set src = oview(1)
pay = 0
maxamount = 0
amountto = 0
var/ite = input("Select the item you wish to sell","Select") in usr.contents
var/it = ite:type
for(var/obj/O as obj in view(-1))
if(istype(O,it))
maxamount += 1
var/amount = input("How many [it] do you want(Max is [maxamount])") as num
if(amount > maxamount)
usr << "You dont have that many"
return
for(var/obj/P as obj in view(-1))
if(istype(P,it))
if(amountto >= amount)
usr.gold += pay
return
else
pay += P.cost
del(P)
amountto += 1
else
if(amountto >= amount)
usr.gold += pay
return
mob/ShopKeepers
var
pay = 0
maxamount = 0
amountto = 0
Ok now it always deletes the items though if I want to sell all of the same object it deletes them all and doesnt give me any gold. Could someone please help me!
(Please I know Ive put a : in there but please dont mention it as it gets annoying after a while)
~~> Dragon Lord