ID:266458
 
Theres something wrong with it probably all the ifs but what can i replace them with or if thats not the problem what is it?

mob
verb/Give_Gold(mob/M as mob in oview(7), msg as num)
set category = "Commands"
if(usr.Gold >= 0)
usr.Gold -= msg
M.Gold += msg
usr << "You give [M] [msg] gold"
M << "[usr] gives you [msg] gold"
if(usr.Gold >= msg)
usr << "You dont have that much gold!"
if(msg <= usr.Gold)
usr << "Umm Don't cheat OK?"
M << "Tried to use you to cheat!"

If you are going to place your code between HTML tags, may I suggest:

<dm> code goes here </dm>

This will make your code soooo much easier to read.

~X
Try this:
mob/verb/Give_Gold(mob/M in oview(7))
if(!M)
src << "Give Gold to who?"
return
var/Gold = input("Give how much?","Give") as num
if(Gold <= 0) //make sure no negative money
src << "Enter a amount that is vailed!"
return
if(Gold <= src.Gold) //make sure player has enough Gold to give.
src.Gold -= Gold
M.Gold += Gold
M << "[src] gave you [Gold]!"
src << "You gave [M] [Gold]!"
else
usr<<"You don't have that much Gold!"


-Kappa the Imp

Thanks
In response to Kappa the Imp
Instead of <= it should be < because then you wouldn't be able to give anything.
for some reason the else part doesnt work
----------------------------------------
mob
verb/Give_Gold(mob/M in oview(7))
if(!M)
src << "Give Gold to who?"
return
var/Gold = input("Give how much?","Give") as num
if(Gold <= 0) //make sure no negative money
src << "Thief!"
world << "<font color=purple>(World) [src] tried to steal gold from [M]"
return
if(Gold <= src.Gold) //make sure player has enough Gold to give.
src.Gold -= Gold
M.Gold += Gold
M << "[src] gave you [Gold]!"
src << "You gave [M] [Gold]!"
<i>else
src << "You don't have that much Gold!"</i>


any help please?
In response to Thief Jack
mob/verb/Give_gold(mob/M as mob in world)
var/amount = input("How much gold do you want to give to [M]?")as num
if(usr.gold < amount)
usr << "You don't have enough gold"
else
if(!amount)
usr << "The amount must exceed 1"
else
M.gold += amount
usr.gold -= amount
M << "[usr] gave you [amount] gold!"
usr << "You gave [M] [amount] gold!"


That works fine.