Page 1 of 1

.say need to get money from bank

Posted: Fri Feb 27, 2009 10:04 am
by stella
Hi dudes! i need some help, i has working script like barter, but i need to get money from the player's bank then they used this command:

Code: Select all

use os;
use uo; 
use unicode; 

program textcommand(who, text, uc_text) 

var last_time := GetObjProperty(who,"_last_message_time");
if((polcore().systime - last_time) < 15)
SendSysMessage(who,"You must wait 15 seconds...");
return 0;
endif
SetObjProperty(who,"_last_message_time",polcore().systime);
    BroadCastUC(UC(who.name) + UC(": ") + uc_text, "RUS",0, 66 ); 
sleep(30);
endprogram

function UC(strs) 
  var result := array {}; 
  if (TypeOf(strs) != "Array") 
    result := CAscZ(CStr(strs)); 
  else 
    foreach str in (strs) 
      if (TypeOf(str) != "Array") 
        str := CAscZ(CStr(str)); 
      endif 
      result := result + str;     // POL 2003-06-19 or later required for this operation 
      foreach elem in (str) 
        result.append(elem); 
      endforeach 
      // 
    endforeach 
  endif 
  return result; 
endfunction 
Pol095
Thx, have a nice day.

Re: .say need to get money from bank

Posted: Fri Feb 27, 2009 7:45 pm
by *Edwards
why not using paypal instead? Less complicated. :)

Re: .say need to get money from bank

Posted: Sat Feb 28, 2009 6:43 am
by stella
I hope someone will help me ( :(

Re: .say need to get money from bank

Posted: Sat Feb 28, 2009 7:40 am
by CWO

Code: Select all

use os;
use uo;
use unicode;

include "util/bank";

program textcommand(who, text, uc_text)
	var last_time := GetObjProperty(who,"_last_message_time");
	if((ReadGameClock() - last_time) < 15)
		SendSysMessage(who, "You must wait 15 seconds...");
		return 0;
	endif
	var amount := 10; // <--- CHANGE THE GOLD COST HERE!
	if (!ConsumeSubstance(FindBankBox(who), 0xEED, amount))
		SendSysMessage(who, "You don't have enough gold in your bank!");
		return 0;
	endif
	SetObjProperty(who, "_last_message_time", ReadGameClock());
	BroadCastUC(UC(who.name) + UC(": ") + uc_text, "RUS", 0, 66 );
endprogram

function UC(strs)
  var result := array {};
  if (TypeOf(strs) != "Array")
    result := CAscZ(CStr(strs));
  else
    foreach str in (strs)
      if (TypeOf(str) != "Array")
        str := CAscZ(CStr(str));
      endif
      result := result + str;     // POL 2003-06-19 or later required for this operation
      foreach elem in (str)
        result.append(elem);
      endforeach
      //
    endforeach
  endif
  return result;
endfunction
This should work in 095 unless you don't have bank.inc. I also removed the sleep(30) at the end because there's no use for it... at least not in this script.

Code: Select all

var amount := 10; // <--- CHANGE THE GOLD COST HERE!
   if (!ConsumeSubstance(FindBankBox(who), 0xEED, amount))
      SendSysMessage(who, "You don't have enough gold in your bank!");
      return 0;
   endif
Basically all you needed was the ConsumeSubstance, the way to find the bankbox, and the check and return 0 for ConsumeSubstance on failure.

Re: .say need to get money from bank

Posted: Sun Mar 01, 2009 7:03 am
by stella
Thanks you dude, Chicago really has good people