diff --git a/scripts/HLstats_EventHandlers.plib b/scripts/HLstats_EventHandlers.plib index 3d9d4b7..7c3a0bc 100644 --- a/scripts/HLstats_EventHandlers.plib +++ b/scripts/HLstats_EventHandlers.plib @@ -712,6 +712,8 @@ sub doEvent_Suicide my $desc; my $player = lookupPlayer($s_addr, $playerId, $playerUniqueId); my $playerstr = &getPlayerInfoString($player, $playerId); + + $player->set("is_dead", "1"); if ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) { @@ -1355,7 +1357,9 @@ sub doEvent_Frag } $killer->updateDB(); $victim->increment("map_deaths"); - $victim->set("is_dead", "1"); + if ($weapon ne "zombie_claws_of_death") { + $victim->set("is_dead", "0"); + } if ($victim->{auto_type} eq "kill") { &doEvent_Chat("say", $victim->{"userid"}, @@ -1391,6 +1395,16 @@ sub doEvent_PlayerPlayerAction my $victim = lookupPlayer($s_addr, $victimId, $victimUniqueId); my $playerstr = &getPlayerInfoString($player, $playerId); my $victimstr = &getPlayerInfoString($victim, $victimId); + + my $player_bonuspoints = 0; + if (defined($properties{hlx_player_bonuspoints})) { + $player_bonuspoints = $properties{hlx_player_bonuspoints}; + } + my $team_bonuspoints = 0; + if (defined($properties{hlx_team_bonuspoints})) { + $team_bonuspoints = $properties{hlx_team_bonuspoints}; + } + if ($playerId == $victimId) { $desc = "(IGNORED) PLAYER SAME AS VICTIM: "; } elsif ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) { @@ -1448,8 +1462,8 @@ sub doEvent_PlayerPlayerAction if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{ppaction}) { my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr}; my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id}; - my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player}; - my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team}; + my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player} + $player_bonuspoints; + my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team} + $team_bonuspoints; my $team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team}; if (defined($properties{assister_position})) { @@ -1579,6 +1593,9 @@ sub doEvent_PlayerAction } $player->updateDB(); } else { + if ($action eq "player_spawn") { + $player->set("is_dead", "0"); + } if ($g_servers{$s_addr}->{play_game} == TF()) { my $objectstring = ""; @@ -1723,6 +1740,15 @@ sub doEvent_PlayerAction $g_servers{$s_addr}->{nextkillheadshot} = $player->{playerid} } + my $player_bonuspoints = 0; + if (defined($properties{hlx_player_bonuspoints})) { + $player_bonuspoints = $properties{hlx_player_bonuspoints}; + } + my $team_bonuspoints = 0; + if (defined($properties{hlx_team_bonuspoints})) { + $team_bonuspoints = $properties{hlx_team_bonuspoints}; + } + my $map = $g_servers{$s_addr}->get_map(); if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}{paction}) { &doEvent_PlayerAction( @@ -1737,8 +1763,8 @@ sub doEvent_PlayerAction if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{paction}) { my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr}; my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id}; - my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player}; - my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team}; + my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player} + $player_bonuspoints; + my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team} + $team_bonuspoints; my $team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team}; &recordEvent( @@ -1817,8 +1843,14 @@ sub doEvent_PlayerAction sub doEvent_TeamAction { $rcmd = $g_servers{$s_addr}->{broadcasting_command}; - my ($team, $action) = @_; + my ($team, $action, %properties) = @_; my $desc; + + my $team_bonuspoints = 0; + if (defined($properties{hlx_team_bonuspoints})) { + $team_bonuspoints = $properties{hlx_team_bonuspoints}; + } + if ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) { $desc = "(IGNORED) NOTMINPLAYERS: "; @@ -1831,7 +1863,7 @@ sub doEvent_TeamAction if ((defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{taction}) || (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}{taction})) { my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr}; my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id}; - my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team}; + my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team} + $team_bonuspoints; my $actionteam = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team}; if ($actionteam eq "") { $actionteam = $team; @@ -1858,7 +1890,7 @@ sub doEvent_TeamAction } } if ($g_servers{$s_addr}->{round_status} == 0) { - if (($action eq "CTs_Win") || ($action eq "Bomb_Defused")) { + if (($action eq "CTs_Win") || ($action eq "Bomb_Defused")) { $g_servers{$s_addr}->increment("round_status"); $g_servers{$s_addr}->increment("ct_wins"); $g_servers{$s_addr}->increment("map_ct_wins"); @@ -1967,7 +1999,9 @@ sub doEvent_WorldAction $player->set("connect_time", time()); } if ($action eq "Round_Start") { - $player->set("is_dead", "0", 1); + if ($player->{team} ne "Spectator" && $player->{team} ne "Unassigned") { + $player->set("is_dead", "0", 1); + } if ($player->{auto_type} eq "start") { &doEvent_Chat("say", $player->{"userid"}, diff --git a/scripts/TRcon.pm b/scripts/TRcon.pm index 735b554..9c06a8a 100644 --- a/scripts/TRcon.pm +++ b/scripts/TRcon.pm @@ -338,8 +338,9 @@ sub getPlayers my $address = $8; my $port = $9; - $uniqueid =~ s/^STEAM_[0-9]+?\://i; - + $uniqueid =~ s!\[U:1:(\d+)\]!($1 % 2).':'.int($1 / 2)!eg; + $uniqueid =~ s/^STEAM_[0-9]+?\://i; + # &::printEvent("DEBUG", "USERID: '$userid', NAME: '$name', UNIQUEID: '$uniqueid', TIME: '$time', PING: '$ping', LOSS: '$loss', STATE: '$state', ADDRESS:'$address', CLI_PORT: '$port'", 1); if ($::g_mode eq "NameTrack") { diff --git a/scripts/hlstats.pl b/scripts/hlstats.pl index 0747740..64927e9 100644 --- a/scripts/hlstats.pl +++ b/scripts/hlstats.pl @@ -565,7 +565,7 @@ sub rewardTeam if (($g_servers{$s_addr}->{ignore_bots} == 1) && (($player->{is_bot} == 1) || ($player->{userid} <= 0))) { $desc = "(IGNORED) BOT: "; } else { - if ($player_team eq $team) { + if (($player_team eq $team) && ($player->{is_dead} == 0)) { if ($g_debug > 2) { &printNotice("Rewarding " . $player->getInfoString() . " with \"$reward\" skill for action \"$actionid\""); } @@ -1061,6 +1061,7 @@ sub getPlayerInfo my $haveplayer = 0; $plainuniqueid = $uniqueid; + $uniqueid =~ s!\[U:1:(\d+)\]!'STEAM_0:'.($1 % 2).':'.int($1 / 2)!eg; $uniqueid =~ s/^STEAM_[0-9]+?\://; if (($uniqueid eq "Console") && ($team eq "Console")) {