7 string m_PlayerPrefix2;
17 PlayerStat<float> m_StatWater;
18 PlayerStat<float> m_StatEnergy;
19 BleedingSourcesManagerServer m_BleedMgr;
21 protected int m_HitFilter;
22 protected int m_PlacementFilter;
24 protected int m_PlayerListFilter;
28 const int TIMER_PLAYERLIST = GetPlayerListTimer();
30 static int GetPlayerListTimer()
44 m_HitFilter =
GetGame().ServerConfigGetInt(
"adminLogPlayerHitsOnly");
45 m_PlacementFilter =
GetGame().ServerConfigGetInt(
"adminLogPlacement");
47 m_PlayerListFilter =
GetGame().ServerConfigGetInt(
"adminLogPlayerList");
51 if ( m_PlayerListFilter == 1 )
54 m_Timer.Run( TIMER_PLAYERLIST ,
this,
"PlayerList", NULL,
true );
58 void ~PluginAdminLog()
62 void LogPrint(
string message )
73 for (
int i = 0; i < 3; i++ )
75 m_DotIndex = m_PosArray[i].IndexOf(
".");
76 if ( m_DotIndex != -1 )
78 m_PosArray[i] = m_PosArray[i].Substring( 0, m_DotIndex + 2 );
85 m_PlayerName =
"\"" + identity.GetName() +
"\"";
86 m_Pid = identity.GetId();
90 m_PlayerName = player.GetCachedName();
91 m_Pid = player.GetCachedID();
95 if ( !player.IsAlive() )
97 m_PlayerName = m_PlayerName +
" (DEAD)";
100 return "Player " + m_PlayerName +
" (id=" + m_Pid +
" pos=<" + m_PosArray[0] +
", " + m_PosArray[1] +
", " + m_PosArray[2] +
">)";
107 float dmg = damageResult.GetHighestDamage(
"Health");
108 return " into " + zone +
"(" +
component.ToString() +
") for " + dmg.ToString() +
" damage (" + ammo +
")";
112 return " into Block" +
"(" +
component.ToString() +
") for 0 damage ";
119 if (!player || !source)
121 LogPrint(
"DEBUG: PlayerKilled() player/source does not exist");
131 string playerPrefix, playerPrefix2;
134 playerPrefix2 = GetPlayerPrefix( playerSource , playerSource.GetIdentity() );
137 playerPrefix = GetPlayerPrefix( player , player.GetIdentity() );
138 if (player == source)
140 m_StatWater = player.GetStatWater();
141 m_StatEnergy = player.GetStatEnergy();
142 m_BleedMgr = player.GetBleedingManagerServer();
144 if ( m_StatWater && m_StatEnergy && m_BleedMgr )
146 LogPrint( playerPrefix +
" died. Stats> Water: " + m_StatWater.Get().ToString() +
" Energy: " + m_StatEnergy.Get().ToString() +
" Bleed sources: " + m_BleedMgr.GetBleedingSourcesCount().ToString() );
148 else if ( m_StatWater && m_StatEnergy && !m_BleedMgr )
150 LogPrint( playerPrefix +
" died. Stats> Water: " + m_StatWater.Get().ToString() +
" Energy: " + m_StatEnergy.Get().ToString() );
154 LogPrint( playerPrefix +
" died. Stats> could not fetch");
157 else if (source.IsWeapon() || source.IsMeleeWeapon())
160 if (source.IsMeleeWeapon())
162 LogPrint( playerPrefix +
" killed by " + playerPrefix2 +
" with " + source.GetDisplayName() );
166 m_Distance =
vector.Distance( player.GetPosition(), playerSource.GetPosition() );
167 LogPrint( playerPrefix +
" killed by " + playerPrefix2 +
" with " + source.GetDisplayName() +
" from " + m_Distance +
" meters " );
175 LogPrint( playerPrefix +
" killed by " + playerPrefix2 +
" with (MeleeFist)" );
180 LogPrint( playerPrefix +
" killed by " + source.GetType());
188 if ( player && source )
190 string playerPrefix = GetPlayerPrefix( player , player.GetIdentity() ) +
"[HP: " + player.GetHealth().ToString() +
"]";
191 string playerPrefix2;
192 m_HitMessage = GetHitMessage( damageResult,
component, dmgZone, ammo );
195 if ( source.IsPlayer() )
198 playerSource =
PlayerBase.Cast( source.GetHierarchyParent() );
201 playerPrefix2 = GetPlayerPrefix( playerSource , playerSource.GetIdentity() );
203 switch ( damageType )
207 if ( m_HitFilter != 1 && ( source.IsZombie() || source.IsAnimal() ) )
209 m_DisplayName = source.GetDisplayName();
211 LogPrint( playerPrefix +
" hit by " + m_DisplayName + m_HitMessage );
213 else if (source.IsPlayer())
215 LogPrint( playerPrefix +
" hit by " + playerPrefix2 + m_HitMessage );
217 else if ( playerSource && (source.IsMeleeWeapon() || source.IsWeapon()))
219 m_ItemInHands = source.GetDisplayName();
221 LogPrint( playerPrefix +
" hit by " + playerPrefix2 + m_HitMessage +
" with " + m_ItemInHands );
225 m_DisplayName = source.GetType();
227 LogPrint( playerPrefix +
" hit by " + m_DisplayName + m_HitMessage );
233 if ( source.IsWeapon() && playerSource )
235 m_ItemInHands = source.GetDisplayName();
236 m_Distance =
vector.Distance( player.GetPosition(), playerSource.GetPosition() );
238 LogPrint( playerPrefix +
" hit by " + playerPrefix2 + m_HitMessage +
" with " + m_ItemInHands +
" from " + m_Distance +
" meters ");
242 m_DisplayName = source.GetType();
244 LogPrint( playerPrefix +
" hit by " + m_DisplayName + m_HitMessage );
250 LogPrint( playerPrefix +
" hit by explosion (" + ammo +
")" );
255 LogPrint( playerPrefix +
" stunned by " + ammo );
259 float globalHealthDamage = damageResult.GetDamage(
"",
"Health");
262 if (globalHealthDamage > 0.0)
263 LogPrint(playerPrefix +
" hit by " + ammo);
265 else if ( source.GetType() ==
"AreaDamageManager" )
270 LogPrint( playerPrefix +
" hit by " + parent.GetType() +
" with " + ammo );
275 m_DisplayName = source.GetType();
277 LogPrint( playerPrefix +
" hit by " + m_DisplayName +
" with " + ammo );
283 LogPrint(
"DEBUG: PlayerHitBy() unknown damageType: " + ammo );
289 LogPrint(
"DEBUG: player/source does not exist");
295 m_PlayerPrefix = GetPlayerPrefix( player , player.GetIdentity() );
297 LogPrint( m_PlayerPrefix +
" is unconscious" );
302 if ( player.IsAlive() )
304 m_PlayerPrefix = GetPlayerPrefix( player , player.GetIdentity() );
306 LogPrint( m_PlayerPrefix +
" regained consciousness" );
312 if ( m_PlacementFilter == 1 )
315 m_PlayerPrefix = GetPlayerPrefix( m_Source , m_Source.GetIdentity() );
316 m_DisplayName = item.GetDisplayName();
318 if ( m_DisplayName ==
"" )
320 LogPrint( m_PlayerPrefix +
" placed unknown object" );
324 LogPrint( m_PlayerPrefix +
" placed " + m_DisplayName );
329 void OnContinouousAction(
ActionData action_data )
333 m_Message = action_data.m_Action.GetAdminLogMessage(action_data);
338 m_PlayerPrefix = GetPlayerPrefix( action_data.m_Player , action_data.m_Player.GetIdentity() );
340 LogPrint( m_PlayerPrefix + m_Message );
346 m_PlayerPrefix = GetPlayerPrefix( player , player.GetIdentity() );
348 LogPrint( m_PlayerPrefix +
" committed suicide" );
353 m_PlayerPrefix = GetPlayerPrefix( player , player.GetIdentity() );
355 LogPrint( m_PlayerPrefix +
" bled out" );
364 string prefix = GetPlayerPrefix(player, player.GetIdentity());
365 string flagType = totem.FindAttachmentBySlotName(
"Material_FPole_Flag").ClassName();
373 LogPrint( prefix +
" has " + action + flagType +
" on " + totem.ClassName() +
" at " + totem.GetPosition());
378 GetGame().GetPlayers( m_PlayerArray );
380 if ( m_PlayerArray.Count() != 0 )
382 LogPrint(
"##### PlayerList log: " + m_PlayerArray.Count().ToString() +
" players" );
384 foreach ( Man player: m_PlayerArray )
389 LogPrint( m_PlayerPrefix );
396 void DirectAdminLogPrint(
string str)