Author Topic: !vote, !rules, and other commands on my server -- custom console commands  (Read 9996 times)

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #20 on: December 27, 2007, 01:33:36 AM »
I can get the IP/port from when they connect, so that's (mostly) not a problem, but sending a connectionless print message to that IP/port is not working out too well.

DaRkNeSS

  • Autococker
  • Posts: 622
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #21 on: December 27, 2007, 10:13:50 PM »
Nice work, reminds me of the commands you can use in Counter-Strike servers.

coLa

  • Autococker
  • Posts: 1178
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #22 on: December 27, 2007, 10:23:43 PM »
also in warsow. i'd love to see these implemented.

DaRkNeSS

  • Autococker
  • Posts: 622
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #23 on: December 27, 2007, 11:31:17 PM »
As would I cola.

WarWulf

  • Autococker
  • Posts: 539
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #24 on: December 31, 2007, 04:13:57 AM »
i allways like it when someone makes something useful for dp :)

spectacular job :)

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #25 on: December 31, 2007, 07:32:14 AM »
sk89q,

THe k/d bug is pretty consistant that we talked about earlier. It's more like a d/k ratio.  Maybe your division is backwards?

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #26 on: December 31, 2007, 08:25:50 PM »
Well, the K/D returns correctly. It comes from my StdLog parser class, and I already went through the game you reported, KnacK, and the numbers appear to be correct. However, I haven't tried debugging the code that considers someone's play time.

Here's the code, albeit a little messy:

Code: [Select]
$best_play_time_per = 1;

foreach($game['players'] as $name => $info)
{
    $play_time_per = $game['play_time'] ? $info['play_time']/$game['play_time'] : 0;
    if($play_time_per > $best_play_time_per)
        $best_play_time_per = $play_time_per;
}

// [...]
               
$top_k_d = array();

foreach($game['players'] as $name => $info)
{
    if($info['k_d'] >= $top_kd['k_d'] && $game['play_time'] && $best_play_time_per && $info['play_time']/$game['play_time']/$best_play_time_per > .05 && $info['kills'] > 1)
    {
        $this->debug(sprintf("(debug) K/D= %4s %4s %s", round($info['k_d'], 2), round($info['play_time']/60, 1), DigitalPaintServer::clean_funname($name)));
        $top_k_d = array('name' => DigitalPaintServer::clean_funname($name),
                         'k_d' => $info['k_d']);
    }

// [...]

}

I have to fix a file-pointers-not-closing problem in my script before I can tackle this.

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #27 on: December 31, 2007, 08:40:00 PM »
* KnacK grabs some aspirin while attempting to read the code.

Keep up the great work sk89q.

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #28 on: December 31, 2007, 09:42:20 PM »
Bug should be fixed.

$top_k_d vs. $top_kd

Now hopefully rewriting file_get_contents and file using just fopen will prevent the file-pointers-not-closing bug from triggering. We'll see... :/

P.S. Happy New Year!

« Last Edit: December 31, 2007, 10:15:45 PM by sk89q »

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #29 on: January 01, 2008, 12:14:59 AM »
Nice. :)

DaRkNeSS

  • Autococker
  • Posts: 622
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #30 on: January 01, 2008, 12:22:30 AM »
It would be cool if you made some in-game lookup to see someone's registered names so you don't have to go to dplogin.com to see who is talking trash to you.

KiLo

  • Autococker
  • Posts: 2086
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #31 on: January 01, 2008, 12:28:00 AM »
It would be cool if you made some in-game lookup to see someone's registered names so you don't have to go to dplogin.com to see who is talking trash to you.

I 2nd that.

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #32 on: January 01, 2008, 12:11:56 PM »
Can't, since there's no way for me to send a private message to someone.

QueeNiE

  • 68 Carbine
  • Posts: 435
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #33 on: January 01, 2008, 12:30:46 PM »
you could have a command like !GLID <in-game ID#>, and it would just shout out to the server that persons first three names or something else related to the account.

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #34 on: January 01, 2008, 12:56:34 PM »
I don't think shouting out to the server is a great idea :/

DaRkNeSS

  • Autococker
  • Posts: 622
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #35 on: January 01, 2008, 01:52:58 PM »
How do the counter-strike servers make it so it only shows up for that player?

Cobo

  • Autococker
  • Posts: 1362
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #36 on: January 01, 2008, 02:06:37 PM »
How do the counter-strike servers make it so it only shows up for that player?
They use source modification ;)

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: !vote, !rules, and other commands on my server -- custom console commands
« Reply #37 on: January 01, 2008, 02:17:25 PM »
sk89q,

Looks like that fixed the problem.

Good Job.