Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 33

Thread: Plugin API 2.0

  1. #11
    Administrator
    Join Date
    Mar 2010
    Location
    Tasmania, Australia
    Posts
    3,487
    serverInfo.TeamScores is a List<TeamScores> where each entry contains is TeamId, Score, WinningScore

    to find this out for yourself, you can view the procon source at https://github.com/Myrcon/Procon-1

  2. #12
    hm, I tried my best but after hours of fidgeting I must admit im still stuck.

    I wasn't able to find the specific file in the source and if I did I probably didn't make enough sense of it.
    https://github.com/Myrcon/Procon-1/b...e/TeamScore.cs was my closest guess. But that doesn't seem to create a list as my patchworked c# knowledge would expect it. List<datatype> TeamScores = new List<datatype>(); and then TeamScores.Add(320); etc. (how come the List has TeamScores as a datatype?)

    I tried to solve the problem by outputting some of the lists contents (eg. serverInfo.TeamScores[1]) through procon.protected.pluginconsole.write or admin.say ... however the plugin cries about me not feeding the method a string. Trying to convert the expected int produced by serverInfo.TeamScores[1] to str was another unsuccessful waste of time :P
    Last edited by Taxez; 12-03-2013 at 04:51.

  3. #13
    Administrator
    Join Date
    Mar 2010
    Location
    Tasmania, Australia
    Posts
    3,487
    TeamScores is a class.

    serverInfo.TeamScores produces a List containing TeamScores objects.

    a quick way to look at it is
    Code:
    public override void OnServerInfo(CServerInfo serverInfo) 
    {
           foreach(TeamScores scores in serverInfo.TeamScores)
           {
                  this.ExecuteCommand("procon.protected.pluginconsole.write", "TeamID is : " + scores.TeamID);
                  this.ExecuteCommand("procon.protected.pluginconsole.write", "Score is : " + scores.Score);
                  this.ExecuteCommand("procon.protected.pluginconsole.write", "Score to win is : " + scores.WinningScore);
           }
    }

  4. #14
    That makes a lot of sense. Doesn't seem to be that simple though. I can't get rid of the following error msg:

    The type or namespace name 'TeamScores' could not be found (are you missing a using directive or an assembly reference?)

    BTW: thanks a buch for helping out and being so patient ^^

  5. #15

  6. #16
    Ah found the problem its "foreach(TeamScore scores in serverInfo.TeamScores)" ^^ Works!
    Just had to look into the TeamScores.cs file with the knowledge of it being a list of objects.
    Last edited by Taxez; 12-03-2013 at 05:57.

  7. #17

  8. #18
    is there any possibility to get the query port of the gameserver from the plugin api?

  9. #19
    Quote Originally Posted by DaMagicWoBBeR View Post
    is there any possibility to get the query port of the gameserver from the plugin api?
    What are you trying to do?

    Sent from my DROIDX using Tapatalk 2

  10. #20
    Getting live scoreboard from the server via a webpage . Therefore you need the query port from the server. I know there is a plugin also writing the scoreboard into a database, but if someone not using the plugin our webpage would also not work.

 

 

Posting Permissions

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