mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-20 00:24:49 +00:00
VoteSound Goon method
Using Classic Kick function
This commit is contained in:
parent
397aa72a6c
commit
5523d16317
|
|
@ -157,11 +157,15 @@ function playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %cli
|
|||
|
||||
echo("Vote Initiated by" SPC %client.nameBase SPC %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4);
|
||||
|
||||
%VoteSoundRandom = getRandom(1,100);
|
||||
$VoteSoundRandom = %VoteSoundRandom;
|
||||
$VoteSoundSchedule = schedule(10000, 0, "VoteSound", %game, %typename, %arg1, %arg2, %VoteSoundRandom);
|
||||
if($Host::EnableVoteSoundReminders > 0)
|
||||
{
|
||||
%time = mFloor($Host::VoteTime / ($Host::EnableVoteSoundReminders + 1)) * 1000;
|
||||
//echo(%time);
|
||||
for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++)
|
||||
Game.voteReminder[%i] = schedule((%time * (%i + 1)), 0, "VoteSound", %game, %typename, %arg1, %arg2);
|
||||
}
|
||||
//Added so vote will end on bogus votes
|
||||
$AutoVoteTimeoutSchedule = schedule(($Host::VoteTime * 1000) + 5000, 0, "AutoVoteTimeout");
|
||||
//$AutoVoteTimeoutSchedule = schedule(($Host::VoteTime * 1000) + 1000, 0, "AutoVoteTimeout");
|
||||
}
|
||||
|
||||
function AutoVoteTimeout()
|
||||
|
|
@ -416,7 +420,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
|
|||
if ( TriconWrapper( %client, %arg1, %typename ) )
|
||||
return;
|
||||
|
||||
switch$(%typename)
|
||||
switch$(%typeName)
|
||||
{
|
||||
case "VoteKickPlayer":
|
||||
if(%isAdmin && %client != %arg1) // client is an admin and the player to kick isn't the player himself
|
||||
|
|
@ -1070,67 +1074,6 @@ function DefaultGame::cancelMatchStart(%game, %admin)
|
|||
}
|
||||
}
|
||||
|
||||
function DefaultGame::voteKickPlayer(%game, %admin, %client)
|
||||
{
|
||||
%cause = "";
|
||||
|
||||
if(%admin)
|
||||
{
|
||||
kick(%client, %admin, %client.guid );
|
||||
%cause = "(admin)";
|
||||
}
|
||||
else
|
||||
{
|
||||
%team = %client.team;
|
||||
if(%team == 0)
|
||||
{
|
||||
%totalVotes = %game.totalVotesFor + %game.totalVotesAgainst;
|
||||
if(%totalVotes > 0 && (%game.totalVotesFor / %totalVotes) > ($Host::VotePasspercent / 100))
|
||||
{
|
||||
kick(%client, %admin, %game.kickGuid);
|
||||
%cause = "(vote)";
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
|
||||
if (%cl.team == %game.kickTeam && !%cl.isAIControlled())
|
||||
messageClient( %cl, 'MsgVoteFailed', '\c2Kick player vote did not pass' );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
%totalVotes = %game.votesFor[%game.kickTeam] + %game.votesAgainst[%game.kickTeam];
|
||||
if(%totalVotes > 0 && (%game.votesFor[%game.kickTeam] / %totalVotes) > ($Host::VotePasspercent / 100))
|
||||
{
|
||||
kick(%client, %admin, %game.kickGuid);
|
||||
%cause = "(vote)";
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
|
||||
if (%cl.team == %game.kickTeam && !%cl.isAIControlled())
|
||||
messageClient( %cl, 'MsgVoteFailed', '\c2Kick player vote did not pass' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%game.kickTeam = "";
|
||||
%game.kickGuid = "";
|
||||
%game.kickClientName = "";
|
||||
|
||||
if(%cause !$= "")
|
||||
logEcho($AdminCl.nameBase @ ": " @ %name @ " (cl " @ %game.kickClient @ ") kicked " @ %cause, 1);
|
||||
}
|
||||
|
||||
function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId)
|
||||
{
|
||||
%mission = $HostMissionFile[%missionId];
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@
|
|||
// Make a sound every so seconds to make sure everyone votes
|
||||
//
|
||||
// Enable or Disable VoteSound
|
||||
// $Host::EnableVoteSound = 1;
|
||||
//
|
||||
// %VotesoundRandom must match $VoteSoundRandom to prevent duplicate messages
|
||||
// $VoteSoundRandom is generated everytime a vote starts and if it doesnt match an ongoing schedule does not play.
|
||||
// $Host::EnableVoteSoundReminders = 3;
|
||||
// 3 for three reminder notifications
|
||||
|
||||
function VoteSound( %game, %typename, %arg1, %arg2, %VoteSoundRandom )
|
||||
function VoteSound( %game, %typename, %arg1, %arg2 )
|
||||
{
|
||||
if( Game.scheduleVote !$= "" && $Host::EnableVoteSound && $VoteSoundRandom $= %VoteSoundRandom ) //Game.scheduleVote !$= "" is if vote is active
|
||||
if( Game.scheduleVote !$= "" && $Host::EnableVoteSoundReminders > 0) //Game.scheduleVote !$= "" is if vote is active
|
||||
{
|
||||
%votemsg = "Press Insert for Yes or Delete for No.";
|
||||
|
||||
|
|
@ -56,10 +54,5 @@ function VoteSound( %game, %typename, %arg1, %arg2, %VoteSoundRandom )
|
|||
messageAll('', '\c1Vote in Progress: \c0To %1. %2~wgui/objective_notification.wav', %arg1, %votemsg );
|
||||
echo("Vote in Progress: To" SPC %arg1);
|
||||
}
|
||||
|
||||
if(isEventPending($VoteSoundSchedule))
|
||||
cancel($VoteSoundSchedule);
|
||||
|
||||
$VoteSoundSchedule = schedule(12000, 0, "VoteSound", %game, %typename, %arg1, %arg2, %VoteSoundRandom);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue