How to add a chat command to the mutator

How to add a chat command to the mutator

  • Topic closed
  • You cannot reply to this topic

How to add a chat command to the mutator How to add a chat command to the mutator The code below adds a handler for the new chat command AddFakePlayers, which has one numeric argument (comes immediately after the command). The command works only for admins. ...

Geekrainian #1

    • Group: Admin
    • Posts: 800

    Posted:

    How to add a chat command to the mutator

    The code below adds a handler for the new chat command AddFakePlayers, which has one numeric argument (comes immediately after the command). The command works only for admins. Usage example: Mutator AddFakePlayers 5. This code should be placed inside the class that inherits the mutator (extends Mutator).

    function Mutate(string MutateString, PlayerController Sender)
    {
        local string Command;
        local int NParametr;
        local array<string> Parts;
    
        Split(MutateString, " ", Parts);
        Command = Parts[0];
    
        if (Parts.Length > 1)
            NParametr = int(Parts[1]);
    
        if (Command ~= "AddFakePlayers" && Sender.PlayerReplicationInfo.bAdmin)
            playersAdd = NParametr;
    
        if (NextMutator != None)
            NextMutator.Mutate(MutateString, Sender);
    }
    Back