RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Admin script - AddToBank

jingz2k2

Sorceror
Solution:
The name space of Commands has changed
Old namespace Server.Scripts.Commands has to be replaced by

using Server.Commands;
 

greywolf79

Sorceror
Ok, I added that to the top... Now I get 2 errors (I am still a newbie, so if the errors are easy please forgive me).

Code:
Errors:
 + Custom/AddToBank.cs:
    CS0234: Line 29: The type or namespace name 'Register' does not exist in the
 namespace 'Server.Commands' (are you missing an assembly reference?)
    CS0117: Line 105: 'Server.Accounting.Accounts' does not contain a definition
 for 'Table'

GreyWolf.
 

jingz2k2

Sorceror
Hi Greywolf,

I'm also new to this TBH. I just searched your error keyword and found that. I just downloaded this tothebank script and saw this:

namespace Server.Scripts.Commands

which I believe should be changed to

namespace Server.Commands

And this code:
Code:
		public static void Initialize()
		{
			// alter AccessLevel to be AccessLevel.Admin if you only want admins to use.
			Server.Commands.Register( "AddToBank", AccessLevel.GameMaster, new CommandEventHandler( AddToBank_OnCommand ) );
		}

To this(Changes are marked in red color):
Code:
		public static void Initialize()
		{
			// alter AccessLevel to be AccessLevel.Admin if you only want admins to use.
			[COLOR="Red"]CommandSystem.Register[/COLOR]( "AddToBank", AccessLevel.GameMaster, new CommandEventHandler( AddToBank_OnCommand ) );
		}

I'm not too sure, please try it first and if there's more errors, I'll try to do more searching:p

Good luck!
Jingz
 

greywolf79

Sorceror
Ok, after that change it shows me this error:

Code:
Errors:
 + Custom/AddToBank.cs:
    CS0117: Line 105: 'Server.Accounting.Accounts' does not contain a definition
 for 'Table'

GreyWolf.
 

jingz2k2

Sorceror
Hi again,

My response is late because I have been trying to fix this too:p

Try adding these two on top:
Code:
using System.Collections.Generic;
using Server.Commands;

Afterwards Change This Line,
Code:
ArrayList accts = new ArrayList( Accounts.Table.Values );
foreach( Account acct in accts )

To this:
Code:
foreach ( Account acct in Accounts.GetAccounts() )

And then, Change this line:
Code:
			ArrayList mobs = new ArrayList( World.Mobiles.Values );

To this:
Code:
List<Mobile> mobs = new List<Mobile>( World.Mobiles.Values );

There are two Edits using List instead of ArrayList
One is at:
private static bool GiveItemToCharacters
The other is at:
private static bool GiveItemToAccessLevel

Please try again.
Jing
 

jingz2k2

Sorceror
Your welcome Greywolf.
I'm glad I can be of some help though I apologize for the slow fix because I'm no expert myself.

Have fun and good luck.
Jingz
 

UOExtreme

Sorceror
I know this is an old script but is there a way to only add it to players that are online? instead of everyone?
 
Top