ID:1148604
 
(See the best response by Critical172.)
Code:
mob/NPC/Shopkeeper
icon = 'Shops.dmi'
icon_state = "Vegeta"
Click()
set src in oview(1)
switch(input("What would you like to buy today?","Stuff",text) in list ("ZSword","Nimbus","Cancel"))
if("ZSword")
if(src.Zenni < 10000)
src << "<b>You dont have enough!"
if(src.Zenni >= 10000)
src << "<b>You bought a ZSword!"
src.contents += new/obj/ZSword(src)
src.Zenni -= 10000
if("Nimbus")
if(src.Zenni < 1000)
src << "<b>You dont have enough!"
if(src.Zenni >= 1000)
src << "You bought a Nimbus!"
src.contents += new/obj/Nimbus(src)
src.Zenni -= 1000






obj
var
price = 0
icon = 'Shops.dmi'
ZSword
icon_state = "ZSword"
Nimbus
icon_state = "Nimbus"
density = 0


Problem description:

Best response
The problem is that when you use src it is defined as the Shopkeeper, you should use usr to define it as the person who clicks on the Shopkeeper.
mob/NPC/Shopkeeper
icon = 'Shops.dmi'
icon_state = "Vegeta"
Click()
set src in oview(1)
switch(input("What would you like to buy today?","Stuff",text) in list ("ZSword","Nimbus","Cancel"))
if("ZSword")
if(usr.Zenni < 10000)
usr << "<b>You dont have enough!"
if(usr.Zenni >= 10000)
usr << "<b>You bought a ZSword!"
usr.contents += new/obj/ZSword
usr.Zenni -= 10000
if("Nimbus")
if(usr.Zenni < 1000)
usr << "<b>You dont have enough!"
if(usr.Zenni >= 1000)
usr << "You bought a Nimbus!"
usr.contents += new/obj/Nimbus
usr.Zenni -= 1000
awe i tried it and it worked tyvm