ID:262491
 
Code:
proc/SellItems(var/obj/Items/O in usr)//the Sell verb, it lets you pick an object from your inv
var/list/L[1]//L is a list with the value of 1
var/C = 1
for(var/obj/M in usr.contents)//loop through all the things in your inventory
//if found
L[C] = M//the list L has the value of c and the mob is being added
C++//make room for another mob if more than one mobs in world
L.len++
var/M = (input("What to sell?")as null|anything in L)//makes it so if theres one mob, it doesnt automaticly choose the mob wich is its defualt operation
usr<<"You sold [M] for Gil"//usr.Gil += O.sellcost // for [O.sellcost]
del(M)


Problem description:
My Problem with this is that, it doesnt give the usr its gil that it soley diserves, instead it gives me a run time error, if i change it to M.sellcost, it claims that it does not exist...any idea's out there?

Try replacing usr with src.
Gah, I came up with a response to this, but, meh, it all got deleted.
So, I'll just post this:
proc/sellitem(m)
var/obj/i=input(m,"What would you like to sell?")as null|anything in m
if(!i)return
var/t=input("Are you sure you'd like to sell [o] for [round(i.price/2)]?")in list("Yes","No")
if(t!="Yes")return
m.gil+=round(i.price/2)
del(i)

That's assuming that the sellprice will be the original price divided by 2.