Proper VoteLogging

This commit is contained in:
ChocoTaco1 2020-04-04 13:48:22 -04:00
parent bf5ae873c1
commit 58bb1cb4f9
4 changed files with 35 additions and 3 deletions

View file

@ -1,5 +1,7 @@
$Host::ClassicAdminLog = 1;
$Host::ClassicConnectLog = 1;
//$Host::ClassicAdminLog = 1;
//$Host::ClassicConnectLog = 1;
//$Host::ClassicVoteLog = 1;
//exec("scripts/autoexec/EnableLogs.cs");
//Enable Logs
@ -58,4 +60,23 @@ function connectLog(%client, %isDisconnect)
logEcho($ConnectLog);
echo($ConnectLog);
}
}
// voteLog(%client, %votemsg)
// Info: Logs the vote events
function voteLog(%client, %votemsg)
{
if($Host::ClassicVoteLog)
{
// get the client info
%authInfo = %client.getAuthInfo();
%ip = getField(strreplace(%client.getAddress(),":","\t"),1);
// this is the info that will be logged
$VoteLog = "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[HH:nn]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ "," SPC %client.guid @ ") Initiated a vote:" SPC %votemsg SPC "CM[" @ $CurrentMission @ "]";
%logpath = $Host::ClassicVoteLogPath;
export("$VoteLog", %logpath, true);
logEcho($VoteLog);
}
}

View file

@ -607,7 +607,14 @@ function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %tea
%client.canVote = false;
%client.rescheduleVote = schedule(($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client);
echo("Vote Initiated by" SPC %client.nameBase SPC %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4);
echo(%msg);
// Log Vote
if($Host::ClassicVoteLog)
{
%votemsg = %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4;
voteLog(%client, %votemsg);
}
if($Host::EnableVoteSoundReminders > 0)
{