TacoServer/Classic/scripts/autoexec/VoteSound.cs

66 lines
3 KiB
C#
Raw Normal View History

2019-09-13 19:34:03 +00:00
// VoteSound Script
//
2019-09-13 19:34:03 +00:00
// Make a sound every so seconds to make sure everyone votes
2019-02-20 22:59:45 +00:00
//
2019-09-13 19:34:03 +00:00
// 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.
2018-12-04 23:41:06 +00:00
2019-02-20 22:59:45 +00:00
function VoteSound( %game, %typename, %arg1, %arg2, %VoteSoundRandom )
{
2019-12-13 04:32:45 +00:00
if( Game.scheduleVote !$= "" && $Host::EnableVoteSound && $VoteSoundRandom $= %VoteSoundRandom ) //Game.scheduleVote !$= "" is if vote is active
2018-12-04 23:41:06 +00:00
{
2019-03-20 01:05:09 +00:00
%votemsg = "Press Insert for Yes or Delete for No.";
2019-03-15 16:39:00 +00:00
switch$(%typename)
2019-02-23 06:03:10 +00:00
{
2019-03-15 16:39:00 +00:00
case "VoteChangeMission":
2019-03-20 01:05:09 +00:00
messageAll('', '\c1Vote in Progress: \c0To change the mission to %1 (%2). %3~wgui/objective_notification.wav', %arg1, %arg2, %votemsg );
2019-12-21 22:25:35 +00:00
echo("Vote in Progress: To change the mission to" SPC %arg1 SPC "(" @ %arg2 @ ").");
2019-03-15 16:39:00 +00:00
case "VoteSkipMission":
2020-03-23 20:23:42 +00:00
messageAll('', '\c1Vote in Progress: \c0To skip the mission. %1~wgui/objective_notification.wav', %votemsg );
echo("Vote in Progress: To skip the mission.");
2019-03-15 16:39:00 +00:00
case "VoteChangeTimeLimit":
if(%arg1 $= "999") %arg1 = "unlimited";
2019-03-20 01:05:09 +00:00
messageAll('', '\c1Vote in Progress: \c0To change the time limit to %1. %2~wgui/objective_notification.wav', %arg1, %votemsg );
2019-12-21 22:25:35 +00:00
echo("Vote in Progress: To change the time limit to" SPC %arg1 @ ".");
2019-03-19 06:41:04 +00:00
case "VoteKickPlayer":
if(%arg1.team != 0 && Game.numTeams > 1) //Not observer
{
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
{
%cl = ClientGroup.getObject(%idx);
if (%cl.isAdmin == true)
{
if(%cl.team !$= %arg1.team) //Not on admins team
{
messageClient(%cl, '', '\c1Vote in Progress: \c0To kick %1 on the other team.~wgui/objective_notification.wav', %arg1.name);
}
else //Is on admins team
2019-03-20 01:05:09 +00:00
messageClient(%cl, '', '\c1Vote in Progress: \c0To kick player %1. %2~wgui/objective_notification.wav', %arg1.name, %votemsg );
2019-03-19 06:41:04 +00:00
}
else if(%cl.team $= %arg1.team) //Everyone else
2019-03-20 01:05:09 +00:00
messageClient(%cl, '', '\c1Vote in Progress: \c0To kick player %1. %2~wgui/objective_notification.wav', %arg1.name, %votemsg );
2019-03-19 06:41:04 +00:00
}
}
else //Is observer
2020-03-23 20:23:42 +00:00
messageAll('', '\c1Vote in Progress: \c0To kick player %1. %2~wgui/objective_notification.wav', %arg1.nameBase, %votemsg );
echo("Vote in Progress: To kick player" SPC %arg1.nameBase SPC "(" @ %arg1.guid @ ").");
2019-03-15 16:39:00 +00:00
case "VoteTournamentMode":
2019-03-20 01:05:09 +00:00
messageAll('', '\c1Vote in Progress: \c0To change the mission to Tournament Mode (%1). %3~wgui/objective_notification.wav', %arg1, %arg2, %votemsg );
2019-12-21 22:25:35 +00:00
echo("Vote in Progress: To change the mission to Tournament Mode" SPC "(" @ %arg1 @ ").");
2020-03-23 20:23:42 +00:00
default:
messageAll('', '\c1Vote in Progress: \c0To %1. %2~wgui/objective_notification.wav', %arg1, %votemsg );
echo("Vote in Progress: To" SPC %arg1);
2019-02-23 06:03:10 +00:00
}
2019-02-20 22:59:45 +00:00
2019-12-09 05:34:16 +00:00
if(isEventPending($VoteSoundSchedule))
cancel($VoteSoundSchedule);
$VoteSoundSchedule = schedule(12000, 0, "VoteSound", %game, %typename, %arg1, %arg2, %VoteSoundRandom);
2018-08-07 06:50:49 +00:00
}
}