Author Topic: Announcement  (Read 7290 times)

I can't enter two words when I type "/announce Testing Today" in the chat box, it just returns as "Announcement: Testing". Here's the code from my my serverCMDAnnounce.

Code: [Select]
if(strlen(%text) <= 1)
{
return;
}

%obj = %client.player;
%obj.playthread(0, talk); //fwar play talk animation
%obj.schedule(strlen(%text) * 50, stopthread, 0);
   
    if(strlen(%text) >= $Pref::Server::MaxChatLen)
{
%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
}

chatMessageAll(%client, '\c3Announcement: \c0%1', %text);
echo("Announcement: ", %text);

chatMessageAll(%client, '\c3Announcement: \c0%1', %text);

should be

messageAll('','\c3Announcement: \c0%1', %text);

It still only displays one word.

Post the whole function.

function serverCmdAnnounce(%client, %text)
{
   if (%client.issuperadmin || %client.isadmin)
   {
      %text = StripMLControlChars(%text);

      if(strlen(%text) <= 1)
      {
         return;
      }

      %obj = %client.player;
      %obj.playthread(0, talk);            //fwar play talk animation
      %obj.schedule(strlen(%text) * 50, stopthread, 0);
   
         if(strlen(%text) >= $Pref::Server::MaxChatLen)
      {
         %text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
      }

      messageAll('','\c3Announcement: \c0%1', %text);
      echo("Announcement: ", %text);
   }
   else
   {
      return;
   }

}

Its an issue with the way badspot sends commands from the client. It splits up words into arguments, so %text will be the first word of what you send. You'll need to find a workaround that.


just use _ for space :P

just use _ for space :P

That's a great idea.

I can use '_'s for spaces and the script replaces it with a space.

Lol the script does work, I dunno the problem :/

but then the chat message you send would look like this:
/announce This_is_an_announcement. How about a system that would do that and then IDK what I'm saying. like this:

1. You send the message with normal spaces
2. A system converts the spaces to _'s
3. the system reads it and gets ready to send
4. Sends the message, but without the _'s. idk wtf im saying.

but then the chat message you send would look like this:
/announce This_is_an_announcement. How about a system that would do that and then IDK what I'm saying. like this:

1. You send the message with normal spaces
2. A system converts the spaces to _'s
3. the system reads it and gets ready to send
4. Sends the message, but without the _'s. idk wtf im saying.

I was thinking that too, but at step four it converts the _'s back to spaces.

I do the stuff in console and I can make it work...seems it only problems when you do it as a / :/

I do the stuff in console and I can make it work...seems it only problems when you do it as a / :/

Yeah, it only works in the console.

   else if (%client.ip=local)

That doesn't work either.