Jump to content

Recommended Posts

Posted

Buenas, tengo un problema con la programación que estoy llevando a cabo. La cuestion es que en el chat general al hablar por la T puedo hablar perfeectamente pero al usar un canal de texto por ejemplo un /me al poner un espacio no funciona dicho mensaje. ¿Alguien sabe que podria ser? Gracias!

Posted (edited)
        [Command("me")]
        public void CMD_Me(Client client, string message)
        {

            Client[] clients = NAPI.Pools.GetAllPlayers().FindAll(x => x.Position.DistanceTo2D(client.Position) <= 15).ToArray();

            for (int i = 0; i < clients.Length; i++)
            {
                if (!clients[i].Exists)
                    continue;

                clients[i].SendChatMessage($"~p~{client.Name}  {message}~p~");
            }
        }
        [Command("do")]
        public void CMD_do(Client client, string message)
        {

           Client[] clients = NAPI.Pools.GetAllPlayers().FindAll(x => x.Position.DistanceTo2D(client.Position) <= 15).ToArray();

            for (int i = 0; i < clients.Length; i++)
            {
                if (!clients[i].Exists)
                    continue;
                int client_id = client.GetData("ID");
                clients[i].SendChatMessage($"~g~[ID:{client_id}]:  {message}~g~");
            }
        }

Mi intención es que sean comandos de textos ya que al realizarlos asi y escribir algun espacio en la frase deja de funcionar el comando. Y bueno aquí tengo el archivo que seria el chat normal!.

namespace suburbia.Chat
{
    class Chat : Script
    {

        public Chat()
        {
            NAPI.Server.SetGlobalServerChat(false);
        }

        [ServerEvent(Event.ChatMessage)]
        public void EventChatMessage(Client client, string message)
        {

            Client[] clients = NAPI.Pools.GetAllPlayers().FindAll(x => x.Position.DistanceTo2D(client.Position) <= 15).ToArray();

            for (int i = 0; i < clients.Length; i++)
            {
                if (!clients[i].Exists)
                    continue;

                clients[i].SendChatMessage($"{client.Name} dice: {message}");
            }
        }
    }
}

 

Edited by bernahcf

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...