commands
commands
Hey i wonder how its done with !r or !red and !b and !blue or !s and !spec and stuff with ASC or Nexgen, i cant find the source of ASC and nexgen is so huge and complicated i can only find that its somehow done with MutatorTeamMessage. Can anyone explain me how to make command with say messages instead of mutate [string]?
Re: commands
First register your mutator as a message mutator:
Now your mutator will be notified each time a player says something. You can handle it this way:
Code: Select all
function PreBeginPlay() {
Level.Game.RegisterMessageMutator(Self);
}
Code: Select all
function bool MutatorTeamMessage(Actor Sender, Pawn Receiver, PlayerReplicationInfo PRI, coerce string S, name Type, optional bool bBeep) {
// Only proceed if the command has been sent by a real player and make sure the process will only be called once
if(Sender.IsA('TournamentPlayer') && Sender == Receiver) {
if(S ~= "!MyCommand") {
// Do stuff here
}
}
// Allow other message mutators to do their job.
if (nextMessageMutator != none) {
return nextMessageMutator.mutatorTeamMessage(sender, receiver, pri, s, type, bBeep);
} else {
return true;
}
}
Website, Forum & UTStats
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
Re: commands
Now it works only sometimes i cant say anything at all and then i can and then i cant?! and i did register the thing.
here is the code
here is the code
Code: Select all
function bool MutatorTeamMessage( Actor Sender, Pawn Receiver, PlayerReplicationInfo PRI, coerce string S, name Type, optional bool bBeep )
{
local int index;
if(Sender.IsA('TournamentPlayer') && Sender == Receiver)
{
index = getplayerindex(PlayerPawn(Sender));
if(S~= "!MySpawnpoint" || S~= "!MySp")
SpawnToggle(PlayerPawn(Sender),index);
else if((S~= "!NextSpawnPoint" || S~= "!nsp") && PI[index].SCConfig.MyChoice)
SetSpawnPoint(PlayerPawn(Sender),index);
}
if ( NextMessageMutator != None )
return NextMessageMutator.MutatorTeamMessage( Sender, Receiver, PRI, S, Type, bBeep );
else
return true;
}
Re: commands
Code looks okay. What do you mean with "sometimes I can't say anything"? Does the say message not appear, or does it appear but nothing happens? And does that happen randomly or for a whole map and changes after mapchange?
Website, Forum & UTStats
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
Re: commands
I type something and press enter but no msg is shown. sometimes it happens or i want to say one of the cmds and nothing happens also the command is not shown in the msgbox