Advertisement
Spectrewiz

Player.cs (class)

Mar 9th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Terraria;
  6. using TShockAPI;
  7.  
  8. namespace TicketPlugin
  9. {
  10.     public class Player
  11.     {
  12.         public int Index { get; set; }
  13.         public TSPlayer TSPlayer { get { return TShock.Players[Index]; } }
  14.         //Add other variables here - MAKE SURE YOU DON'T MAKE THEM STATIC
  15.  
  16.         public Player(int index)
  17.         {
  18.             Index = index;
  19.         }
  20.  
  21.         public static Player GetPlayerByName(string name)
  22.         {
  23.             var player = TShock.Utils.FindPlayer(name)[0];
  24.             if (player != null)
  25.             {
  26.                 foreach (Player ply in TicketPlugin.Players)
  27.                 {
  28.                     if (ply.TSPlayer == player)
  29.                     {
  30.                         return ply;
  31.                     }
  32.                 }
  33.             }
  34.             return null;
  35.         }
  36.        
  37.         protected CanSubmitTickets TicState = CanSubmitTickets.yes;
  38.         public void SetTicState(CanSubmitTickets ticstate)
  39.         {
  40.             TicState = ticstate;
  41.         }
  42.         public CanSubmitTickets GetTicState()
  43.         {
  44.             return TicState;
  45.         }
  46.         public enum CanSubmitTickets
  47.         {
  48.             yes,
  49.             no
  50.             //maybe so? :P
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement