MMShowMessage

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

MMShowMessage

Postby Alex » Fri Dec 29, 06 8:45 pm

Since MainMan requested for the source, I decided to just post it here.
Code: Select all
//=============================================================================
// MessageMutator Made by Alex ~ http://www.dxalpha.com/
//=============================================================================
class MessageMutator extends Mutator;

replication
{
   reliable if (Role == ROLE_Authority)
      _ShowMessage;
}

simulated function PostBeginPlay()
{
  Level.Game.BaseMutator.AddMutator(Self);
}

function Mutate (String S, PlayerPawn Player)
{
  local DeusExPlayer          _Player;
  local DeusExPlayer          _CurPlayer;
  local string             _Message;
  _Player = DeusExPlayer(Player);
  if(_Player != None && _Player.bAdmin)
  {
    if(Left(S,16) ~= "game.showmessage" && (Left(S,17) ~= "game.showmessage " || Left(S,17) ~= "game.showmessage"))
    {
      _Message = Right(S,Len(S)-17);
      if(Len(_Message) > 0)
      {
        Log(_Player.PlayerReplicationInfo.PlayerName@"shows a message with ShowMessage:"@_Message);
        _Message = "|p1"$_Message;
        ForEach AllActors(class 'DeusExPlayer', _CurPlayer)
        {
          if(_CurPlayer != None)
          {
            SetOwner(_CurPlayer);
            _ShowMessage(_CurPlayer,_Message);
          }
        }
      }
      else
      {
        _Player.ClientMessage("|p3<MiniMachina> Usage: Mutate Game.ShowMessage [Message]");
      }
    }   
  }   
  Super.Mutate(S,Player);
}

simulated function _ShowMessage(DeusExPlayer _Player, string _Message)
{
  local HUDMissionStartTextDisplay    _HUD;
  if ((_Player.RootWindow != None) && (DeusExRootWindow(_Player.RootWindow).HUD != None))
  {
    _HUD = DeusExRootWindow(_Player.RootWindow).HUD.startDisplay;
  }
  if(_HUD != None)
  {
    _HUD.shadowDist = 0;
    _HUD.Message = "";
    _HUD.charIndex = 0;
    _HUD.winText.SetText("");
    _HUD.winTextShadow.SetText("");
    _HUD.displayTime = 5.50;
    _HUD.perCharDelay = 0.30;
    _HUD.AddMessage(_Message);
    _HUD.StartMessage();
  }
}

defaultproperties
{
  bHidden=True
}


For the rest; Enjoy.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Re: MMShowMessage

Postby MainMan » Fri Dec 29, 06 10:04 pm

Ah so you use the MOTD window to display it? That's clever!

LOL at the amount of protection in there :wink:


Thanks for sharing :)


EDIT: Btw, is there any way for a player to not receive this? I.e. is there a way for a player to disable MOTD? (like you can disable help messages)
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK

Postby Alex » Sat Dec 30, 06 8:10 pm

Eeh, of course, just make sure it skips you from the ForEach loop. So when it checks if _CurPlayer != None, make sure it does some other check aswell ;)
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby MainMan » Sat Dec 30, 06 10:52 pm

No, I didn't mean that - I don't want people to miss the message - I want everyone to receieve it. I was just wondering if there was some option the client could set to disable the message (like bHelpMessages) - which is something that I don't want, and I would need to prevent it.
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK

Postby Alex » Sat Dec 30, 06 10:53 pm

My help messages are always deactivated. I hate them. Still see the showmessage though.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby MainMan » Sat Dec 30, 06 10:57 pm

Yeah I hate them too lol. It's like "omg you killed t3h teammate!11"
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK

Postby Ayleth » Tue Mar 13, 07 5:34 am

Alex, can i use this source to create a serveractor that says "Incoming player" or something when a player starts to join a server (thus explaining possible lag)?

Edit: probably will keep the mutator/actor seperate, but within the same mod file, and just have the actor call the mutator internally, so that if the ShowMessage mod isn't installed on the server, there is no problems.
I don't think i will change showmessage if i don't have to. Might slim it down a bit... :S

Edit: Edit: Uh... Is what i want Possible?? I messed around and couldn't get an actor to trigger anything when a player prelogins or logins :S. Tried an event prelogin and event playerpawn login override, but no luck... IDK?
¨‘°ºMåsåmµñ£º°‘¨
˙•●●ĊђασsΪηcǻяйαѓε●●•˙
jason.unger@gmail.com
User avatar
Ayleth
Regular
 
Posts: 313
Joined: Sun Jul 09, 06 7:27 pm
Location: 6 feet under. and trying to get out!

Postby Dae » Sat Jan 05, 08 8:48 pm

thank you very much for the source
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 2 guests