View Single Post
  #1  
Old 12-10-2011, 12:49 PM
wildwillie wildwillie is offline
Approved Member
 
Join Date: Aug 2010
Posts: 111
Default Scripting help needed

I need help with a couple of scripts for the stats/server manager program I am working on.

1st I need to check every 5 seconds to see of there is any commands in the queue to be processed. I have the queue stuff setup, just need the timing stuff. This is what I have so far based on examples I have seen, but it needs the timer number correctly:

Code:
    public override void OnTickGame()
    {
        if (Time.tickCounter() % 5000 == 50)
        {
            if (stats != null )
            {
               newCmds = stats.getCommands();
               if (newCmds.Count > 0)
                   ProcessCommands(newCmds);
            }
        }
 }
The next is for sending messages to the HUDlog. I would like the ability to send messages to (All players, All players in army 1(Red) or army 2(Blue), or a specific player) This is what I have so far:

Code:
    private void ProcessCommands(List<ServerCommand> newCmds)
    {
        try
        {
            foreach (ServerCommand sc in newCmds)
            {
                if (sc.CommandType.Equals("HUDmsg"))
                {
                	if (sc.ToWho.Equals("All"))
                    GamePlay.gpHUDLogCenter(sc.Command);
                  else if (sc.ToWho.Equals("Red"))
                   // Send message to Red Team
                    ????
                  else if (sc.ToWho.Equals("Blue"))
                   // Send message to Blue team
                   ???
                  else
                  {
                  	// Message is for a specific player based on player name in string sc.ToWho
                          ????
                  }
                }
            }
        }
        catch (Exception ex)
        {
            System.Console.WriteLine("Stats.ProcessCommands - Exception: " + ex);
        }
    }
Any help is appreciated,

WildWillie
Reply With Quote