.say need to get money from bank

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
stella
New User
Posts: 16
Joined: Fri Aug 22, 2008 2:42 am

.say need to get money from bank

Post 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.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Re: .say need to get money from bank

Post by *Edwards »

why not using paypal instead? Less complicated. :)
stella
New User
Posts: 16
Joined: Fri Aug 22, 2008 2:42 am

Re: .say need to get money from bank

Post by stella »

I hope someone will help me ( :(
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: .say need to get money from bank

Post 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.
stella
New User
Posts: 16
Joined: Fri Aug 22, 2008 2:42 am

Re: .say need to get money from bank

Post by stella »

Thanks you dude, Chicago really has good people
Post Reply