CounterStrikeSharp icon indicating copy to clipboard operation
CounterStrikeSharp copied to clipboard

Add ability to rename bots

Open Jarzka opened this issue 11 months ago • 16 comments

It would be nice to rename bots on the server. Is there any way to do it? I tried the following code, but it did not work (name was not changed):

  [GameEventHandler]
  public HookResult OnPlayerSpawned(EventPlayerSpawned @event, GameEventInfo info)
  {
    if (@event.Userid.IsValid)
    {
      Console.WriteLine("Player has spawned: " + @event.Userid.PlayerName);
      @event.Userid.PlayerName = "Duke Nukem";
    }

    return HookResult.Continue;
  }

Jarzka avatar Mar 09 '24 19:03 Jarzka