Example #1
0
        public void AmeCommand(Client player, string message = "")
        {
            if (player.HasData(EntityData.PLAYER_AME) == true)
            {
                // We get player's TextLabel
                TextLabel label = player.GetData(EntityData.PLAYER_AME);

                if (message.Length > 0)
                {
                    // We update label's text
                    label.Text = "*" + message + "*";
                }
                else
                {
                    // Deleting TextLabel
                    label.Detach();
                    label.Delete();
                    player.ResetData(EntityData.PLAYER_AME);
                }
            }
            else
            {
                TextLabel ameLabel = NAPI.TextLabel.CreateTextLabel("*" + message + "*", new Vector3(0.0f, 0.0f, 0.0f), 50.0f, 0.5f, 4, new Color(201, 90, 0, 255));
                ameLabel.AttachTo(player, "SKEL_Head", new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f));
                player.SetData(EntityData.PLAYER_AME, ameLabel);
            }
        }
Example #2
0
 public static void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
 {
     // Deleting player's attached label
     if (player.HasData(EntityData.PLAYER_AME) == true)
     {
         TextLabel label = player.GetData(EntityData.PLAYER_AME);
         label.Detach();
         label.Delete();
     }
 }