bernahcf Posted April 23, 2020 Share Posted April 23, 2020 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! Link to comment Share on other sites More sharing options...
Xabi Posted April 24, 2020 Share Posted April 24, 2020 Lo más rápido y fácil es que pongas el código aquí directamente. Link to comment Share on other sites More sharing options...
bernahcf Posted April 24, 2020 Author Share Posted April 24, 2020 (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 April 24, 2020 by bernahcf Link to comment Share on other sites More sharing options...
Xabi Posted April 24, 2020 Share Posted April 24, 2020 https://wiki.gtanet.work/index.php?title=Getting_Started_with_Commands Así en un primer vistazo, te falta el atributo GreedyArg en los comandos. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now