Full Version : accessing players in an account
xmlspawner >>Scripting Support >>accessing players in an account
<< Prev | Next >>
Galfaroth- 02-14-2006
Okay I don't want to make new thread so I will ask here. It's part of my RewardSystem.cs:

CODE
public static int GetRewardLevel( Account acct ) { PlayerMobile pm = Account.Mobile as PlayerMobile; int level = (int)( pm.GameTime.Hours / RewardInterval.TotalHours ); if ( level < 0 )
level = 0;
return level;
}

The compilation error is here: PlayerMobile pm = Account.Mobile as PlayerMobile; Account does not contain definition for Mobile. How should I change this to make it work?
ArteGordon- 02-14-2006
the mobiles in an account are stored in an array, since there can be multiple players per account
You need to refer to individual players in the account like
acct[0];
or loop through all of them like

CODE
for(int i = 0; i< acct.Length; i++) { PlayerMobile pm = acct[i] as PlayerMobile; // do your stuff with the pm }