Results 1 to 2 of 2
  1. #1

    BF4 - Maplist Events

    Hello developers ,
    Currently I'm writing a little plugin for my server but I encounter a little problem.
    I'm adding a map as follows:
    this.ExecuteCommand("procon.protected.send", "mapList.add", "MP_Prison", "ConquestLarge0", "2", "0");
    But the events "OnMaplistMapAppended" and "OnMaplistMapInserted" are not firing for me. If I remove the "0" (the offset) from the maplist.Add function, then the "OnMaplistMapAppended" (the other event was never called) event is firing, but I need to set the map to the top of the maplist, so I can't remove the offset from the function.

    In my eyes I'm calling everything correct, maybe one of you have any ideas?

    public void OnPluginLoaded(string strHostName, string strPort, string strPRoConVersion)
    {
    this.RegisterEvents(this.GetType().Name, "OnMaplistMapInserted", "OnMaplistMapAppended", "OnGlobalChat", "OnTeamChat", "OnSquadChat");
    }
    and
    public override void OnMaplistMapInserted(int mapIndex, string mapFileName)
    {
    this.ExecuteCommand("procon.protected.send", "admin.say", "OnMaplistMapInserted", "all");
    }

    public override void OnMaplistMapAppended(string mapFileName)
    {
    this.ExecuteCommand("procon.protected.send", "admin.say", "OnMaplistMapAppended", "all");
    }

  2. #2
    Firstly, doing admin say messages for debug is terrible. If you want a full debug message handler open this github link:
    https://raw.githubusercontent.com/Ad...test/AdKats.cs
    Then search for 'public class Logger'. You might need to remove some of the coupled references to AdKats.

    Secondly, i suspect you need to include all of the parameters, you can't just leave one off. So for the top of the list you'd have to insert it at the last index. So try getting the size of your map list and using one less than that as the index you pass in.
    ____

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •