Last active
October 14, 2017 01:29
-
-
Save amineo/ae7d96d6281b303916654254cd305900 to your computer and use it in GitHub Desktop.
Modified to allow damage on everything but Large Gens and StationInvos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package evolution_package { | |
function TR2Game::getTeamName(%game, %team) | |
{ | |
if ( $Evo::ThisMission::TeamName[%team] ) | |
{ | |
return $Evo::ThisMission::TeamName[%team]; | |
} | |
if($Evo::ETMMode && %team != 0) | |
return $ETMmode::Team[$ETMCMap, %team]; | |
return parent::getTeamName( %game, %team ); | |
} | |
function TR2Game::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation) | |
{ | |
Parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); | |
// call the function | |
if(!$Host::TournamentMode || ($Host::TournamentMode && $Host::EvoStatsTourney)) | |
handleKillStat(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); | |
} | |
function TR2Game::sendDebriefing(%game, %client) | |
{ | |
if ( $Host::EvoStatsPosition == 0 ) | |
sendEvoDebriefing( %client ); | |
Parent::sendDebriefing(%game, %client); | |
if ( $Host::EvoStatsPosition != 0 ) | |
sendEvoDebriefing(%client); | |
} | |
// EvoAdmin (NoBase Damage) | |
// Modified to allow damage on everything but Large Gens and StationInvos | |
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) | |
{ | |
// echo( %targetObject.getDataBlock().getClassName() ); | |
// echo( %targetObject.getDataBlock().getName() ); | |
// No Base Rape option | |
if(!$Host::TournamentMode && $Host::EvoNoBaseRapeEnabled && $EvoNoBaseRape) | |
{ | |
// if(%targetObject.getDataBlock().getClassName() !$= "TurretData" && !%targetObject.getDataBlock().deployedObject) | |
if(%targetObject.getDataBlock().getName() $= "GeneratorLarge" || %targetObject.getDataBlock().getName() $= "StationInventory"){ | |
return; | |
} | |
} | |
Parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType); | |
} | |
function SiegeGame::sendDebriefing(%game, %client) | |
{ | |
//if neither team captured | |
%winnerName = ""; | |
if($teamScore[1] == 0 && $teamScore[2] == 0) | |
%winner = -1; | |
//else see if team1 won | |
else if($teamScore[1] > 0 && ( $teamScore[2] == 0 || $teamScore[1] < $teamScore[2])) | |
{ | |
%winner = 1; | |
%winnerName = $teamName[1]; | |
} | |
//else see if team2 won | |
else if($teamScore[2] > 0 && ($teamScore[1] == 0 || $teamScore[2] < $teamScore[1])) | |
{ | |
%winner = 2; | |
%winnerName = $teamName[2]; | |
} | |
//else see if it was a tie (right down to the millisecond - doubtful) | |
else if($teamScore[1] == $teamScore[2]) | |
%winner = 0; | |
//send the winner message | |
if(%winnerName $= 'Storm') | |
messageClient(%client, 'MsgGameOver', "Match has ended.~wvoice/announcer/ann.stowins.wav"); | |
else if(%winnerName $= 'Inferno') | |
messageClient(%client, 'MsgGameOver', "Match has ended.~wvoice/announcer/ann.infwins.wav"); | |
else | |
messageClient(%client, 'MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav"); | |
// Mission result: | |
if(%winner > 0) | |
{ | |
if(%winner == 1) | |
{ | |
if($teamScore[2] == 0) | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Team %1 wins!', $TeamName[1]); | |
else | |
{ | |
%timeDiffMS = $teamScore[2] - $teamScore[1]; | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Team %1 won by capturing the base %2 faster!', $TeamName[1], %game.formatTime(%timeDiffMS, true)); | |
} | |
} | |
else | |
{ | |
if($teamScore[1] == 0) | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Team %1 wins!', $TeamName[2]); | |
else | |
{ | |
%timeDiffMS = $teamScore[1] - $teamScore[2]; | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Team %1 won by capturing the base %2 faster!', $TeamName[2], %game.formatTime(%timeDiffMS, true)); | |
} | |
} | |
} | |
else | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>The mission ended in a tie.'); | |
// Game summary: | |
messageClient(%client, 'MsgDebriefAddLine', "", '<spush><color:00dc00><font:univers condensed:18>SUMMARY:<spop>'); | |
%team1 = %game.offenseTeam == 1 ? 2 : 1; | |
%team2 = %game.offenseTeam; | |
if($teamScore[%team1] > 0) | |
{ | |
%timeStr = %game.formatTime($teamScore[%team1], true); | |
messageClient(%client, 'MsgDebriefAddLine', "", '<bitmap:bullet_2><lmargin:24>%1 captured the %2 base for Team %3 in %4.<lmargin:0>', %game.capPlayer[%team1], $TeamName[%team2], $TeamName[%team1], %timeStr); | |
} | |
else | |
messageClient(%client, 'MsgDebriefAddLine', "", '<bitmap:bullet_2><lmargin:24>Team %1 failed to capture the base.<lmargin:0>', $TeamName[%team1]); | |
if($teamScore[%team2] > 0) | |
{ | |
%timeStr = %game.formatTime($teamScore[%team2], true); | |
messageClient(%client, 'MsgDebriefAddLine', "", '<bitmap:bullet_2><lmargin:24>%1 captured the %2 base for Team %3 in %4.<lmargin:0>', %game.capPlayer[%team2], $TeamName[%team1], $TeamName[%team2], %timeStr); | |
} | |
else | |
messageClient(%client, 'MsgDebriefAddLine', "", '<bitmap:bullet_2><lmargin:24>Team %1 failed to capture the base.<lmargin:0>', $TeamName[%team2]); | |
// send client the stats | |
if ( $Host::EvoStatsPosition == 0 ) | |
sendEvoDebriefing(%client); | |
// List out the team rosters: | |
messageClient(%client, 'MsgDebriefAddLine', "", '\n<lmargin:0><spush><color:00dc00><font:univers condensed:18><clip%%:50>%1</clip><lmargin%%:50><clip%%:50>%2</clip><spop>', $TeamName[1], $TeamName[2]); | |
%max = $TeamRank[1, count] > $TeamRank[2, count] ? $TeamRank[1, count] : $TeamRank[2, count]; | |
for(%line = 0; %line < %max; %line++) | |
{ | |
%plyr1 = $TeamRank[1, %line] $= "" ? "" : $TeamRank[1, %line].name; | |
%plyr2 = $TeamRank[2, %line] $= "" ? "" : $TeamRank[2, %line].name; | |
messageClient(%client, 'MsgDebriefAddLine', "", '<lmargin:0><clip%%:50> %1</clip><lmargin%%:50><clip%%:50> %2</clip>', %plyr1, %plyr2); | |
} | |
// Show observers: | |
%header = false; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0) | |
{ | |
if(!%header) | |
{ | |
messageClient(%client, 'MsgDebriefAddLine', "", '\n<lmargin:0><spush><color:00dc00><font:univers condensed:18>OBSERVERS<spop>'); | |
%header = true; | |
} | |
messageClient(%client, 'MsgDebriefAddLine', "", ' %1', %cl.name); | |
} | |
} | |
// send client the stats after the scores | |
if($Host::EvoStatsPosition == 1) | |
sendEvoDebriefing(%client); | |
} | |
function findNextCycleMission() | |
{ | |
if(( $Host::TournamentMode && $Host::EvoTourneySameMap) || (!$Host::TournamentMode && $Host::EvoOneMapOnly)) | |
return $CurrentMission; | |
// Cached results, so for one map, the 'nextcyclemission' will | |
// always return the same value | |
if (($EvoCachedCurrentMission $= $CurrentMission) && ($EvoCachedCurrentMissionType $= $CurrentMissionType) && ($EvoCachedCurrentNoBots == ($HostGameBotCount != 0))) | |
{ | |
return $EvoCachedNextMission; | |
} | |
%NextMission = getNextMission( $CurrentMission, $CurrentMissionType ); | |
// If there was no next mission to be found, repeat this mission. | |
// That's better at least than loading a map players online might not | |
// possess. | |
if (%NextMission == -1) | |
{ | |
%ReturnValue = $CurrentMission; | |
} | |
else | |
{ | |
%ReturnValue = $HostMissionFile[ getNextMission( $CurrentMission, $CurrentMissionType ) ]; | |
} | |
// Cache results for next call | |
$EvoCachedCurrentMission = $CurrentMission; | |
$EvoCachedCurrentMissionType = $CurrentMissionType; | |
$EvoCachedCurrentNoBots = ( $HostGameBotCount != 0 ); | |
$EvoCachedNextMission = %ReturnValue; | |
return %ReturnValue; | |
} | |
function CycleMissions() | |
{ | |
if(Game.scheduleVote !$= "") // a vote is still running, stop it | |
stopCurrentVote(); | |
if($Evo::ETMMode) // ETM mode stuff | |
{ | |
$ETMCMap = $ETMmode::CurrentMap; | |
if($ETMCMap != 1) | |
messageAll('MsgClient', 'Loading %1 (%2)...', $ETMmode::MapDisplayName[$ETMCMap], $ETMmode::MapDisplayType[$ETMCMap]); | |
loadMission($ETMmode::missionName[$ETMCMap], $ETMmode::missionType[$ETMCMap]); | |
$ETMmode::CurrentMap++; | |
} | |
else // normal cycle | |
Parent::CycleMissions(); | |
} | |
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch) | |
{ | |
// Call the standard procedure ... | |
Parent::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch ); | |
// Log the connection | |
connectLog(%client); | |
// Initialize Pizza Client if present | |
messageClient( %client, 'MsgPizzaJoin', "" ); | |
// Now that we're through this, we will start the custom ban procedure | |
// check if the clan is allowed to play here | |
for(%i = 0; %i <= $EvoBanClanCount; %i++) | |
{ | |
if($EvoBanClan[%i] !$= "") | |
{ | |
if ( EvoIsClientInClan( %client, $EvoBanClan[%i]) ) | |
{ | |
messageClient(%client, 'onClientKicked', ""); | |
messageAllExcept(%client, -1, 'MsgClientDrop', "", %client.name, %client); | |
if(isObject(%client.player)) | |
%client.player.scriptKill(0); | |
if(isObject(%client)) | |
{ | |
%client.setDisconnectReason("Your clan is not allowed to play here."); | |
%client.schedule(700, "delete"); | |
return; | |
} | |
} | |
} | |
} | |
// check if the player is allowed to play here | |
for(%x = 0; %x <= $EvoBanPlayerCount; %x++) | |
{ | |
if($EvoBanPlayer[%x] !$= "") | |
{ | |
if(%client.guid $= getWord($EvoBanPlayer[%x], 1)) | |
{ | |
messageClient(%client, 'onClientKicked', ""); | |
messageAllExcept(%client, -1, 'MsgClientDrop', "", %client.name, %client); | |
if(isObject(%client.player)) | |
%client.player.scriptKill(0); | |
if(isObject(%client)) | |
{ | |
%client.setDisconnectReason("You are not allowed to play here."); | |
%client.schedule(700, "delete"); | |
return; | |
} | |
} | |
} | |
} | |
// If AutoPW is enabled, the variables are set correctly AND | |
// the threshold is reached, set the auto PW | |
if($Host::ClassicAutoPWEnabled) | |
{ | |
if( ($Host::ClassicAutoPWPlayerCount != 0 && $Host::ClassicAutoPWPlayerCount !$= "" ) && | |
($HostGamePlayerCount >= $Host::ClassicAutoPWPlayerCount) && (!$Host::TournamentMode || | |
($Host::TournamentMode && $Host::Password !$= ""))) | |
{ | |
AutoPWServer(1); | |
} | |
} | |
// If serverFull PW is enabled, AND MaxPlayers is reached, | |
// set the server full pw | |
if($Host::EvoFullServerPWEnabled) | |
{ | |
if(!$Host::TournamentMode && $HostGamePlayerCount == $MaxPlayers) | |
{ | |
FullServerPW(1); | |
} | |
} | |
// If No Base Rape is activated | |
if($Host::EvoNoBaseRapeEnabled) | |
{ | |
// The following #ifdef allows to define separate variables for base and | |
// classic | |
if( !$Host::TournamentMode && ($Host::EvoNoBaseRapeClassicPlayerCount != 0) && | |
($Host::EvoNoBaseRapeClassicPlayerCount !$= "") && (EvoPlayersOnTeamCount() >= $Host::EvoNoBaseRapeClassicPlayerCount)) | |
{ | |
$EvoNoBaseRape = 0; | |
} | |
} | |
} | |
function GameConnection::onDrop(%client, %reason) | |
{ | |
if(isObject(Game)) | |
Game.onClientLeaveGame(%client); | |
// make sure that tagged string of player name is not used | |
if($CurrentMissionType !$= "SinglePlayer") | |
messageAllExcept(%client, -1, 'MsgClientDrop', '\c1%1 has left the game.', getTaggedString(%client.name), %client); | |
else | |
messageAllExcept(%client, -1, 'MsgClientDrop', "", getTaggedString(%client.name), %client); | |
if(isObject(%client.camera)) | |
%client.camera.delete(); | |
// z0dd - ZOD, 6/19/02. Strip the hit sound tags | |
removeTaggedString(%client.playerHitWav); | |
removeTaggedString(%client.vehicleHitWav); | |
removeTaggedString(%client.name); | |
removeTaggedString(%client.voiceTag); | |
removeTaggedString(%client.skin); | |
freeClientTarget(%client); | |
echo("CDROP: " @ %client @ " " @ %client.getAddress()); | |
$HostGamePlayerCount--; | |
// z0dd - ZOD, 5/05/04. Add a bot for every client drop if balanced bots are set | |
if( $Host::BotsEnabled ) | |
{ | |
if($Host::ClassicBalancedBots) | |
{ | |
if(!%client.isAIControlled()) | |
{ | |
if (serverCanAddBot()) | |
{ | |
aiConnectMultiple( 1, $Host::MinBotDifficulty, $Host::MaxBotDifficulty, -1 ); | |
$HostGameBotCount++; | |
} | |
} | |
} | |
} | |
if($Host::ClassicAutoPWEnabled) | |
{ | |
if( ($HostGamePlayerCount < $Host::ClassicAutoPWPlayerCount) && | |
(!$Host::TournamentMode || ($Host::TournamentMode && !$Host::EvoAutoPWTourneyNoRemove))) | |
{ | |
AutoPWServer(0); | |
} | |
} | |
if($Host::EvoFullServerPWEnabled) | |
{ | |
if($HostGamePlayerCount == ($MaxPlayers - 1)) | |
{ | |
FullServerPW(0); | |
} | |
} | |
if($Host::EvoNoBaseRapeEnabled) | |
{ | |
if(!$Host::TournamentMode && | |
(EvoPlayersOnTeamCount() < $Host::EvoNoBaseRapeClassicPlayerCount)) | |
{ | |
$EvoNoBaseRape = 1; | |
} | |
} | |
// Reset the server if everyone has left the game | |
if((($HostGamePlayerCount - $HostGameBotCount) == 0) && $Host::Dedicated && !$resettingServer && !$LoadingMission) | |
{ | |
if($Evo::ETMMode) | |
{ | |
$Evo::ETMMode = false; | |
ETMreset(); | |
} | |
schedule(10, 0, "resetServerDefaults"); | |
// Instead of simply resetting the defaults, reinitialize the | |
// entire server... | |
// ReallyQuit(); | |
} | |
} | |
function loadMission(%missionName, %missionType, %firstMission) | |
{ | |
// Prevents server to switch to a map that isn't in the cycle | |
if(!$Host::TournamentMode && $Host::EvoCustomMapRotation) | |
{ | |
if(!checkMapExist(%missionName, %missionType) || ($Host::MapFFA[%missionName, %missionType] !$= "" && $Host::MapFFA[%missionName, %missionType] == 0 )) | |
{ | |
for(%mis = 0; %mis < $HostMissionCount; %mis++) | |
{ | |
for(%type = 0; %type < $HostTypeCount; %type++) | |
{ | |
for(%i = 0; %i < $HostMissionCount[%type]; %i++) | |
{ | |
// Find a valid mission to change to | |
if($HostMission[%type, %i] == %mis) | |
{ | |
%missionName = $HostMissionFile[%mis]; | |
%missionType = $HostTypeName[%type]; | |
if($Host::MapFFA[%missionName, %missionType] != 0 && $HostTypeName[%type] $= $CurrentMissionType) | |
break; // it's a valid mission | |
} | |
} | |
if((%missionName $= $HostMissionFile[%mis]) && (%missionType $= $HostTypeName[%type])) | |
if($Host::MapFFA[%missionName, %missionType] != 0 && $HostTypeName[%type] $= $CurrentMissionType) | |
break; // it's a valid mission | |
} | |
if((%missionName $= $HostMissionFile[%mis]) && (%missionType $= $HostTypeName[%type])) | |
if($Host::MapFFA[%missionName, %missionType] != 0 && $HostTypeName[%type] $= $CurrentMissionType) | |
break; // it's a valid mission | |
} | |
} | |
} | |
if($AutoRestart) // z0dd - ZOD, 3/26/02. Auto restart server after a specified time. | |
{ | |
$AutoRestart = 0; | |
messageAll( 'MsgServerRestart', '\c2SERVER IS AUTO REBOOTING! COME BACK IN 5 MINUTES.~wfx/misc/red_alert.wav'); | |
logEcho("Auto server restart commencing."); | |
schedule(10000, 0, quit); | |
} | |
// z0dd - ZOD, 9/13/02. TR2 needs this. | |
if(%missionType $= "TR2") | |
{ | |
$_Camera::movementSpeed = $Camera::movementSpeed; | |
$Camera::movementSpeed = 80; | |
} | |
else | |
{ | |
%val = ($_Camera::movementSpeed $= "") ? $Classic::cameraSpeed : $_Camera::movementSpeed; // z0dd - ZOD, 9/13/02. Classic camera speed. | |
$Camera::movementSpeed = %val; | |
} | |
$LoadingMission = true; | |
disableCyclingConnections(true); | |
if(!$pref::NoClearConsole) | |
cls(); | |
if(isObject(LoadingGui)) | |
LoadingGui.gotLoadInfo = ""; | |
buildLoadInfo(%missionName, %missionType); | |
// reset all of these | |
ClearCenterPrintAll(); | |
ClearBottomPrintAll(); | |
if($Host::TournamentMode) | |
resetTournamentPlayers(); | |
// Send load info to all the connected clients: | |
for(%cl = 0; %cl < ClientGroup.getCount(); %cl++) | |
{ | |
%client = ClientGroup.getObject( %cl ); | |
if(!%client.isAIControlled()) | |
sendLoadInfoToClient(%client); | |
} | |
// Reset maximum turret counters to their defaults | |
$TeamDeployableMin[TurretIndoorDeployable] = 4; | |
$TeamDeployableMin[TurretOutdoorDeployable] = 4; | |
// Remove Mission Temporary Evolution Variables | |
for ( %counter = 0; %counter <= Game.numTeams; %counter ++ ) | |
{ | |
EvoRemoveTempTeamName( %counter ); | |
} | |
deleteVariables("$Evo::ThisMission::*"); | |
if($Host::EvoStats) | |
{ | |
// Erase stats from last map | |
deleteVariables("$Evo::*stats::*"); | |
// Works only for CTF | |
if(%missionType $= "CTF") | |
{ | |
// Thanks to Khazad for this code | |
// Set Filename | |
%fileIn = "stats/maps/classic/" @ %missionType @ "/" @ %missionName @ ".txt"; | |
// Initialize the file if not exist | |
if(!isFile(%fileIn)) | |
{ | |
$Evo::flagstats::heldTeam1 = 0; | |
$Evo::flagstats::realTeam1 = 0; | |
$Evo::flagstats::nickTeam1 = 0; | |
$Evo::flagstats::heldTeam2 = 0; | |
$Evo::flagstats::realTeam2 = 0; | |
$Evo::flagstats::nickTeam2 = 0; | |
export("$Evo::flagstats::*", "stats/maps/classic/" @ %missionType @ "/" @ %missionName @ ".txt", false); | |
} | |
// Khazad: Now load the new stats, perhaps call compile first? | |
// Khazad: this should overwrite whatever stats we have now. | |
exec(%fileIn); | |
} | |
} | |
// reset the default time limit if changed | |
if($Evo_DefaultTimeLimit) | |
{ | |
$Host::TimeLimit = $EvoDefaultTimeLimit; | |
$Evo_DefaultTimeLimit = 0; | |
} | |
// allow load condition to exit out | |
schedule(0, ServerGroup, loadMissionStage1, %missionName, %missionType, %firstMission); | |
} | |
function serverCmdMissionStartPhase3Done(%client, %seq) | |
{ | |
if(%seq != $missionSequence || !$MissionRunning) | |
return; | |
if(%client.currentPhase != 3) | |
return; | |
%client.currentPhase = 4; | |
%client.isReady = true; | |
Game.clientMissionDropReady(%client); | |
// %client.tricon == 1 means: client found, but no message yet | |
if ( !%client.pizza && %client.tricon == 1 ) | |
{ | |
messageClient( %client, "", "\c2Tricon2 client registered." ); | |
%client.tricon = 2; // %client.tricon == 2 : found and message printed | |
} | |
if(!$Host::TournamentMode && !%client.motd && $Host::EvoMOTD !$= "") | |
{ | |
centerprint(%client, $Host::EvoMOTD, $Host::EvoMOTDtime, $Host::EvoMOTDlines); | |
%client.motd = true; | |
} | |
else if($Host::TournamentMode) | |
%client.motd = true; | |
} | |
function serverCmdSAD( %client, %password ) | |
{ | |
if(%password $= "") | |
{ | |
messageClient(%client, 'MsgPasswordFailed', '\c2You did not supply a PW.'); | |
return; | |
} | |
switch$(%password) | |
{ | |
case "logout": | |
if (!%client.isAdmin) | |
{ | |
messageClient( %client, 'MsgPasswordFailed', '\c2You have no admin privileges to give up.'); | |
return; | |
} | |
%client.isAdmin = false; | |
%client.isSuperAdmin = false; | |
%adminmsg = " has given up "@(%client.sex $= "Male" ? "his" : "her")@" admin privileges."; | |
messageAll('MsgStripAdminPlayer', '\c3%2\c2 has given up admin privileges.', %client.name, %client.name, %client ); | |
if ( %client.pizza ) | |
{ | |
sendPizzaHudUpdate( %game, %client, "" ); | |
} | |
adminLog( %client, %adminmsg ); | |
LogEcho ( %client.nameBase @ %adminmsg ); | |
case $Host::AdminPassword: | |
if(!%client.isAdmin) | |
{ | |
if(%password $= "changeme") | |
{ | |
messageClient(%client, 'MsgPasswordFailed', '\c2Illegal Admin PW. You need to change the default \"$Host::AdminPassword\" value in \"evo_prefs.cs\"!'); | |
return; | |
} | |
%client.isAdmin = true; | |
%client.isSuperAdmin = false; | |
messageAll('MsgAdminAdminPlayer', '\c3%2 \c2has become an Admin by force.', %client, %client.name); | |
if ( %client.pizza ) | |
{ | |
sendPizzaHudUpdate( %game, %client, "" ); | |
} | |
%adminmsg = " has become an Admin by force."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " has become an Admin by force."); | |
} | |
case $Host::ClassicSuperAdminPassword: | |
if(!%client.isSuperAdmin) | |
{ | |
if(%password $= "changeme") | |
{ | |
messageClient(%client, 'MsgPasswordFailed', '\c2Illegal SAD PW. You need to change the default \"$Host::ClassicSuperAdminPassword\" value in \"evo_prefs.cs\"!'); | |
return; | |
} | |
%client.isAdmin = true; | |
%client.isSuperAdmin = true; | |
messageAll('MsgSuperAdminPlayer', '\c3%2 \c2has become a Super Admin by force.', %client, %client.name); | |
if ( %client.pizza ) | |
{ | |
sendPizzaHudUpdate( %game, %client, "" ); | |
} | |
%adminmsg = " has become a Super Admin by force."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " has become a Super Admin by force."); | |
} | |
default: | |
messageClient(%client, 'MsgPasswordFailed', '\c2Illegal SAD PW.'); | |
%client.SadAttempts++; | |
if(%client.SadAttempts >= 6 && !%client.isSuperAdmin) | |
{ | |
%client.getAddress(); | |
%client.getAuthInfo(); | |
messageClient(%client, 'onClientBanned', 'For attempting to exploit SAD to gain unauthorized Admin by entering\ntoo many passwords, you are being Banned'); | |
if( isObject(%client.player) ) | |
{ | |
%client.player.scriptKill(0); | |
%client.schedule(700, "delete"); | |
} | |
schedule(10, %client @ "ResetSadAttp", %client); | |
%client.setDisconnectReason( 'For attempting to exploit SAD to gain unauthorized Admin by entering\ntoo many passwords, you are being Banned.' ); | |
%client.schedule(700, "delete"); | |
BanList::add(%client.guid, %client.getAddress(), $Host::BanTime); | |
logEcho(%client.nameBase @ " " @ %client.guid @ " has been banned for excessive use of SAD"); | |
} | |
} | |
} | |
function serverCmdSADSetPassword(%client, %password) | |
{ | |
if(!%client.isAdmin) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Admins can use this command.'); | |
return; | |
} | |
if(!%client.isSuperAdmin && %client.isAdmin && !$Host::EvoAdminServerPW) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2This function is disabled.'); | |
return; | |
} | |
if(%password $= "") | |
{ | |
messageClient(%client, 'MsgValueFailed', '\c2No Changes. You did not supply a value. Use \"remove\" to remove join pw.'); | |
return; | |
} | |
%password = detag(%password); | |
%name = %client.name; | |
if(%client.isSuperAdmin) | |
{ | |
if(%password $= "remove") | |
{ | |
$Host::Password = ""; | |
$BackupPassword = ""; | |
} | |
else | |
{ | |
$Host::Password = %password; | |
$BackupPassword = %password; | |
if($Host::ClassicAutoPWEnabled) | |
{ | |
$Host::ClassicAutoPWEnabled = 0; | |
%msg = "\c2Auto-password disabled."; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
} | |
} | |
export("$Host::*", $serverprefs, false); | |
%adminmsg = " changed the join password to " @ %password; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the join password."); | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.isAdmin) | |
{ | |
messageClient(%cl, 'MsgServerPassword', '\c3%1\c2: JOIN PASSWORD CHANGED.~wfx/misc/diagnostic_on.wav', %name); | |
if(%password $= "remove") | |
messageClient(%cl, 'MsgServerPassword', '\c2Join PW removed.'); | |
else | |
messageClient(%cl, 'MsgServerPassword', '\c2Join PW changed to: \c3%1\c2.', %password); | |
} | |
} | |
} | |
else if(%client.isAdmin && $Host::EvoAdminServerPW) | |
{ | |
if(%password $= "remove") | |
{ | |
$Host::Password = ""; | |
$BackupPassword = ""; | |
} | |
else | |
{ | |
$Host::Password = %password; | |
$BackupPassword = %password; | |
if($Host::ClassicAutoPWEnabled) | |
{ | |
$Host::ClassicAutoPWEnabled = 0; | |
%msg = "\c2Auto-password disabled."; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
} | |
} | |
export("$Host::*", $serverprefs, false); | |
%adminmsg = " changed the join password to " @ %password; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the join password."); | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.isAdmin) | |
{ | |
messageClient(%cl, 'MsgServerPassword', '\c3%1\c2: JOIN PASSWORD CHANGED.~wfx/misc/diagnostic_on.wav', %name); | |
if(%password $= "remove") | |
messageClient(%cl, 'MsgServerPassword', '\c2Join PW removed.'); | |
else | |
messageClient(%cl, 'MsgServerPassword', '\c2Join PW changed to: \c3%1\c2.', %password); | |
} | |
} | |
} | |
} | |
function serverCmdSet(%client, %type, %val) | |
{ | |
// USAGE: commandToServer('Set', type, value); | |
%type = deTag(%type); | |
%val = deTag(%val); | |
if(!%client.isSuperAdmin) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use that command.'); | |
return; | |
} | |
if(%type $= "") | |
{ | |
messageClient(%client, 'MsgTypeFailed', '\c2No Changes. You did not supply a type.'); | |
return; | |
} | |
//if( (%val $= "") && (%type !$= "joinpw") ) | |
if(%val $= "") | |
{ | |
if(%type $= "joinpw") | |
messageClient(%client, 'MsgValueFailed', '\c2No Changes. You did not supply a value. Use \"remove\" to remove join pw.'); | |
else | |
messageClient(%client, 'MsgValueFailed', '\c2No Changes. You did not supply a value.'); | |
return; | |
} | |
%name = %client.name; | |
switch$(%type) | |
{ | |
case "superpw": | |
$Host::ClassicSuperAdminPassword = %val; | |
export( "$Host::*", $serverprefs, false ); | |
messageClient(%client, 'MsgSuperPassword', '\c2\"Super Admin\" PW changed to: \c3%1\c2.', addTaggedString(%val)); | |
%adminmsg = " changed the Super Admin password to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the Super Admin password."); | |
case "adminpw": | |
$Host::AdminPassword = %val; | |
export("$Host::*", $serverprefs, false); | |
messageClient(%client, 'MsgAdminPassword', '\c2\"Admin\" PW changed to: \c3%1\c2.', %val); | |
%adminmsg = " changed the Admin password to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the Admin password."); | |
case "joinpw": | |
if(%val $= "remove") | |
{ | |
$Host::Password = ""; | |
$BackupPassword = ""; | |
} | |
else | |
{ | |
$Host::Password = %val; | |
$BackupPassword = %val; | |
if($Host::ClassicAutoPWEnabled) | |
{ | |
$Host::ClassicAutoPWEnabled = 0; | |
%msg = "\c2Auto-password disabled."; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
} | |
} | |
export("$Host::*", $serverprefs, false); | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.isAdmin) | |
{ | |
messageClient(%cl, 'MsgServerPassword', '\c3%1\c2: JOIN PASSWORD CHANGED.~wfx/misc/diagnostic_on.wav', %name); | |
if(%val $= "remove") | |
messageClient(%cl, 'MsgServerPassword', '\c2Join PW removed.'); | |
else | |
messageClient(%cl, 'MsgServerPassword', '\c2Join PW changed to: \c3%1\c2.', %val); | |
} | |
} | |
%adminmsg = " changed the join password to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the join password."); | |
case "maxplayers": | |
if(isNumber(%val) && (%val > 0)) | |
{ | |
$Host::MaxPlayers = %val; | |
export("$Host::*", $serverprefs, false); | |
messageAll('MsgMaxPlayersSet', '\c3%1\c2: PLAYER LIMIT CHANGED TO: \c3%2\c2.~wfx/misc/diagnostic_on.wav', %name, %val); | |
%adminmsg = " changed the Player Limit to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the Player Limit."); | |
} | |
else | |
messageClient(%client, 'MsgAdmin', '\c2Value must be a positive number.'); | |
case "restart": | |
if(%val $= "0") | |
{ | |
if(isEventPending($RestartSchedule1)) | |
cancel($RestartSchedule1); | |
if(isEventPending($RestartSchedule2)) | |
cancel($RestartSchedule2); | |
$PizzaHudRestartVar = 0; | |
%msg = "\c3" @ getTaggedString(%name) @ "\c2: SERVER RESTART HAS BEEN CANCELED.~wfx/misc/diagnostic_on.wav"; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
else | |
messageClient(%cl, 'MsgAdmin', %msg); | |
} | |
%adminmsg = " canceled a server restart."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " canceled a server restart."); | |
} | |
else if(%val $= "1") | |
{ | |
$PizzaHudRestartVar = 1; | |
%msg = "\c3" @ getTaggedString(%name) @ "\c2: SERVER WILL BE REBOOTING IN 30 SECONDS!~wfx/misc/red_alert.wav"; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
else | |
messageClient(%cl, 'MsgAdmin', %msg); | |
} | |
$RestartSchedule1 = schedule(20000, 0, "messageAll", 'MsgServerRestart', '\c2SERVER WILL REBOOT IN 10 SECONDS!~wfx/misc/hunters_10.wav'); | |
$RestartSchedule2 = schedule(30000, 0, reallyQuit); | |
%adminmsg = " forced a server restart."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " forced a server restart."); | |
} | |
else | |
messageClient(%client, 'MsgAdmin', '\c2Unknown restart value. 0 cancels restart, 1 forces restart.'); | |
case "random": | |
if(%val $= "0" || %val $= "1") | |
{ | |
if($CurrentMissionType $= TR2) // z0dd - ZOD, 9/17/02. Check for Team Rabbit 2 | |
{ | |
messageClient(%client, 'MsgAdmin', '\c2This feature is unavailable in Team Rabbit 2.'); | |
return; | |
} | |
$Host::ClassicRandomizeTeams = $RandomTeams = %val; | |
export("$Host::*", $serverprefs, false); | |
%detail = ($RandomTeams ? "ENABLED" : "DISABLED"); | |
%msg = "\c3" @ getTaggedString(%name) @ "\c2: RANDOM TEAMS " @ %detail @ ". Changes will take place next mission.~wfx/misc/diagnostic_on.wav"; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
else | |
messageClient(%cl, 'MsgAdmin', %msg); | |
} | |
%adminmsg = " " @ %detail @ " random teams."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " " @ %detail @ " random teams."); | |
} | |
else | |
messageClient( %client, 'MsgAdmin', '\c2Unknown input value. 0 disables Random Teams, 1 enables Random Teams.' ); | |
case "fairteams": | |
if(%val $= "0" || %val $= "1") | |
{ | |
$Host::ClassicFairTeams = %val; | |
export("$Host::*", $serverprefs, false); | |
%detail = ($Host::ClassicFairTeams ? "ENABLED" : "DISABLED"); | |
%msg = "\c3" @ getTaggedString(%name) @ "\c2: FAIR TEAMS " @ %detail @ ".~wfx/misc/diagnostic_on.wav"; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
else | |
messageClient(%cl, 'MsgAdmin', %msg); | |
} | |
%adminmsg = " " @ %detail @ " fair teams."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " " @ %detail @ " fair teams."); | |
} | |
else | |
messageClient(%client, 'MsgAdmin', '\c2Unknown input value. 0 disables Fair Teams, 1 enables Fair Teams.'); | |
case "consolecmd": | |
if($Host::ClassicAllowConsoleAccess) | |
{ | |
eval(%val); | |
messageClient( %client, 'MsgAdmin', '\c2Command %1 sent to server console.', %val ); | |
logEcho(%client.nameBase @ "Send the console command " @ %val @ " to the server.", 1); | |
} | |
default: | |
messageClient(%client, 'MsgValueFailed', '\c2No Changes. You did not specify a valid type.'); | |
} | |
} | |
function AutoPWServer(%val) | |
{ | |
if(%val && ($Host::ClassicAutoPWPassword !$= "changeit")) | |
{ | |
$Host::Password = $Host::ClassicAutoPWPassword; | |
} | |
else if($BackupPassword !$= "") | |
{ | |
$Host::Password = $BackupPassword; // if there was one, restore the old password | |
} | |
else | |
{ | |
$Host::Password = ""; | |
} | |
} | |
function serverCmdAutoPWSetup(%client, %type, %val) | |
{ | |
%type = detag(%type); | |
%val = detag(%val); | |
if(!%client.isSuperAdmin) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use this command.'); | |
return; | |
} | |
if(%type $= "") | |
{ | |
messageClient(%client, 'MsgTypeFailed', '\c2No Changes. You did not supply a type.'); | |
return; | |
} | |
switch$(%type) | |
{ | |
case "autopw": | |
if(%val $= "0") | |
{ | |
$Host::ClassicAutoPWEnabled = 0; | |
AutoPWServer(0); | |
%msg = "\c2Auto-password disabled."; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
%adminmsg = " DISABLED Auto-password."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " disabled Auto-password."); | |
} | |
else if (%val $= "1") | |
{ | |
$Host::ClassicAutoPWEnabled = 1; | |
%msg = "\c2Auto-password enabled."; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
%adminmsg = " ENABLED Auto-password."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " enabled Auto-password."); | |
} | |
else | |
messageClient( %client, 'MsgAdmin', '\c2Unknown value. 0 disables Auto-password, 1 enables Auto-password.' ); | |
case "autopwpass": | |
if(%val !$= "" && %val !$= "changeit") | |
{ | |
$Host::ClassicAutoPWPassword = %val; | |
} | |
else if(%val $= "changeit") | |
{ | |
messageClient(%client, 'MsgPasswordFailed', '\c2Illegal PW. Please choose another password.'); | |
return; | |
} | |
else | |
{ | |
messageClient(%client, 'MsgAdmin', '\c2You must specify a password.'); | |
return; | |
} | |
export( "$Host::*", $serverprefs, false ); | |
messageClient(%client, 'MsgServerPassword', '\c2Server Auto-password PW changed to: \c3%1\c2.', %val); | |
%adminmsg = " changed the Auto-password PW to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the Auto-password PW."); | |
case "autopwcount": | |
if(isNumber(%val) && (%val !$= "") && (%val > 0)) | |
{ | |
$Host::ClassicAutoPWPlayerCount = %val; | |
} | |
else | |
{ | |
messageClient( %client, 'MsgAdmin', '\c2You must specify a numerical value.' ); | |
return; | |
} | |
export( "$Host::*", $serverprefs, false ); | |
messageClient(%client, 'MsgServerPassword', '\c2Server Auto-password player count changed to: \c3%1\c2.', %val); | |
%adminmsg = " changed the Auto-password player count to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the Auto-password player count."); | |
} | |
} | |
function serverCmdClientJoinTeam(%client, %team, %admin) | |
{ | |
// z0dd - ZOD, 4/10/04. ilys - if the client does not enter a team, uses a team less than -1, | |
// more than the number of teams for the gametype or zero, set his team to -1 (switch) | |
if(%team $= "" || %team < -1 || %team == 0 || %team > Game.numTeams) | |
%team = -1; | |
if(%team == -1) | |
{ | |
if(%client.team == 1) | |
%team = 2; | |
else | |
%team = 1; | |
} | |
if(isObject(Game) && Game.kickClient != %client) | |
{ | |
if(%client.team != %team) | |
{ | |
if($Host::ClassicFairTeams && !%client.isAdmin && $CurrentMissionType !$= TR2) | |
{ | |
%otherTeam = %team == 1 ? 2 : 1; | |
if((!%admin.isAdmin) && (%team != 0) && (($TeamRank[%team, count]+1) > $TeamRank[%otherTeam, count]) && (!$Host::EvoRelaxedFairTeams || ($teamScore[%team] < $teamScore[%otherteam]))) | |
{ | |
messageClient(%client, 'MsgFairTeams', '\c2Teams will be uneven, please choose another team.'); | |
return; | |
} | |
if (( !%admin.isAdmin) && ($Evo::ThisMission::ClanLockActive) && (%team == $Evo::ThisMission::ClanLockTeam) && (!EvoIsClientInClan( %client, $Evo::ThisMission::ClanLockClan))) | |
{ | |
messageClient(%client, 'MsgClanLock', '\c2The team you are trying to change to is locked. Only members of the \c3%2\c2 clan may change to that team.', %team, $Evo::ThisMission::ClanLockClan); | |
return; | |
} | |
} | |
if(!%client.isWaiting || %admin.isAdmin) | |
{ | |
%client.isWaiting = true; | |
%client.waitStart = getSimTime(); | |
%client.schedule($WAIT_PERIOD, waitTimeout); | |
%fromObs = %client.team == 0; | |
if(%fromObs) | |
clearBottomPrint(%client); | |
if(%client.isAIControlled()) | |
Game.AIChangeTeam(%client, %team); | |
else | |
Game.clientChangeTeam(%client, %team, %fromObs); | |
} | |
else | |
{ | |
%wait = mFloor(($WAIT_PERIOD - (getSimTime() - %client.waitStart)) / 1000); | |
messageClient(%client, "", $WAIT_MESSAGE, %wait); | |
} | |
} | |
} | |
} | |
function serverCmdClientPickedTeam(%client, %option) | |
{ | |
Parent::serverCmdClientPickedTeam(%client, %option); | |
// prevent the message to pop up (flag stats) | |
if(isEventPending($UpdateSchedule[%client])) | |
cancel($UpdateSchedule[%client]); | |
} | |
function serverCmdGetMissionTypes(%client, %key) | |
{ | |
if(%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAllowAdminVoteGameType) || $Host::EvoAllowPlayerVoteGameType) | |
{ | |
for(%type = 0; %type < $HostTypeCount; %type++) | |
messageClient(%client, 'MsgVoteItem', "", %key, %type, "", $HostTypeDisplayName[%type], true); | |
} | |
else | |
{ | |
for(%type = 0; %type < $HostTypeCount; %type++) | |
{ | |
if($HostTypeDisplayName[%type] $= $MissionTypeDisplayName) | |
{ | |
messageClient(%client, 'MsgVoteItem', "", %key, %type, "", $HostTypeDisplayName[%type], true); | |
break; | |
} | |
else | |
continue; | |
} | |
} | |
} | |
function serverCmdGetMissionList(%client, %key, %type, %tournament) | |
{ | |
if(%type < 0 || %type >= $HostTypeCount) | |
return; | |
for(%i = $HostMissionCount[%type] - 1; %i >= 0; %i--) | |
{ | |
%idx = $HostMission[%type, %i]; | |
%test = $Host::MapFFA[$HostMissionFile[%idx], $HostTypeName[%type]]; | |
// If we have bots, don't change to a mission that doesn't support bots: | |
if($HostGameBotCount > 0) | |
{ | |
if(!$BotEnabled[%idx]) | |
continue; | |
} | |
if (!%client.pizza && !$Host::TournamentMode && !%test ) | |
{ | |
continue; | |
} | |
if ((!%tournament && !$Host::TournamentMode) || (%tournament && $Host::TournamentMode)) | |
// In FFA mode, we need to filter out missions so we only show those | |
// allowed in FFA mode | |
{ | |
if ((%test !$= "") && (%test == 0)) | |
continue; | |
} | |
messageClient(%client, 'MsgVoteItem', "", %key, %idx, "", $HostMissionName[%idx], true); | |
} | |
} | |
function serverCmdStripAdmin(%client, %admin) | |
{ | |
if(!%admin.isAdmin || !%client.isAdmin) | |
return; | |
if(%client $= %admin) | |
{ | |
%admin.isAdmin = 0; | |
%admin.isSuperAdmin = 0; | |
messageClient(%admin, 'MsgStripAdminPlayer', 'You have stripped yourself of admin privledges.'); | |
if(%admin.pizza) | |
{ | |
pizzaSendHudUpdate( %game, %admin, "" ); | |
} | |
adminLog(%client, " stripped admin from " @ %admin.nameBase @ "."); | |
return; | |
} | |
else if(%client.isSuperAdmin) | |
{ | |
messageAll( 'MsgStripAdminPlayer', '\c2%1 removed %2\'s admin privledges.', %client.name, %admin.name, %admin ); | |
messageClient(%admin, 'MsgStripAdminPlayer', 'You are being stripped of your admin privledges by %1.', %client.name); | |
%admin.isAdmin = 0; | |
%admin.isSuperAdmin = 0; | |
if(%admin.pizza) | |
{ | |
pizzaSendHudUpdate( %game, %admin, "" ); | |
} | |
adminLog(%client, " stripped admin from " @ %admin.nameBase @ "."); | |
} | |
else | |
messageClient(%client, 'MsgError', '\c2Only Super Admins can use this command.'); | |
} | |
function notifyMatchEnd(%time) | |
{ | |
%seconds = mFloor(%time / 1000); | |
if(%seconds == 60) | |
{ | |
MessageAll('MsgMissionEnd', '\c2Match ends in %1 seconds.~wfx/misc/hunters_%1.wav', %seconds); | |
if(!$Host::TournamentMode && !$Host::ClassicRandomMissions && !$Host::EvoOneMapOnly) | |
MessageAll('MsgPizzaNextMission', '\c2Next Mission: \c3%1', findNextCycleMission()); | |
} | |
else if(%seconds > 1) | |
MessageAll('MsgMissionEnd', '\c2Match ends in %1 seconds.~wfx/misc/hunters_%1.wav', %seconds); | |
else if(%seconds == 1) | |
MessageAll('MsgMissionEnd', '\c2Match ends in 1 second.~wfx/misc/hunters_1.wav'); | |
UpdateClientTimes(%time); | |
} | |
function resetServerDefaults() | |
{ | |
$resettingServer = true; | |
echo( "Resetting server defaults..." ); | |
if( isObject( Game ) ) | |
Game.gameOver(); | |
// Override server defaults with prefs: | |
exec( "scripts/ServerDefaults.cs" ); | |
exec( "scripts/evo_prefs.cs" ); | |
exec( $serverprefs ); | |
$MaxPlayers = $Host::MaxPlayers; | |
$BackupPassword = $Host::Password; | |
$EvoDefaultTimeLimit = $Host::TimeLimit; | |
$EvoNoBaseRape = 1; | |
$SaveCustomMapRotation = $Host::EvoCustomMapRotation; | |
// --------------------------------------------------- | |
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here | |
//convert the team skin and name vars to tags... | |
%index = 0; | |
while ($Host::TeamSkin[%index] !$= "") | |
{ | |
$TeamSkin[%index] = addTaggedString($Host::TeamSkin[%index]); | |
%index++; | |
} | |
%index = 0; | |
while ($Host::TeamName[%index] !$= "") | |
{ | |
$TeamName[%index] = addTaggedString($Host::TeamName[%index]); | |
%index++; | |
} | |
// Get the hologram names from the prefs... | |
%index = 1; | |
while ( $Host::holoName[%index] !$= "" ) | |
{ | |
$holoName[%index] = $Host::holoName[%index]; | |
%index++; | |
} | |
// --------------------------------------------------- | |
// kick all bots... | |
removeAllBots(); | |
// add bots back if they were there before.. | |
if( $Host::botsEnabled ) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here | |
initGameBots( $Host::Map, $Host::MissionType ); | |
// load the missions | |
loadMission( $Host::Map, $Host::MissionType ); | |
$resettingServer = false; | |
echo( "Server reset complete." ); | |
} | |
function FullServerPW(%val) | |
{ | |
if(%val && ($Host::EvoFullServerPWPassword !$= "changeit")) | |
{ | |
$Host::Password = $Host::EvoFullServerPWPassword; | |
$Host::MaxPlayers += $Host::EvoFullServerPWAddAllowed; | |
} | |
else if($BackupPassword !$= "") | |
{ | |
$Host::Password = $BackupPassword; // if there was one, restore the old password | |
$Host::MaxPlayers = $MaxPlayers; // restore the max players allowed | |
} | |
else | |
{ | |
$Host::Password = ""; | |
$Host::MaxPlayers = $MaxPlayers; | |
} | |
} | |
function serverCmdFullServerPWSetup(%client, %type, %val) | |
{ | |
%type = detag(%type); | |
%val = detag(%val); | |
if(!%client.isSuperAdmin) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use this command.'); | |
return; | |
} | |
if(%type $= "") | |
{ | |
messageClient(%client, 'MsgTypeFailed', '\c2No Changes. You did not supply a type.'); | |
return; | |
} | |
switch$ (%type) | |
{ | |
case "fullserverpw": | |
if(%val $= "0") | |
{ | |
$Host::EvoFullServerPWEnabled = 0; | |
FullServerPW(0); | |
%msg = "\c2Full Server Password disabled."; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isSuperAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
%adminmsg = " DISABLED Full Server Password."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " disabled Full Server Password."); | |
} | |
else if (%val $= "1") | |
{ | |
$Host::EvoFullServerPWEnabled = 1; | |
%msg = "\c2Full Server Password enabled."; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.pizza && %cl.isAdmin) | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
%adminmsg = " ENABLED Full Server Password."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " enabled Full Server Password."); | |
} | |
else | |
messageClient( %client, 'MsgAdmin', '\c2Unknown value. 0 disables Full Server Password, 1 enables Full Server Password.' ); | |
case "fullserverpwpass": | |
if(%val !$= "" && %val !$= "changeit") | |
{ | |
$Host::EvoFullServerPWPassword = %val; | |
} | |
else if(%val $= "changeit") | |
{ | |
messageClient(%client, 'MsgPasswordFailed', '\c2Illegal PW. Please choose another password.'); | |
return; | |
} | |
else | |
{ | |
messageClient(%client, 'MsgAdmin', '\c2You must specify a password.'); | |
return; | |
} | |
export("$Host::*", $serverprefs, false); | |
messageClient(%client, 'MsgServerPassword', '\c2Full Server Password PW changed to: \c3%1\c2.', %val); | |
%adminmsg = " changed the Full Server Password PW to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the Full Server Password PW."); | |
case "fullserverpwadd": | |
if(isNumber(%val) && (%val !$= "") && (%val > 0)) | |
{ | |
$Host::EvoFullServerPWAddAllowed = %val; | |
} | |
else | |
{ | |
messageClient(%client, 'MsgAdmin', '\c2You must specify a numerical value.'); | |
return; | |
} | |
export("$Host::*", $serverprefs, false); | |
messageClient(%client, 'MsgServerPassword', '\c2Full Server Password player count changed to: \c3%1\c2.', %val); | |
%adminmsg = " changed the Full Server Password player count to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the Full Server Password player count."); | |
} | |
} | |
function serverCmdNBRSetup(%client, %type, %val) | |
{ | |
%type = detag(%type); | |
%val = detag(%val); | |
if(!%client.isSuperAdmin) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use this command.'); | |
return; | |
} | |
if(%type $= "") | |
{ | |
messageClient(%client, 'MsgTypeFailed', '\c2No Changes. You did not supply a type.'); | |
return; | |
} | |
switch$ (%type) | |
{ | |
case "NoBaseRape": | |
if(%val $= "0") | |
{ | |
$Host::EvoNoBaseRapeEnabled = 0; | |
$EvoNoBaseRape = 0; | |
%msg = "\c2NO BASE RAPE DISABLED.~wfx/misc/diagnostic_on.wav"; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(!%cl.pizza) | |
messageClient(%cl, 'MsgAdmin', '\c2NO BASE RAPE DISABLED.~wfx/misc/diagnostic_on.wav'); | |
else | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
%adminmsg = " DISABLED No Base Rape."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " disabled No Base Rape."); | |
} | |
else if (%val $= "1") | |
{ | |
$Host::EvoNoBaseRapeEnabled = 1; | |
if(!$Host::TournamentMode && ($HostGamePlayerCount < $Host::EvoNoBaseRapePlayerCount)) | |
$EvoNoBaseRape = 1; | |
%msg = "\c2NO BASE RAPE ENABLED.~wfx/misc/diagnostic_on.wav"; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(!%cl.pizza) | |
messageClient(%cl, 'MsgAdmin', '\c2NO BASE RAPE ENABLED.~wfx/misc/diagnostic_on.wav'); | |
else | |
sendPizzaHudUpdate(%game, %cl, %msg); | |
} | |
%adminmsg = " ENABLED No Base Rape."; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " enabled No Base Rape."); | |
} | |
else | |
messageClient( %client, 'MsgAdmin', '\c2Unknown value. 0 disables No Base Rape, 1 enables No Base Rape.' ); | |
case "NoBaseRapeBase": | |
if(isNumber(%val) && (%val !$= "") && (%val > 0)) | |
{ | |
$Host::EvoNoBaseRapePlayerCount = %val; | |
} | |
else | |
{ | |
messageClient( %client, 'MsgAdmin', '\c2You must specify a numerical value.' ); | |
return; | |
} | |
if(!$Host::TournamentMode && ($HostGamePlayerCount < $Host::EvoNoBaseRapePlayerCount)) | |
$EvoNoBaseRape = 1; | |
else | |
$EvoNoBaseRape = 0; | |
export("$Host::*", $serverprefs, false); | |
messageClient(%client, 'MsgServerPassword', '\c2No Base Rape min base players count changed to: \c3%1\c2.', %val); | |
%adminmsg = " changed the No Base Rape Min Base player count to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the No Base Rape Min Base player count."); | |
case "NoBaseRapeClassic": | |
if(isNumber(%val) && (%val !$= "") && (%val > 0)) | |
{ | |
$Host::EvoNoBaseRapeClassicPlayerCount = %val; | |
} | |
else | |
{ | |
messageClient( %client, 'MsgAdmin', '\c2You must specify a numerical value.' ); | |
return; | |
} | |
export("$Host::*", $serverprefs, false); | |
messageClient(%client, 'MsgServerPassword', '\c2No Base Rape min classic players count changed to: \c3%1\c2.', %val); | |
%adminmsg = " changed the No Base Rape Min Classic player count to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the No Base Rape Min Classic player count."); | |
} | |
} | |
function serverCmdAddMap(%client, %map) | |
{ | |
%map = detag(%map); | |
if(%client.isSuperAdmin) | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2This command has been disabled. (edit evo_mapRotation.cs)'); | |
else | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use this command.'); | |
} | |
function serverCmdRemoveMap(%client, %map) | |
{ | |
%map = detag(%map); | |
if(%client.isSuperAdmin) | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2This command has been disabled. (edit evo_mapRotation.cs)'); | |
else | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use this command.'); | |
} | |
function serverCmdAddType(%client, %type) | |
{ | |
%type = detag(%type); | |
if(%client.isSuperAdmin) | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2This command has been disabled. (edit evo_mapRotation.cs)'); | |
else | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use this command.'); | |
} | |
function serverCmdRemoveType(%client, %type) | |
{ | |
%type = detag(%type); | |
if(%client.isSuperAdmin) | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2This command has been disabled. (edit evo_mapRotation.cs)'); | |
else | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Super Admins can use this command.'); | |
} | |
function serverCmdSetMaxPlayers(%client, %val) | |
{ | |
%val = detag(%val); | |
if(!%client.isAdmin) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2Only Admins can use this command.'); | |
return; | |
} | |
if(!%client.isSuperAdmin && %client.isAdmin && !$Host::EvoAdminMaxPlayers) | |
{ | |
messageClient(%client, 'MsgNotSuperAdmin', '\c2This function is disabled.'); | |
return; | |
} | |
if(isNumber(%val) && (%val > 0)) | |
{ | |
$Host::MaxPlayers = %val; | |
export( "$Host::*", $serverprefs, false ); | |
messageAll( 'MsgMaxPlayersSet', '\c3%1\c2: PLAYER LIMIT CHANGED TO: \c3%2\c2.~wfx/misc/diagnostic_on.wav', %client.name, %val); | |
%adminmsg = " changed the player limit to " @ %val; | |
adminLog(%client, %adminmsg); | |
logEcho(%client.nameBase @ " changed the player limit."); | |
} | |
else | |
messageClient( %client, 'MsgAdmin', '\c2Value must be a positive number.' ); | |
} | |
function serverCmdWhois(%client, %target) | |
{ | |
if((%client.isAdmin && $Host::EvoAdminWhois) || (%client.isSuperAdmin && $Host::EvoSuperAdminWhois)) | |
{ | |
if(%target.isSuperAdmin && $Host::EvoBlockSuperAdminWhois) | |
{ | |
messageClient(%sender, 'MsgPizzaWhois', '\c2Whois disabled with Super Admins.'); | |
return; | |
} | |
%authInfo = %target.getAuthInfo(); | |
messageClient(%client, 'MsgPizzaWhois', 'NAME: %1, REALNAME: %2, CLAN: %3, GUID: %4, CLIENT: %5, %6', %target.name, getField(%authInfo, 0), getField(%authInfo, 1), %target.guid, %target.client, %target.getAddress()); | |
} | |
} | |
function serverCmdMakePlayerSuperAdmin(%client, %target) | |
{ | |
if(%client.isSuperAdmin && $Host::EvoSuperAdminSuper && !%target.isSuperAdmin && !%target.isAIControlled()) | |
{ | |
messageAll('MsgSuperAdminPlayer', '\c2%3 made %2 a Super Admin.', %target, %target.name, %client.name); | |
%target.isAdmin = true; | |
%target.isSuperAdmin = true; | |
if ( %target.pizza ) | |
{ | |
pizzaSendHudUpdate( %game, %target, "" ); | |
} | |
%authInfo = %target.getAuthInfo(); | |
adminLog(%client, " made " @ %target.nameBase @ "( " @ getField(%authInfo, 0) @ ", " @ getField(%authInfo, 1) @ ", " @ %target.guid @ ", " @ %target.getAddress() @ ") a Super Admin."); | |
} | |
} | |
function serverCmdRegisterPizzaClient(%client) | |
{ | |
if(!%client.pizza) | |
{ | |
%client.pizza = true; | |
%msg = "\c2Pizza Client registered."; | |
sendPizzaHudUpdate(%game, %client, %msg); | |
} | |
} | |
function serverCmdTriconRegisterClient( %client, %version ) | |
{ | |
if (!%client.tricon) | |
{ | |
%client.tricon = 1; | |
%client.triconversion = %version; | |
} | |
} | |
function serverCmdToggleBottomPrint(%client, %val) | |
{ | |
%val = %val == 0 ? 2 : 1; | |
%client.showMA = %val; | |
} | |
function sendPizzaHudUpdate(%game, %client, %msg) | |
{ | |
%pizzaOptMask = 0; | |
if($RandomTeams == 1) %pizzaOptMask += 1; | |
if($Host::ClassicFairTeams == 1) %pizzaOptMask += 2; | |
if($Host::ClassicAutoPWEnabled == 1) %pizzaOptMask += 4; | |
if($Host::EvoFullServerPWEnabled == 1) %pizzaOptMask += 8; | |
if($Host::EvoNoBaseRapeEnabled == 1) %pizzaOptMask += 16; | |
if($PizzaHudRestartVar == 1) %pizzaOptMask += 32; | |
messageClient(%client, 'UpdatePizzaHud', %msg, %pizzaOptMask, %client.isAdmin + %client.isSuperAdmin); | |
} | |
function reallyQuit() | |
{ | |
deleteDso(); | |
quit(); | |
} | |
function serverCmdGetScores(%client) | |
{ | |
if(isObject(Game)) | |
{ | |
updateScores(); | |
%teamCount = Game.numTeams; | |
if(%teamCount > 1) | |
{ | |
// Send team messages: | |
for(%team = 1; %team <= %teamCount; %team++) | |
messageClient(%client, 'MsgTeamScore', "", %team, $teamScore[%team]); | |
//send the player scores in order of their team rank... | |
for(%team = 1; %team <= %teamCount; %team++) | |
{ | |
for(%i = 0; %i < $TeamRank[%team, count]; %i++) | |
{ | |
%cl = $TeamRank[%team, %i]; | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores && %cl.score >= 0 && game.class !$= "TeamHuntersGame") | |
messageClient(%client, 'MsgPlayerScore', "", %cl, 0, %cl.getPing(), %cl.getPacketLoss()); | |
else | |
messageClient(%client, 'MsgPlayerScore', "", %cl, %cl.score, %cl.getPing(), %cl.getPacketLoss()); | |
} | |
} | |
} | |
else | |
{ | |
//send the player scores in order of their rank... | |
for(%i = 0; %i < $TeamRank[0, count]; %i++) | |
{ | |
%cl = $TeamRank[0, %i]; | |
messageClient( %client, 'MsgPlayerScore', "", %cl, %cl.score, %cl.getPing(), %cl.getPacketLoss()); | |
} | |
} | |
//now send the observers over | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0) | |
{ | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores && %cl.score >= 0 && game.class !$= "TeamHuntersGame") | |
messageClient(%client, 'MsgPlayerScore', "", %cl, 0, %cl.getPing(), %cl.getPacketLoss()); | |
else | |
messageClient(%client, 'MsgPlayerScore', "", %cl, %cl.score, %cl.getPing(), %cl.getPacketLoss()); | |
} | |
} | |
} | |
} | |
function ProjectileData::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal) | |
{ | |
if(isObject(%targetObject)) // Console spam fix. | |
{ | |
// call the function | |
if(!$Host::TournamentMode || ($Host::TournamentMode && $Host::EvoStatsTourney)) | |
handleMAStat(%data, %projectile, %targetObject, %modifier, %position, %normal); | |
} | |
Parent::onCollision( %data, %projectile, %targetObject, %modifier, %position, %normal ); | |
} | |
function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC) | |
{ | |
Parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC); | |
// call the function | |
if(!$Host::TournamentMode || ($Host::TournamentMode && $Host::EvoStatsTourney)) | |
handleDamageStat(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC); | |
} | |
function chatMessageTeam(%sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10) | |
{ | |
if ( %sender.SinBinned && $Host::EvoMuteSinBin ) | |
return; | |
if(!$Host::TournamentMode || !$Host::EvoTeamSpam) | |
if((%msgString $= "") || spamAlert(%sender)) | |
return; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%obj = ClientGroup.getObject(%i); | |
if(%obj.team == %sender.team) | |
chatMessageClient(%obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); | |
} | |
// don't log team chat in tournament mode | |
if(!$Host::TournamentMode) | |
{ | |
if ($Host::EvoChatLogging) | |
{ | |
chatLog(%sender, %a2, true); | |
} | |
if ($Host::EvoTCMessages) | |
{ | |
echo( "TM2_CHATTEAM: " @ %sender.namebase @ "\"" @ %a2 @ "\""); | |
} | |
} | |
} | |
function cannedChatMessageTeam(%sender, %team, %msgString, %name, %string, %keys) | |
{ | |
if ( %sender.SinBinned && $Host::EvoMuteSinBin ) | |
return; | |
if(!$Host::TournamentMode || !$Host::EvoTeamCannedSpam) | |
if((%msgString $= "") || spamAlert(%sender)) | |
return; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%obj = ClientGroup.getObject( %i ); | |
if(%obj.team == %sender.team) | |
cannedChatMessageClient(%obj, %sender, %msgString, %name, %string, %keys); | |
} | |
// don't log team chat in tournament mode | |
if(!$Host::TournamentMode) | |
{ | |
if ($Host::EvoCannedChatLogging) | |
{ | |
chatLog(%sender, getSubStr(%string, 0, strstr(%string, "~w")), true); | |
} | |
if ( $Host::EvoTCCannedMessages ) | |
{ | |
echo("TM2_CHATTEAM: " @ %sender.namebase @ " \"" @ | |
getSubStr( %string, 0, strstr(%string, "~w")) @ "\""); | |
} | |
} | |
} | |
function chatMessageAll(%sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10) | |
{ | |
if ( %sender.SinBinned && $Host::EvoMuteSinBin ) | |
return; | |
if ( ( %a2 !$= "" ) && ( ( strstr(%a2, ".") == 0 ) || ( strstr(%a2, "%") == 0 ) ) ) | |
// bwadmin style admin commands | |
{ | |
if ( $Host::EvoChatConsole ) | |
{ | |
EvoParseCommands( %sender, %a2 ); | |
} | |
else | |
{ | |
messageClient( %sender, 'EvoCon', 'Evolution Chat Console is not enabled.~wfx/misc/misc.error.wav'); | |
} | |
// If ChatConsole is not enabled, suppress commands to not | |
// reveal passwords accidentially | |
return; | |
} | |
if ( ( %msgString $= "" ) || ( spamAlert(%sender) ) ) | |
return; | |
// admins can chat anyway | |
if(!%sender.isAdmin) | |
{ | |
// no-spam in tournament mode | |
if($Host::TournamentMode) | |
{ | |
// match is not started yet | |
if(!$matchStarted) | |
{ | |
// we don't want players to chat | |
if(!$Host::EvoPreMatchSpamAllowed) | |
{ | |
messageClient(%sender, '', '\c2No Pre-Match Spam allowed.'); | |
return; | |
} | |
// if it's a spam, and canned chat is not allowed, remove the sound | |
if(strstr(%a2, "~w") != -1 && !$Host::EvoPreMatchCannedSpamAllowed) | |
%a2 = getSubStr(%a2, 0, strstr(%a2, "~w")); | |
} | |
else // the match is already started | |
{ | |
// we don't want players to chat | |
if(!$Host::EvoSpamAllowed) | |
{ | |
messageClient(%sender, '', '\c2No Match Spam allowed.'); | |
return; | |
} | |
// if it's a spam, and canned chat is not allowed, remove the sound | |
if(strstr(%a2, "~w") != -1 && !$Host::EvoCannedSpamAllowed) | |
%a2 = getSubStr(%a2, 0, strstr(%a2, "~w")); | |
} | |
} | |
} | |
// Is FX spam allowed? | |
if(strstr(%a2, "~wfx") != -1 && $Host::EvoMuteSpamFX) | |
%a2 = getSubStr(%a2, 0, strstr(%a2, "~w")); | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
// Allow observer global chat to be seen by all, not just admins and other observers | |
chatMessageClient(ClientGroup.getObject(%i), %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); | |
// log the message | |
if($Host::EvoChatLogging) | |
chatLog(%sender, %a2, false); | |
if ($Host::EvoTCMessages) | |
{ | |
echo( "TM2_CHAT: " @ %sender.namebase @ " \"" @ %a2 @ "\""); | |
} | |
} | |
function cannedChatMessageAll(%sender, %msgString, %name, %string, %keys) | |
{ | |
if ( %sender.SinBinned && $Host::EvoMuteSinBin ) | |
return; | |
if((%msgString $= "") || spamAlert(%sender)) | |
return; | |
// admins can chat anyway | |
if(!%sender.isAdmin && $Host::TournamentMode) | |
{ | |
// match is not started yet | |
if(!$matchStarted) | |
{ | |
if(!$Host::EvoPreMatchCannedSpamAllowed) | |
{ | |
messageClient(%sender, '', '\c2No Pre-Match Spam allowed.'); | |
return; | |
} | |
} | |
else // match is already started | |
{ | |
if(!$Host::EvoCannedSpamAllowed) | |
{ | |
messageClient(%sender, '', '\c2No Match Spam allowed.'); | |
return; | |
} | |
} | |
} | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
cannedChatMessageClient(ClientGroup.getObject(%i), %sender, %msgString, %name, %string, %keys); | |
// log the message | |
if($Host::EvoCannedChatLogging) | |
chatLog(%sender, getSubStr(%string, 0, strstr(%string, "~w")), false); | |
if ($Host::EvoTCCannedMessages) | |
{ | |
echo( "TM2_CHAT: " @ %sender.namebase @ " \"" @ | |
getSubStr(%string, 0, strstr(%string, "~w")) @ "\""); | |
} | |
} | |
function sendModInfoToClient(%client) | |
{ | |
%time = "<color:D2C27F>Time limit: <color:29DEE7>" @ $Host::TimeLimit; | |
%max = "<color:D2C27F>Max players: <color:29DEE7>" @ $Host::MaxPlayers; | |
%td = "<color:D2C27F>Team damage: <color:29DEE7>" @ ($Host::TeamDamageOn ? "On" : "Off"); | |
%crc = "<color:D2C27F>CRC checking: <color:29DEE7>" @ ($Host::CRCTextures ? "On" : "Off"); | |
%pure = "<color:D2C27F>Pure server: <color:29DEE7>" @ ($Host::PureServer ? "On" : "Off"); | |
%smurf = "<color:D2C27F>Refuse smurfs: <color:29DEE7>" @ ($Host::NoSmurfs ? "On" : "Off"); | |
%random = "<color:D2C27F>Random teams: <color:29DEE7>" @ ($RandomTeams ? "On" : "Off"); | |
%fair = "<color:D2C27F>Fair teams: <color:29DEE7>" @ ($Host::ClassicFairTeams ? "On" : "Off"); | |
%rape = "<color:D2C27F>No Base Rape: <color:29DEE7>" @ ($Host::EvoNoBaseRapeEnabled ? "On" : "Off"); | |
%net = "<color:D2C27F>Packets Rate / Size: <color:29DEE7>" @ $pref::Net::PacketRateToClient @ " / " @ $pref::Net::PacketSize; | |
if($Host::EvoStats && (!$Host::TournamentMode || ($Host::TournamentMode && $Host::EvoStatsTourney)) && $Host::EvoStatsType != 0) | |
%stats = "<color:D2C27F>Stats based on: <color:29DEE7>" @ ($Host::EvoStatsType == 1 ? "Kills" : "Damage"); | |
if($Host::EvoNoBaseRapeEnabled) | |
%rapeppl = "<color:D2C27F>No Base Rape Min players: <color:29DEE7>" @ $Host::EvoNoBaseRapeClassicPlayerCount; | |
if($Evo::ETMMode && $ETMmode::CurrentMap <= $ETMmode::Counter) | |
{ | |
%nmis = "<color:D2C27F>Next mission: <color:29DEE7>" @ $ETMmode::MapDisplayName[$ETMmode::CurrentMap]; | |
} | |
else | |
{ | |
%nmis = "<color:D2C27F>Next mission: <color:29DEE7>" @ findNextCycleMission(); | |
if ( $Host::ClassicRandomMissions ) | |
{ | |
%nmis = %nmis SPC "(Random)"; | |
} | |
} | |
// classic doesn't use a variable to print the version, it needs to be edited manually | |
%modName = "Classic " @ $classicVersion @ " running Classic Evolution Admin Mod " @ $EvoVersion; | |
%ModLine[0] = "<spush><font:Arial:14><a:www.triben.de><color:5555FF>http://www.triben.de</a><spop>\n<color:D2C27F>Classic Developers: <color:29DEE7><a:PLAYER\tz0dd>z0dd</a> and <a:PLAYER\t-ZOD->ZOD</a>"; | |
%ModCnt = 1; | |
%SpecialCnt = 5; | |
%SpecialTextLine[0] = %random; | |
%SpecialTextLine[1] = %fair; | |
%SpecialTextLine[2] = %net; | |
%SpecialTextLine[3] = %stats; | |
%SpecialTextLine[4] = %nmis; | |
%ServerCnt = 8; | |
%ServerTextLine[0] = %time; | |
%ServerTextLine[1] = %max; | |
%ServerTextLine[2] = %td; | |
%serverTextLine[3] = %crc; | |
%ServerTextLine[4] = %pure; | |
%ServerTextLine[5] = %smurf; | |
%ServerTextLine[6] = %rape; | |
%ServerTextLine[7] = %rapeppl; | |
%singlePlayer = $CurrentMissionType $= "SinglePlayer"; | |
messageClient(%client, 'MsgLoadInfo', "", $CurrentMission, %modName, $Host::GameName); | |
// Send mod details (non bulleted list, small text): | |
for(%line = 0; %line < %ModCnt; %line++) | |
if(%ModLine[%line] !$= "") | |
messageClient(%client, 'MsgLoadQuoteLine', "", %ModLine[%line]); | |
// Send mod special settings (bulleted list, large text): | |
for(%line = 0; %line < %SpecialCnt; %line++) | |
if(%SpecialTextLine[%line] !$= "") | |
messageClient(%client, 'MsgLoadObjectiveLine', "", %SpecialTextLine[%line], !%singlePlayer); | |
// Send server info: | |
if(!%singlePlayer) | |
messageClient(%client, 'MsgLoadRulesLine', "", "<color:29DEE7>" @ $Host::Info, false); | |
for(%line = 0; %line < %ServerCnt; %line++) | |
if (%ServerTextLine[%line] !$= "") | |
messageClient(%client, 'MsgLoadRulesLine', "", %ServerTextLine[%line], !%singlePlayer); | |
messageClient(%client, 'MsgLoadInfoDone'); | |
// z0dd - ZOD, 5/12/02. Send mission info again so as not to conflict with cs scripts. | |
schedule(10000, 0, "sendLoadInfoToClient", %client, true); | |
} | |
function HuntersGame::sendDebriefing(%game, %client) | |
{ | |
// Mission result: | |
if($TeamRank[0, 0].score > 0) | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>%1 wins with a score of %2!', $TeamRank[0, 0].name, $TeamRank[0, 0].score); | |
else | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Nobody wins!'); | |
if(%game.highestFlagReturnName !$= "") | |
messageClient(%client, 'MsgDebriefResult', "", '<spush><color:3cb4b4><font:univers condensed:18>%1 had the highest return count with %2 flags!<spop>', %game.highestFlagReturnName, %game.highestFlagReturnCount); | |
if($Host::HuntersRecords::Count[$currentMission] !$= "" && $Host::HuntersRecords::Name[$currentMission] !$= "") | |
messageClient(%client, 'MsgDebriefResult', "", '<spush><color:3cb4b4><font:univers condensed:18>%1 holds the record with a return count of %2 flags!<spop>', $Host::HuntersRecords::Name[$currentMission], $Host::HuntersRecords::Count[$currentMission]); | |
if(%game.greedFlagName !$= "") | |
messageClient(%client, 'MsgDebriefResult', "", '<spush><color:3cb4b4><font:univers condensed:18>%1 gets the honorary greed award for dropping %2 flags!<spop>', %game.greedFlagName, %game.greedFlagCount); | |
// send client the stats | |
if ( $Host::EvoStatsPosition == 0 ) | |
sendEvoDebriefing(%client); | |
// Player scores: | |
messageClient(%client, 'MsgDebriefAddLine', "", '\n<lmargin:0><spush><color:00dc00><font:univers condensed:18>PLAYER<lmargin%%:60>SCORE<lmargin%%:80>KILLS<spop>'); | |
%count = $TeamRank[0, count]; | |
for(%i = 0; %i < %count; %i++) | |
{ | |
%cl = $TeamRank[0, %i]; | |
if(%cl.score $= "") | |
%score = 0; | |
else | |
%score = %cl.score; | |
if(%cl.kills $= "") | |
%kills = 0; | |
else | |
%kills = %cl.kills; | |
messageClient(%client, 'MsgDebriefAddLine', "", '<lmargin:0><clip%%:60> %1</clip><lmargin%%:60><clip%%:20> %2</clip><lmargin%%:80><clip%%:20> %3</clip>', %cl.name, %score, %kills); | |
} | |
// Show observers: | |
%header = false; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0) | |
{ | |
if(!%header) | |
{ | |
messageClient(%client, 'MsgDebriefAddLine', "", '\n<lmargin:0><spush><font:univers condensed:18><color:00dc00>OBSERVERS<lmargin%%:60>SCORE<spop>'); | |
%header = true; | |
} | |
%score = %cl.score $= "" ? 0 : %cl.score; | |
messageClient(%client, 'MsgDebriefAddLine', "", '<lmargin:0><clip%%:60> %1</clip><lmargin%%:60><clip%%:40> %2</clip>', %cl.name, %score); | |
} | |
} | |
// send client the stats after the scores | |
if($Host::EvoStatsPosition == 1) | |
sendEvoDebriefing(%client); | |
} | |
function displayObserverHud(%client, %targetClient, %potentialClient) | |
{ | |
%targName = getTaggedString(%targetClient.name); | |
%potName = getTaggedString(%potentialClient.name); | |
%targTeam = getTaggedString(Game.getTeamName(%targetClient.team)); | |
%potTeam = getTaggedString(Game.getTeamName(%potentialClient.team)); | |
if(Game.numTeams > 1) // if there are two or more teams | |
{ | |
if(%targetClient > 0) | |
{ | |
if(%targetClient.team == 1) | |
bottomPrint(%client, "<color:0000FF>You are now observing:\n" @ %targName @ "\nTeam: " @ %targTeam, 0, 3); | |
else | |
bottomPrint(%client, "<color:FFFF00>You are now observing:\n" @ %targName @ "\nTeam: " @ %targTeam, 0, 3); | |
} | |
else if(%potentialClient > 0) | |
{ | |
if(%potentialClient.team == 1) | |
bottomPrint(%client, "<color:0000FF>Observer Fly Mode\n" @ %potName @ "\nTeam: " @ %potTeam, 0, 3); | |
else | |
bottomPrint(%client, "<color:FFFF00>Observer Fly Mode\n" @ %potName @ "\nTeam: " @ %potTeam, 0, 3); | |
} | |
else | |
clearBottomPrint(%client); // remove "Observer Fly Mode" message | |
} | |
else // else use the standard one | |
{ | |
if(%targetClient > 0) | |
bottomPrint(%client, "\nYou are now observing: " @ %targName, 0, 3); | |
else if(%potentialClient > 0) | |
bottomPrint(%client, "\nObserver Fly Mode\n" @ %potName, 0, 3); | |
else | |
clearBottomPrint(%client); // remove "Observer Fly Mode" message | |
} | |
} | |
function DnDGame::getTeamName(%game, %team) | |
{ | |
if ( $Evo::ThisMission::TeamName[%team] ) | |
{ | |
return $Evo::ThisMission::TeamName[%team]; | |
} | |
if($Evo::ETMMode && %team != 0) | |
return $ETMmode::Team[$ETMCMap, %team]; | |
return parent::getTeamName( %game, %team ); | |
} | |
function DefaultGame::clientMissionDropReady(%game, %client) | |
{ | |
Parent::clientMissionDropReady(%game, %client); | |
$Evo::stats::tk[%client] = ""; | |
%client.midairs = 0; | |
%client.BlaMA = 0; | |
%client.PlaMA = 0; | |
%client.hs = ""; | |
for(%i = 1; %i <= 13; %i++) | |
$Evo::stats::weapon_damage[%client, %i] = ""; | |
} | |
function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation) | |
{ | |
Parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); | |
// call the function | |
if(!$Host::TournamentMode || ($Host::TournamentMode && $Host::EvoStatsTourney)) | |
handleKillStat(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); | |
} | |
function DefaultGame::gameOver(%game) | |
{ | |
Parent::gameOver(%game); | |
if($Evo::ETMMode) | |
{ | |
// wait to delete variables | |
if($ETMCMap == $ETMmode::Counter && !$ETMCMapUpdated) | |
{ | |
$Evo::ETMMode = false; | |
ETMreset(); | |
} | |
$ETMCMapUpdated = ""; | |
} | |
} | |
function DefaultGame::getTeamName(%game, %team) | |
{ | |
if ( $Evo::ThisMission::TeamName[%team] ) | |
{ | |
return $Evo::ThisMission::TeamName[%team]; | |
} | |
if($Evo::ETMMode && %game.numTeams > 1 && %team != 0) | |
return $ETMmode::Team[$ETMCMap, %team]; | |
return parent::getTeamName( %game, %team ); | |
return $TeamName[%team]; | |
} | |
function DefaultGame::assignClientTeam(%game, %client, %respawn ) | |
{ | |
%numPlayers = ClientGroup.getCount(); | |
for(%i = 0; %i <= %game.numTeams; %i++) | |
%numTeamPlayers[%i] = 0; | |
for(%i = 0; %i < %numPlayers; %i = %i + 1) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl != %client) | |
%numTeamPlayers[%cl.team]++; | |
} | |
if ( $Evo::ThisMission::ClanLockActive && !$Host::TournamentMode ) | |
{ | |
%numTeamPlayers[ $Evo::ThisMission::ClanLockTeam ] = 255; | |
} | |
%leastPlayers = %numTeamPlayers[1]; | |
%leastTeam = 1; | |
for(%i = 2; %i <= %game.numTeams; %i++) | |
{ | |
if( (%numTeamPlayers[%i] < %leastPlayers) || | |
( (%numTeamPlayers[%i] == %leastPlayers) && | |
($teamScore[%i] < $teamScore[%leastTeam] ) )) | |
{ | |
%leastTeam = %i; | |
%leastPlayers = %numTeamPlayers[%i]; | |
} | |
} | |
if ($Evo::ThisMission::ClanLockActive && !$Host::TournamentMode && EvoIsClientInClan( %client, $Evo::ThisMission::ClanLockClan )) | |
{ | |
%client.team = $Evo::ThisMission::ClanLockTeam; | |
%client.lastTeam = $Evo::ThisMission::ClanLockTeam; | |
} | |
else | |
{ | |
%client.team = %leastTeam; | |
%client.lastTeam = %leastTeam; | |
} | |
// Assign the team skin: | |
if ( %client.isAIControlled() ) | |
{ | |
if ( %leastTeam & 1 ) | |
{ | |
%client.skin = addTaggedString( "basebot" ); | |
setTargetSkin( %client.target, 'basebot' ); | |
} | |
else | |
{ | |
%client.skin = addTaggedString( "basebbot" ); | |
setTargetSkin( %client.target, 'basebbot' ); | |
} | |
} | |
else | |
setTargetSkin( %client.target, %game.getTeamSkin(%client.team) ); | |
if ( %respawn ) | |
{ | |
%game.spawnPlayer( %client, %respawn ); | |
} | |
messageAllExcept( %client, -1, 'MsgClientJoinTeam', '\c1%1 joined %2.', %client.name, %game.getTeamName(%client.team), %client, %client.team ); | |
messageClient( %client, 'MsgClientJoinTeam', '\c1You joined the %2 team.', %client.name, %game.getTeamName(%client.team), %client, %client.team ); | |
updateCanListenState( %client ); | |
// zodd - ZOD, 5/27/03. Setup armor max counts | |
countArmorAllowed(); | |
logEcho(%client.nameBase@" (cl "@%client@") joined team "@%client.team); | |
} | |
function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn ) | |
{ | |
if ( %team < 1 || %team > %game.numTeams ) | |
return; | |
if( %respawn $= "" ) | |
%respawn = 1; | |
if ( $Evo::ThisMission::ClanLockActive && !$Host::TournamentMode ) | |
{ | |
if (( %team == $Evo::ThisMission::ClanLockTeam) && (!EvoIsClientInClan( %client, $Evo::ThisMission::ClanLockClan))) | |
{ | |
%game.assignClientTeam( %client, %respawn ); | |
return; | |
} | |
} | |
Parent::clientJoinTeam( %game, %client, %team, %respawn ); | |
} | |
function DefaultGame::clientMissionDropReady(%game, %client) | |
{ | |
//synchronize the clock HUD | |
messageClient(%client, 'MsgSystemClock', "", 0, 0); | |
%game.sendClientTeamList(%client); | |
%game.setupClientHuds(%client); | |
if($CurrentMissionType $= "SinglePlayer") | |
return; | |
%observer = false; | |
if(!$Host::TournamentMode) | |
{ | |
if(%client.camera.mode $= "observerFly" || %client.camera.mode $= "justJoined") | |
{ | |
%observer = true; | |
%client.observingFlag = false; | |
%client.flagObserved = ""; | |
%client.flagObsTeam = ""; | |
%client.observerStartTime = getSimTime(); | |
commandToClient(%client, 'setHudMode', 'Observer'); | |
%client.setControlObject( %client.camera ); | |
// Check if the stats are enabled and if the mission type is Capture the Flag | |
if($Host::EvoStats && $CurrentMissionType $= "CTF") | |
{ | |
// updateObserverFlyHud override the stats bottomprint, so i will execute it later | |
$UpdateSchedule[%client] = schedule(10000, %client, updateObserverFlyHud, %client); | |
// Team 1 stats | |
%nickTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::nickTeam1 : "N/A"); | |
%realTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::realTeam1 : "N/A"); | |
// Team 2 stats | |
%nickTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::nickTeam2 : "N/A"); | |
%realTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::realTeam2 : "N/A"); | |
// Send the message | |
BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 10, 3); | |
} | |
else | |
updateObserverFlyHud(%client); | |
} | |
if(!%observer) | |
{ | |
// Check if the stats are enabled and if the mission type is Capture the flag | |
if($Host::EvoStats && $CurrentMissionType $= "CTF") | |
{ | |
// Team 1 stats | |
%nickTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::nickTeam1 : "N/A"); | |
%realTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::realTeam1 : "N/A"); | |
// Team 2 stats | |
%nickTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::nickTeam2 : "N/A"); | |
%realTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::realTeam2 : "N/A"); | |
// Send the message | |
BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 10, 3); | |
} | |
if(!$MatchStarted && !$CountdownStarted) // server has not started anything yet | |
{ | |
%client.setControlObject(%client.camera); | |
commandToClient(%client, 'setHudMode', 'Observer'); | |
} | |
else if(!$MatchStarted && $CountdownStarted) // server has started the countdown | |
{ | |
commandToClient(%client, 'setHudMode', 'Observer'); | |
%client.setControlObject(%client.camera); | |
} | |
else | |
{ | |
commandToClient(%client, 'setHudMode', 'Standard'); // the game has already started | |
%client.setControlObject(%client.player); | |
} | |
} | |
} | |
else | |
{ | |
// set all players into obs mode. setting the control object will handle further procedures... | |
%client.camera.getDataBlock().setMode(%client.camera, "ObserverFly"); | |
commandToClient(%client, 'setHudMode', 'Observer'); | |
%client.setControlObject(%client.camera); | |
messageAll('MsgClientJoinTeam', "",%client.name, $teamName[0], %client, 0); | |
%client.team = 0; | |
// TeamMe Message | |
if($Host::EvoTeamMeMsg) | |
{ | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.isAdmin && ($MatchStarted || $CountdownStarted)) // player is an admin, and the match is started | |
BottomPrint(%cl, getTaggedString(%client.name) @ " needs a team. Team him.", 5, 1); | |
} | |
} | |
if(!$MatchStarted && !$CountdownStarted) | |
{ | |
if($TeamDamage) | |
%damMess = "ENABLED"; | |
else | |
%damMess = "DISABLED"; | |
if(%game.numTeams > 1) | |
{ | |
// Check if the stats are enabled, if the tourney stats are enabled and if the mission type is Capture the flag | |
if($Host::EvoStats && $Host::EvoStatsTourney && $CurrentMissionType $= "CTF") | |
{ | |
// schedule the original message | |
$UpdateSchedule[%client] = schedule(10000, %client, BottomPrint, %client, "Server is Running in Tournament Mode.\nPick a Team\nTeam Damage is " @ %damMess, 0, 3); | |
// Team 1 stats | |
%nickTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::nickTeam1 : "N/A"); | |
%realTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::realTeam1 : "N/A"); | |
// Team 2 stats | |
%nickTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::nickTeam2 : "N/A"); | |
%realTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::realTeam2 : "N/A"); | |
// Send the message | |
BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 10, 3); | |
} | |
else | |
BottomPrint(%client, "Server is Running in Tournament Mode.\nPick a Team\nTeam Damage is " @ %damMess, 0, 3 ); | |
} | |
} | |
else if($Host::EvoStats && $Host::EvoStatsTourney && $CurrentMissionType $= "CTF") | |
{ | |
// schedule the original message | |
$UpdateSchedule[%client] = schedule(10000, %client, BottomPrint, %client, "\nServer is Running in Tournament Mode", 0, 3); | |
// Team 1 stats | |
%nickTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::nickTeam1 : "N/A"); | |
%realTeam1 = ($Evo::flagstats::heldTeam1 ? $Evo::flagstats::realTeam1 : "N/A"); | |
// Team 2 stats | |
%nickTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::nickTeam2 : "N/A"); | |
%realTeam2 = ($Evo::flagstats::heldTeam2 ? $Evo::flagstats::realTeam2 : "N/A"); | |
// Send the message | |
BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 10, 3); | |
} | |
else | |
BottomPrint( %client, "\nServer is Running in Tournament Mode", 0, 3 ); | |
} | |
//make sure the objective HUD indicates your team on top and in green... | |
if(%client.team > 0) | |
messageClient(%client, 'MsgCheckTeamLines', "", %client.team); | |
// were ready to go. | |
%client.matchStartReady = true; | |
echo("Client" SPC %client SPC "is ready."); | |
} | |
function DefaultGame::startMatch(%game) | |
{ | |
Parent::startMatch(%game); | |
if(!$Host::TournamentMode && !$Host::EvoOneMapOnly && !$Host::ClassicRandomMissions && $Host::EvoSkipMission && !$AdminChangedMission) | |
{ | |
autoVote("VoteSkipMission", findNextCycleMission(), $CurrentMissionType); | |
} | |
if ( !$Host::TournamentMode && ( $Host::TimeLimit == 999 ) ) | |
{ | |
cancelCountdown(); | |
} | |
$AdminChangedMission = ""; | |
} | |
function DefaultGame::testTeamKill(%game, %victimID, %killerID) | |
{ | |
%tk = Parent::testTeamKill(%game, %victimID, %killerID); | |
if(!%tk) | |
return false; // is not a tk | |
if($Host::EvoTKLogging) | |
{ | |
// get the TKer info | |
%authInfo = %killerID.getAuthInfo(); | |
// TK info | |
$TKLog = formatTimeString("d-M-yy") SPC formatTimeString("[HH:nn]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ ", " @ getField(%authInfo, 1) @ ", " @ %client.guid @ ", " @ %client.getAddress() @ ") TEAMKILLED " @ %victimID.nameBase; | |
// log the TK | |
if($Host::EvoDailyLogs) | |
{ | |
if(formatTimeString("HH") > getSubStr($Host::EvoDailyHour, 0, strstr($Host::EvoDailyHour, ":")) || (formatTimeString("HH") == getSubStr($Host::EvoDailyHour, 0, strstr($Host::EvoDailyHour, ":")) && formatTimeString("nn") >= getSubStr($Host::EvoDailyHour, strstr($Host::EvoDailyHour, ":")+1, 2))) | |
export("$TKLog", "logs/TK/TKLog-" @ formatTimeString("d-M-yy") @ ".txt", true); | |
else | |
{ | |
%yesterday = formatTimeString("d") - 1; | |
export("$TKLog", "logs/TK/TKLog-" @ %yesterday @ formatTimeString("-M-yy") @ ".txt", true); | |
} | |
} | |
else | |
export("$TKLog", "logs/TK/TKLog.txt", true); | |
} | |
if($Host::TournamentMode || %killerID.isAdmin || %killerID.isAIcontrolled() || %victimID.isAIcontrolled()) | |
return true; | |
// warn the player of the imminent kick vote | |
if((%killerID.teamkills == $Host::EvoTKWarn1 - 1) && $Host::EvoTKWarn1 != 0) | |
centerprint(%killerID, "You have teamkilled " @ %killerID.teamkills + 1 @ " players.\nWith " @ $Host::EvoTKVote @ " teamkills, a vote to kick will be started.", 5, 2); | |
// start a vote to kick the player | |
else if((%killerID.teamkills == $Host::EvoTKVote - 1) && $Host::EvoTKVote != 0) | |
autoVote("VoteKickPlayer", %killerID); | |
// warn the player of his imminent kick | |
else if((%killerID.teamkills == $Host::EvoTKWarn2 - 1) && $Host::EvoTKWarn2 != 0) | |
centerprint(%killerID, "You have teamkilled " @ %killerID.teamkills + 1 @ " players.\nWith " @ $Host::EvoTKMax @ " teamkills, you will be kicked.", 5, 2); | |
// kick the player | |
else if((%killerID.teamkills >= $Host::EvoTKMax - 1) && $Host::EvoTKMax != 0) | |
{ | |
Game.kickClientName = %killerID.name; | |
kick(%killerID, false, %killerID.guid); | |
adminLog( %killerID, " was autokicked for too many teamkills." ); | |
} | |
return true; | |
} | |
function DefaultGame::forceObserver(%game, %client, %reason) | |
{ | |
//make sure we have a valid client... | |
if(%client <= 0) | |
return; | |
// first kill this player | |
if(%client.player) | |
%client.player.scriptKill(0); | |
if(%client.respawnTimer) | |
cancel(%client.respawnTimer); | |
%client.respawnTimer = ""; | |
// remove them from the team rank array | |
%game.removeFromTeamRankArray(%client); | |
// place them in observer mode | |
%client.lastObserverSpawn = -1; | |
%client.observerStartTime = getSimTime(); | |
%adminForce = 0; | |
switch$(%reason) | |
{ | |
case "playerChoose": | |
%client.camera.getDataBlock().setMode(%client.camera, "observerFly"); | |
messageClient(%client, 'MsgClientJoinTeam', '\c2You have become an observer.', %client.name, %game.getTeamName(0), %client, 0); | |
logEcho(%client.nameBase @ " (cl " @ %client @ ") entered observer mode"); | |
%client.lastTeam = %client.team; | |
// if Tourney mode, remove the "press fire when ready" centerprint | |
if($Host::TournamentMode) | |
{ | |
if(!$matchStarted) | |
{ | |
clearCenterPrint(%client); | |
%client.notReady = true; | |
} | |
} | |
%scheduleAutoKick = true; | |
case "AdminForce": | |
%client.camera.getDataBlock().setMode(%client.camera, "observerFly"); | |
messageClient(%client, 'MsgClientJoinTeam', '\c2You have been forced into observer mode by the admin.', %client.name, %game.getTeamName(0), %client, 0); | |
logEcho(%client.nameBase @ " (cl " @ %client @ ") was forced into observer mode by admin"); | |
%client.lastTeam = %client.team; | |
%adminForce = 1; | |
if($Host::TournamentMode) | |
{ | |
if(!$matchStarted) | |
{ | |
if(%client.camera.Mode $= "pickingTeam") | |
{ | |
commandToClient( %client, 'processPickTeam'); | |
clearBottomPrint( %client ); | |
} | |
else | |
{ | |
clearCenterPrint(%client); | |
%client.notReady = true; | |
} | |
} | |
} | |
case "spawnTimeout": | |
%client.camera.getDataBlock().setMode( %client.camera, "observerTimeout" ); | |
messageClient(%client, 'MsgClientJoinTeam', '\c2You have been placed in observer mode due to delay in respawning.', %client.name, %game.getTeamName(0), %client, 0); | |
logEcho(%client.nameBase @ " (cl " @ %client @ ") was placed in observer mode due to spawn delay"); | |
// save the team the player was on - only if this was a delay in respawning | |
%client.lastTeam = %client.team; | |
%scheduleAutoKick = true; | |
} | |
if (%scheduleAutoKick && !%client.isAdmin && !$Host::TournamentMode && $Host::EvoKickObservers ) | |
{ | |
messageClient(%client, 'MsgNoObservers', '\c2You have %1 seconds to join the game or you will be kicked.', $Host::EvoKickObservers); | |
%key = mFloor(getRandom() * 1000); | |
%client.okkey = %key; | |
schedule(($Host::EvoKickObservers * 1000), 0, "cmdAutoKickObserver", %client, %key); | |
} | |
// switch client to team 0 (observer) | |
%client.team = 0; | |
%client.player.team = 0; | |
setTargetSensorGroup(%client.target, %client.team); | |
%client.setSensorGroup(%client.team); | |
// set their control to the obs. cam | |
%client.setControlObject(%client.camera); | |
commandToClient(%client, 'setHudMode', 'Observer'); | |
// display the hud | |
updateObserverFlyHud(%client); | |
// message everyone about this event | |
if(!%adminForce) | |
messageAllExcept(%client, -1, 'MsgClientJoinTeam', '\c2%1 has become an observer.', %client.name, %game.getTeamName(0), %client, 0); | |
else | |
messageAllExcept(%client, -1, 'MsgClientJoinTeam', '\c2The admin has forced %1 to become an observer.', %client.name, %game.getTeamName(0), %client, 0); | |
updateCanListenState(%client); | |
// call the onEvent for this game type | |
%game.onClientEnterObserverMode(%client); //Bounty uses this to remove this client from others' hit lists | |
} | |
function DefaultGame::sendDebriefing(%game, %client) | |
{ | |
if(%game.numTeams == 1) | |
{ | |
// Mission result: | |
%winner = $TeamRank[0, 0]; | |
if(%winner.score > 0) | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>%1 wins!', $TeamRank[0, 0].name); | |
else | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Nobody wins.'); | |
// send client the stats | |
if ($Host::EvoStatsPosition == 0 ) | |
sendEvoDebriefing(%client); | |
// Player scores: | |
%count = $TeamRank[0, count]; | |
messageClient(%client, 'MsgDebriefAddLine', "", '\n<lmargin:0><spush><color:00dc00><font:univers condensed:18>PLAYER<lmargin%%:60>SCORE<lmargin%%:80>KILLS<spop>'); | |
for(%i = 0; %i < %count; %i++) | |
{ | |
%cl = $TeamRank[0, %i]; | |
if(%cl.score $= "") | |
%score = 0; | |
else | |
%score = %cl.score; | |
if(%cl.kills $= "") | |
%kills = 0; | |
else | |
%kills = %cl.kills; | |
messageClient(%client, 'MsgDebriefAddLine', "", '<lmargin:0><clip%%:60> %1</clip><lmargin%%:60><clip%%:20> %2</clip><lmargin%%:80><clip%%:20> %3', %cl.name, %score, %kills); | |
} | |
// send client the stats after the scores | |
if($Host::EvoStatsPosition == 1) | |
sendEvoDebriefing(%client); | |
} | |
else | |
{ | |
%topScore = ""; | |
%topCount = 0; | |
for(%team = 1; %team <= %game.numTeams; %team++) | |
{ | |
if(%topScore $= "" || $TeamScore[%team] > %topScore) | |
{ | |
%topScore = $TeamScore[%team]; | |
%firstTeam = %team; | |
%topCount = 1; | |
} | |
else if($TeamScore[%team] == %topScore) | |
{ | |
%secondTeam = %team; | |
%topCount++; | |
} | |
} | |
// Mission result: | |
if(%topCount == 1) | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Team %1 wins!', %game.getTeamName(%firstTeam)); | |
else if(%topCount == 2) | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>Team %1 and Team %2 tie!', %game.getTeamName(%firstTeam), %game.getTeamName(%secondTeam)); | |
else | |
messageClient(%client, 'MsgDebriefResult', "", '<just:center>The mission ended in a tie.'); | |
// Team scores: | |
messageClient(%client, 'MsgDebriefAddLine', "", '<spush><color:00dc00><font:univers condensed:18>TEAM<lmargin%%:60>SCORE<spop>'); | |
for(%team = 1; %team - 1 < %game.numTeams; %team++) | |
{ | |
if($TeamScore[%team] $= "") | |
%score = 0; | |
else | |
%score = $TeamScore[%team]; | |
messageClient(%client, 'MsgDebriefAddLine', "", '<lmargin:0><clip%%:60> %1</clip><lmargin%%:60><clip%%:40> %2</clip>', %game.getTeamName(%team), %score); | |
} | |
// send client the stats | |
if($Host::EvoStatsPosition == 0) | |
sendEvoDebriefing(%client); | |
if($Host::TournamentMode || Game.class $= "TeamHuntersGame" || (!$Host::TournamentMode && $Host::ShowEndingPlayerScores)) | |
{ | |
// Player scores: | |
messageClient(%client, 'MsgDebriefAddLine', "", '\n<lmargin:0><spush><color:00dc00><font:univers condensed:18>PLAYER<lmargin%%:40>TEAM<lmargin%%:70>SCORE<lmargin%%:87>KILLS<spop>'); | |
for(%team = 1; %team - 1 < %game.numTeams; %team++) | |
%count[%team] = 0; | |
%notDone = true; | |
while(%notDone) | |
{ | |
// Get the highest remaining score: | |
%highScore = ""; | |
for(%team = 1; %team <= %game.numTeams; %team++) | |
{ | |
if(%count[%team] < $TeamRank[%team, count] && (%highScore $= "" || $TeamRank[%team, %count[%team]].score > %highScore)) | |
{ | |
%highScore = $TeamRank[%team, %count[%team]].score; | |
%highTeam = %team; | |
} | |
} | |
// Send the debrief line: | |
%cl = $TeamRank[%highTeam, %count[%highTeam]]; | |
%score = %cl.score $= "" ? 0 : %cl.score; | |
%kills = %cl.kills $= "" ? 0 : %cl.kills; | |
messageClient(%client, 'MsgDebriefAddLine', "", '<lmargin:0><clip%%:40> %1</clip><lmargin%%:40><clip%%:30> %2</clip><lmargin%%:70><clip%%:17> %3</clip><lmargin%%:87><clip%%:13> %4</clip>', %cl.name, %game.getTeamName(%cl.team), %score, %kills); | |
%count[%highTeam]++; | |
%notDone = false; | |
for(%team = 1; %team - 1 < %game.numTeams; %team++) | |
{ | |
if(%count[%team] < $TeamRank[%team, count]) | |
{ | |
%notDone = true; | |
break; | |
} | |
} | |
} | |
} | |
} | |
if((%game.numTeams == 1) || $Host::TournamentMode || Game.class $= "TeamHuntersGame" || (!$Host::TournamentMode && %game.numTeams > 1 && $Host::ShowEndingPlayerScores)) | |
{ | |
//now go through an list all the observers: | |
%printedHeader = false; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0) | |
{ | |
//print the header only if we actually find an observer | |
if(!%printedHeader) | |
{ | |
%printedHeader = true; | |
messageClient(%client, 'MsgDebriefAddLine', "", '\n<lmargin:0><spush><color:00dc00><font:univers condensed:18>OBSERVERS<lmargin%%:60>SCORE<spop>'); | |
} | |
//print out the client | |
%score = %cl.score $= "" ? 0 : %cl.score; | |
messageClient(%client, 'MsgDebriefAddLine', "", '<lmargin:0><clip%%:60> %1</clip><lmargin%%:60><clip%%:40> %2</clip>', %cl.name, %score); | |
} | |
} | |
} | |
// send client the stats after the scores | |
if($Host::EvoStatsPosition == 1) | |
sendEvoDebriefing(%client); | |
} | |
function DefaultGame::updateScoreHud(%game, %client, %tag) | |
{ | |
%ShowScores = ( $Host::TournamentMode || $Host::ShowIngamePlayerScores ); | |
if(Game.numTeams > 1) | |
{ | |
// Send header: | |
messageClient(%client, 'SetScoreHudHeader', "", '<tab:15,315>\t%1<rmargin:260><just:right>%2<rmargin:560><just:left>\t%3<just:right>%4', %game.getTeamName(1), $TeamScore[1], %game.getTeamName(2), $TeamScore[2]); | |
if ( !$TeamRank[1, count] ) | |
{ | |
$TeamRank[1, count] = 0; | |
} | |
if ( !$TeamRank[2, count] ) | |
{ | |
$TeamRank[2, count] = 0; | |
} | |
if ( $Host::EvoAveragePings ) | |
{ | |
for ( %count = 0; %count <= Game.numteams; %count++ ) | |
{ | |
%Ping[%count] = 0; | |
%PingSq[%count] = 0; | |
%PingCount[%count] = 0; | |
} | |
for ( %ClientCount = ClientGroup.getCount() -1 ; %ClientCount >= 0; | |
%ClientCount-- ) | |
{ | |
%ThisClient = ClientGroup.getObject( %ClientCount ); | |
%Team = %ThisClient.team; | |
%PingVal = %ThisClient.getPing(); | |
%Ping[%Team] += %PingVal; | |
%PingSq[%Team] += ( %PingVal * %PingVal ); | |
%PingCount[%Team] ++; | |
} | |
for ( %count = 0; %count <= %game.numteams; %count++ ) | |
{ | |
if ( %PingCount[%count] ) | |
{ | |
%Ping[%count] /= %PingCount[%count]; | |
%PingSq[%count] /= %PingCount[%count]; | |
%PingSq[%count] = msqrt( %PingSq[%count] - ( %Ping[%count] * %Ping[%count] ) ); | |
%Ping[%count] = mfloor( %Ping[%count] ); | |
%PingSq[%count] = mfloor( %PingSq[%count] ); | |
%PingString[%count] = "<spush><font:Arial:14>P<font:Arial:12>ING: " @ %Ping[%count] @ " +/- " @ %PingSq[%count] @ "ms <spop>"; | |
} | |
} | |
} | |
messageClient( %client, 'SetScoreHudSubheader', "", | |
'<tab:15,315>\tPLAYERS (%1)<rmargin:260><just:right>%4%3<rmargin:560><just:left>\tPLAYERS (%2)<just:right>%5%3', $TeamRank[1, count], $TeamRank[2, count], (%ShowScores?'SCORE':''),%PingString[1],%PingString[2]); | |
%index = 0; | |
while(true) | |
{ | |
if(%index >= $TeamRank[1, count]+2 && %index >= $TeamRank[2, count]+2) | |
break; | |
//get the team1 client info | |
%team1Client = ""; | |
%team1ClientScore = ""; | |
%col1Style = ""; | |
if(%index < $TeamRank[1, count]) | |
{ | |
%team1Client = $TeamRank[1, %index]; | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores && %team1Client.score >= 0) | |
%team1ClientScore = 0; | |
else | |
%team1ClientScore = %team1Client.score $= "" ? 0 : %team1Client.score; | |
%col1Style = %team1Client == %client ? "<color:dcdcdc>" : ""; | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores) | |
%team1playersTotalScore = 0; | |
else | |
%team1playersTotalScore += %team1Client.score; | |
} | |
else if(%index == $teamRank[1, count] && $teamRank[1, count] != 0 && %game.class $= "CTFGame") | |
{ | |
%team1ClientScore = "--------------"; | |
} | |
else if(%index == $teamRank[1, count]+1 && $teamRank[1, count] != 0 && %game.class $= "CTFGame") | |
{ | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores) | |
%team1ClientScore = 0; | |
else | |
%team1ClientScore = %team1playersTotalScore != 0 ? %team1playersTotalScore : 0; | |
} | |
//get the team2 client info | |
%team2Client = ""; | |
%team2ClientScore = ""; | |
%col2Style = ""; | |
if(%index < $TeamRank[2, count]) | |
{ | |
%team2Client = $TeamRank[2, %index]; | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores && %team2Client.score >= 0) | |
%team2ClientScore = 0; | |
else | |
%team2ClientScore = %team2Client.score $= "" ? 0 : %team2Client.score; | |
%col2Style = %team2Client == %client ? "<color:dcdcdc>" : ""; | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores) | |
%team2playersTotalScore = 0; | |
else | |
%team2playersTotalScore += %team2Client.score; | |
} | |
else if(%index == $teamRank[2, count] && $teamRank[2, count] != 0 && %game.class $= "CTFGame") | |
{ | |
%team2ClientScore = "--------------"; | |
} | |
else if(%index == $teamRank[2, count]+1 && $teamRank[2, count] != 0 && %game.class $= "CTFGame") | |
{ | |
if(!$Host::TournamentMode && !$Host::ShowIngamePlayerScores) | |
%team2ClientScore = 0; | |
else | |
%team2ClientScore = %team2playersTotalScore != 0 ? %team2playersTotalScore : 0; | |
} | |
if (!%ShowScores) | |
{ | |
%team1ClientScore = ''; | |
%team2ClientScore = ''; | |
} | |
if(%client.team != 0) //if the client is not an observer, send the message | |
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:20,320>\t<spush>%5<clip:200>%1</clip><rmargin:260><just:right>%2<spop><rmargin:560><just:left>\t%6<clip:200>%3</clip><just:right>%4', %team1Client.name, %team1ClientScore, %team2Client.name, %team2ClientScore, %col1Style, %col2Style); | |
else //else for observers, create an anchor around the player name so they can be observed | |
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:20,320>\t<spush>%5<clip:200><a:gamelink\t%7>%1</a></clip><rmargin:260><just:right>%2<spop><rmargin:560><just:left>\t%6<clip:200><a:gamelink\t%8>%3</a></clip><just:right>%4', %team1Client.name, %team1ClientScore, %team2Client.name, %team2ClientScore, %col1Style, %col2Style, %team1Client, %team2Client); | |
%index++; | |
} | |
} | |
else | |
{ | |
//tricky stuff here... use two columns if we have more than 15 clients... | |
%numClients = $TeamRank[0, count]; | |
if(%numClients > $ScoreHudMaxVisible) | |
%numColumns = 2; | |
// Clear header: | |
messageClient(%client, 'SetScoreHudHeader', "", ""); | |
// Send header: | |
if(%numColumns == 2) | |
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:15,315>\tPLAYER<rmargin:270><just:right>%1<rmargin:570><just:left>\tPLAYER<just:right>%1', (%ShowScores?'SCORE':'')); | |
else | |
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:15>\tPLAYER<rmargin:270><just:right>%1', (%ShowScores?'SCORE':'')); | |
%countMax = %numClients; | |
if(%countMax > ( 2 * $ScoreHudMaxVisible )) | |
{ | |
if(%countMax & 1) | |
%countMax++; | |
%countMax = %countMax / 2; | |
} | |
else if(%countMax > $ScoreHudMaxVisible) | |
%countMax = $ScoreHudMaxVisible; | |
for(%index = 0; %index < %countMax; %index++) | |
{ | |
//get the client info | |
%col1Client = $TeamRank[0, %index]; | |
%col1ClientScore = %col1Client.score $= "" ? 0 : %col1Client.score; | |
%col1Style = %col1Client == %client ? "<color:dcdcdc>" : ""; | |
//see if we have two columns | |
if(%numColumns == 2) | |
{ | |
%col2Client = ""; | |
%col2ClientScore = ""; | |
%col2Style = ""; | |
//get the column 2 client info | |
%col2Index = %index + %countMax; | |
if(%col2Index < %numClients) | |
{ | |
%col2Client = $TeamRank[0, %col2Index]; | |
%col2ClientScore = %col2Client.score $= "" ? 0 : %col2Client.score; | |
%col2Style = %col2Client == %client ? "<color:dcdcdc>" : ""; | |
} | |
} | |
if ( !%ShowScores ) | |
{ | |
%col1ClientScore = ""; | |
%col2ClientScore = ""; | |
} | |
//if the client is not an observer, send the message | |
if(%client.team != 0) | |
{ | |
if(%numColumns == 2) | |
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:25,325>\t<spush>%5<clip:195>%1</clip><rmargin:260><just:right>%2<spop><rmargin:560><just:left>\t%6<clip:195>%3</clip><just:right>%4', %col1Client.name, %col1ClientScore, %col2Client.name, %col2ClientScore, %col1Style, %col2Style); | |
else | |
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:25>\t%3<clip:195>%1</clip><rmargin:260><just:right>%2', %col1Client.name, %col1ClientScore, %col1Style); | |
} | |
//else for observers, create an anchor around the player name so they can be observed | |
else | |
{ | |
if(%numColumns == 2) | |
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:25,325>\t<spush>%5<clip:195><a:gamelink\t%7>%1</a></clip><rmargin:260><just:right>%2<spop><rmargin:560><just:left>\t%6<clip:195><a:gamelink\t%8>%3</a></clip><just:right>%4', %col1Client.name, %col1ClientScore, %col2Client.name, %col2ClientScore, %col1Style, %col2Style, %col1Client, %col2Client); | |
else | |
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:25>\t%3<clip:195><a:gamelink\t%4>%1</a></clip><rmargin:260><just:right>%2', %col1Client.name, %col1ClientScore, %col1Style, %col1Client); | |
} | |
} | |
} | |
// Tack on the list of observers: | |
%observerCount = 0; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team == 0) | |
%observerCount++; | |
} | |
if(%observerCount > 0) | |
{ | |
messageClient(%client, 'SetLineHud', "", %tag, %index, ""); | |
%index++; | |
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush><font:Univers Condensed:22>\tOBSERVERS (%1)<rmargin:260><just:right>TIME<spop>', %observerCount); | |
%index++; | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
//if this is an observer | |
if(%cl.team == 0) | |
{ | |
%obsTime = getSimTime() - %cl.observerStartTime; | |
%obsTimeStr = %game.formatTime(%obsTime, false); | |
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:20, 310>\t<clip:150>%1</clip><rmargin:260><just:right>%2', %cl.name, %obsTimeStr); | |
%index++; | |
} | |
} | |
} | |
//clear the rest of Hud so we don't get old lines hanging around... | |
messageClient(%client, 'ClearHud', "", %tag, %index); | |
} | |
function DefaultGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4) | |
{ | |
switch$(%typeName) | |
{ | |
case "voteETMMode": | |
%game.voteETMMode(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "cancelMatchStart": | |
%game.cancelMatchStart(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "voteFFA2Mode": | |
%game.voteFFA2Mode(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "modSwitcher": | |
%game.modSwitcher(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "cancelSwitchMod": | |
%game.cancelSwitchMod(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "passRunningVote": | |
%game.passRunningVote(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "stopRunningVote": | |
%game.stopRunningVote(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "voteSkipMission": | |
%game.voteSkipMission(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "switchCRCCheck": | |
%game.switchCRCCheck(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "cancelServerRestart": | |
%game.cancelServerRestart(%admin, %arg1, %arg2, %arg3, %arg4); | |
case "clearServerForMatch": | |
%game.clearServerForMatch(%admin, %arg1, %arg2, %arg3, %arg4); | |
default: | |
Parent::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4); | |
} | |
} | |
function DefaultGame::sendGamePlayerPopupMenu(%game, %client, %targetClient, %key) | |
{ | |
// Sinbinned players cannot take actions | |
if (%client.SinBinned ) | |
return; | |
if(!%targetClient.matchStartReady) | |
return; | |
%isAdmin = (%client.isAdmin || %client.isSuperAdmin); | |
%isTargetSelf = (%client == %targetClient); | |
%isTargetAdmin = (%targetClient.isAdmin || %targetClient.isSuperAdmin); | |
%isTargetBot = %targetClient.isAIControlled(); | |
%isTargetObserver = (%targetClient.team == 0); | |
%outrankTarget = false; | |
if(%client.isSuperAdmin) | |
%outrankTarget = !%targetClient.isSuperAdmin; | |
else if(%client.isAdmin) | |
%outrankTarget = !%targetClient.isAdmin; | |
if(%client.isSuperAdmin && %targetClient.guid != 0) | |
{ | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "addAdmin", "", 'Add to Admin List', 10); | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "addSuperAdmin", "", 'Add to SuperAdmin List', 11); | |
} | |
// add player/clan to the ban list | |
if( (%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminPermanentBan)) && %targetClient.guid != 0 && %outrankTarget) | |
{ | |
PizzaTriconPopup( %client, %key, 'Add to Ban List', "addBanList", 17 ); | |
} | |
//mute options | |
if(!%isTargetSelf) | |
{ | |
if(%client.muted[%targetClient]) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "MutePlayer", "", 'Unmute Text Chat', 1); | |
else | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "MutePlayer", "", 'Mute Text Chat', 1); | |
if(!%isTargetBot && %client.canListenTo(%targetClient)) | |
{ | |
if(%client.getListenState(%targetClient)) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "ListenPlayer", "", 'Disable Voice Com', 9); | |
else | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "ListenPlayer", "", 'Enable Voice Com', 9); | |
} | |
if(%client.team == 0 && !%isTargetObserver) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "ObservePlayer", "", 'Observe Player', 12); | |
} | |
if(!%client.canVote && !%isAdmin) | |
return; | |
// regular vote options on players | |
if(%game.scheduleVote $= "" && !%isAdmin && !%isTargetAdmin) | |
{ | |
if(((ClientGroup.getCount() - $HostGameBotCount) >= $Host::EvoAdminMinPlayers) && $Host::allowAdminPlayerVotes && !%isTargetBot) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "AdminPlayer", "", 'Vote to Make Admin', 2); | |
if(!%isTargetSelf && (%client.team == %targetClient.team || %targetClient.team == 0)) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "KickPlayer", "", 'Vote to Kick', 3); | |
} | |
else if(%isAdmin) // Admin only options on players | |
{ | |
if ( !%isTargetBot ) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "SendMessage", "", 'Send Private Message', 15); | |
if(!%isTargetBot && !%isTargetAdmin && $Host::EvoAdminAdmin) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "AdminPlayer", "", 'Make Admin', 2); | |
if(!%isTargetSelf && %outrankTarget) | |
{ | |
if( !%isTargetBot && %client.isSuperAdmin && $Host::EvoSuperAdminSuper) | |
{ | |
PizzaTriconPopup( %client, %key, 'Make Super Admin', "SuperAdminPlayer", 19 ); | |
} | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "KickPlayer", "", 'Kick', 3); | |
if(!%isTargetBot) | |
{ | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "Warn", "", 'Warn player', 13); | |
if(%isTargetAdmin) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "StripAdmin", "", 'Strip admin', 14); | |
if(%client.isSuperAdmin || $Host::EvoAdminBan) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "BanPlayer", "", 'Ban', 4); | |
if(!%isTargetObserver) | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "ToObserver", "", 'Force observer', 5); | |
if((($Host::EvoAdminWhois) || (%client.isSuperAdmin && $Host::EvoSuperAdminWhois)) && !(%targetClient.isSuperAdmin && $Host::EvoBlockSuperAdminWhois)) | |
{ | |
PizzaTriconPopup ( %client, %key, "WhoIS", "Whois", 16 ); | |
} | |
messageClient( %client, 'MsgPlayerPopupItem', "", %key, "ExplodePlayer", "", 'Explode Player', 20); | |
} | |
} | |
if(%isTargetSelf || %outrankTarget) | |
{ | |
if(%game.numTeams > 1) | |
{ | |
if(%isTargetObserver) | |
{ | |
%action = %isTargetSelf ? "Join " : "Change to "; | |
%str1 = %action @ getTaggedString(%game.getTeamName(1)); | |
%str2 = %action @ getTaggedString(%game.getTeamName(2)); | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "ChangeTeam", "", %str1, 6); | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "ChangeTeam", "", %str2, 7); | |
} | |
else | |
{ | |
%changeTo = %targetClient.team == 1 ? 2 : 1; | |
%str = "Switch to " @ getTaggedString( %game.getTeamName(%changeTo)); | |
%caseId = 5 + %changeTo; | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "ChangeTeam", "", %str, %caseId); | |
// z0dd - ZOD, 7/11/03. Allow Super admins to force themselves to obs. | |
messageClient( %client, 'MsgPlayerPopupItem', "", %key, "ToObserver", "", 'Force observer', 5 ); | |
} | |
} | |
else if(%isTargetObserver) | |
{ | |
%str = %isTargetSelf ? 'Join the Game' : 'Add to Game'; | |
messageClient(%client, 'MsgPlayerPopupItem', "", %key, "JoinGame", "", %str, 8); | |
} | |
} | |
} | |
} | |
function DefaultGame::sendGameVoteMenu(%game, %client, %key) | |
{ | |
// Sinbinned players cannot take actions | |
if ( %client.SinBinned ) | |
return; | |
%isAdmin = (%client.isAdmin || %client.isSuperAdmin); | |
%multipleTeams = %game.numTeams > 1; | |
// ******************************************** | |
// Admin Vote For ... Submenu | |
// ******************************************** | |
if (!$Host::TournamentMode) | |
{ | |
if (%client.ForceVote > 0) | |
%client.ForceVote = %client.ForceVote - 1; | |
if (%client.ForceVote > 0) | |
{ | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); | |
messageClient(%client, 'MsgVoteItem',"", %key, 'ForceVote', 'Cancel Force Vote', "Cancel 'Vote To...'"); | |
return; // Display no further vote options | |
} | |
} | |
// TEAM OPTIONS | |
if(!$Host::TournamentMode) | |
{ | |
if(%client.team != 0) // he isn't an observer | |
{ | |
if(%multipleTeams) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); | |
if($MatchStarted) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); | |
} | |
} | |
else if(%client.isAdmin) // only admins can change team during tournament mode | |
{ | |
if(%client.team != 0) // he isn't an observer | |
{ | |
if(%multipleTeams) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); | |
} | |
} | |
if(!%client.canVote && !%isAdmin) | |
return; | |
if(%game.scheduleVote $= "") | |
{ | |
if(!%client.isAdmin) | |
{ | |
if(!$Host::TournamentMode) | |
{ | |
if($Host::EvoAllowPlayerVoteChangeMission) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); | |
if($Host::EvoAllowPlayerVoteTournamentMode) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Vote Tournament Mode'); | |
if($Host::EvoAllowPlayerVoteTimeLimit) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); | |
if(%multipleTeams && $Host::EvoAllowPlayerVoteTeamDamage) | |
{ | |
if($teamDamage) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); | |
else | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); | |
} | |
if($CurrentMissionType !$= TR2) // z0dd - ZOD, 5/23/03. Added vote for Random teams | |
{ | |
if ( $RandomTeams ) | |
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'disable random teams', 'Vote to Disable Random Teams' ); | |
else | |
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'enable random teams', 'Vote to Enable Random Teams' ); | |
} | |
} | |
else | |
{ | |
if(!$MatchStarted && !$CountdownStarted) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Vote to Start the Match'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); | |
if(%multipleTeams) | |
{ | |
if($teamDamage) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); | |
else | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); | |
} | |
} | |
} | |
else | |
{ | |
if(!$Host::TournamentMode) | |
{ | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Tournament Mode'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); | |
if ( $Host::EvoForcedVotes ) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'ForceVote', 'Vote to ...', 'Vote to ...'); | |
} | |
else | |
{ | |
if(!$MatchStarted && !$CountdownStarted) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Start Match'); | |
if(!$MatchStarted && $CountdownStarted) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'cancelMatchStart', 'Cancel Match Start', 'Cancel Match Start'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Free For All Mode'); | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); | |
} | |
if(%multipleTeams) | |
{ | |
if($teamDamage) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Disable Team Damage'); | |
else | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Enable Team Damage'); | |
if($CurrentMissionType !$= TR2) // z0dd - ZOD, 5/23/03. Added vote for Random teams | |
{ | |
if ( $RandomTeams ) | |
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'disable random teams', 'Disable Random Teams' ); | |
else | |
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'enable random teams', 'Enable Random Teams' ); | |
} | |
} | |
} | |
if ($Host::EvoServerRules[1] !$= "" ) | |
{ | |
messageClient( %client, 'MsgVoteItem', "", %key, 'showServerRules', 'show server rules', "Show Server Rules" ); | |
} | |
if((%client.isSuperAdmin && $Host::EvoSuperAdminReset) || (%client.isAdmin && $Host::EvoAdminReset)) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteResetServer', 'reset server defaults', 'Reset the Server'); | |
if ((%client.isSuperAdmin && $Host::EvoSuperClearServer) || (%client.isAdmin && $Host::EvoAdminClearServer)) | |
{ | |
messageClient( %client, 'MsgVoteItem', "", %key, 'clearServerForMatch', 'clear the server', "Clear the Server" ); | |
} | |
if($Host::EvoSuperAdminCRCCheck && (%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminCRCCheck))) | |
{ | |
if(!$CRCCountdownStarted) | |
{ | |
if($Host::CRCTextures) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'switchCRCCheck', 'Disable CRC Check', 'Disable CRC Check'); | |
else | |
messageClient(%client, 'MsgVoteItem', "", %key, 'switchCRCCheck', 'Enable CRC Check', 'Enable CRC Check'); | |
} | |
else | |
messageClient(%client, 'MsgVoteItem', "", %key, 'cancelServerRestart', 'cancel server restart', 'Stop Server Restart'); | |
} | |
if((%client.isSuperAdmin && $Host::EvoSuperAdminSwitch) || (%client.isAdmin && $Host::EvoAdminSwitch)) | |
{ | |
if(!$SwitchCountdownStarted) | |
messageClient(%client, 'MsgVoteItem', "", %key, 'modSwitcher', 'switch mod', 'Switch to Base'); | |
else | |
messageClient(%client, 'MsgVoteItem', "", %key, 'cancelSwitchMod', 'Cancel Mod Switch', 'Cancel Mod Switch'); | |
} | |
} | |
else | |
{ | |
if(%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminStopVotes)) // allow admins to stop votes | |
{ | |
messageClient(%client, 'MsgVoteItem', "", %key, 'stopRunningVote', 'stop current vote', 'Stop the Vote'); | |
} | |
if ((%client.isSuperAdmin && $Host::EvoSuperPassVote) || (%client.isAdmin && $Host::EvoAdminPassVote) ) | |
{ | |
messageClient( %client, 'MsgVoteItem', "", %key, 'passRunningVote', 'pass current vote', 'Pass the Vote'); | |
} | |
} | |
// Admin only options: | |
if ( %client.isAdmin ) | |
{ | |
if ( $LimitArmors ) | |
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorLimits', 'disable armor limiting', 'Disable armor limits' ); | |
else | |
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorLimits', 'enable armor limiting', 'Enable armor limits' ); | |
// ----------------------------------------------------------------------------- | |
// z0dd - ZOD, 5/12/02. Add bot menu for admins | |
%totalSlots = $Host::maxPlayers - ($HostGamePlayerCount + $HostGameBotCount); | |
if( $HostGameBotCount > 0 && %totalSlots > 0) | |
messageClient( %client, 'MsgVoteItem', "", %key, 'Addbot', "", 'Add a Bot' ); | |
// ----------------------------------------------------------------------------- | |
} | |
} | |
function DefaultGame::cancelMatchStart(%game, %admin) | |
{ | |
if(%admin && $Host::TournamentMode && !$MatchStarted && $CountdownStarted) | |
{ | |
CancelCountdown(); | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
messageClient(%cl, 'MsgAdminForce', "\c2Match Start Canceled."); | |
messageClient(%cl, 'MsgSystemClock', "", 0, 0); | |
%cl.notready = 1; | |
%cl.notReadyCount = ""; | |
centerprint(%cl, "\nPress FIRE when ready.", 0, 3); | |
} | |
} | |
} | |
function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId) | |
{ | |
%mission = $HostMissionFile[%missionId]; | |
%missionType = $HostTypeName[%missionTypeId]; | |
if(!checkMapExist(%mission, %missionType)) | |
return; // map doesn't exist | |
if(!$Host::TournamentMode && $Host::MapFFA[%mission, %missionType] !$= "" && $Host::MapFFA[%mission, %missionType] == 0) | |
return; // is FFA, but the map can't be played in FFA | |
if(%admin) | |
{ | |
messageAll('MsgAdminChangeMission', '\c2The Admin has changed the mission to %1 (%2).', %missionDisplayName, %typeDisplayName); | |
logEcho("mission changed to " @ %missionDisplayName @ "/" @ %typeDisplayName @ " (admin)"); | |
%game.gameOver(); | |
if($Evo::ETMMode) // player changed the mission, stop ETM mode | |
{ | |
$Evo::ETMMode = false; | |
ETMreset(); | |
} | |
// set a flag, so next map the skip mission vote won't start | |
$AdminChangedMission = 1; | |
loadMission(%mission, %missionType, false); | |
} | |
else | |
{ | |
%totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; | |
// Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - ZOD | |
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) | |
{ | |
messageAll('MsgVotePassed', '\c2The mission was changed to %1 (%2) by vote.', %missionDisplayName, %typeDisplayName); | |
logEcho("mission changed to " @ %missionDisplayName @ "/" @ %typeDisplayName @ " (vote)"); | |
%game.gameOver(); | |
if($Evo::ETMMode) // player changed the mission, stop ETM mode | |
{ | |
$Evo::ETMMode = false; | |
ETMreset(); | |
} | |
loadMission(%mission, %missionType, false); | |
} | |
else | |
messageAll('MsgVoteFailed', '\c2Change mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); | |
} | |
} | |
function DefaultGame::voteFFA2Mode(%game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId) | |
{ | |
%mission = $HostMissionFile[%missionId]; | |
%missionType = $HostTypeName[%missionTypeId]; | |
if(!checkMapExist(%mission, %missionType)) | |
return; // the map doesn't exist | |
if($Host::MapFFA[%mission, %missionType] !$= "" && $Host::MapFFA[%mission, %missionType] == 0) | |
return; // the map can't be played in FFA | |
if(%admin) | |
{ | |
messageAll('MsgAdminForce', '\c2The Admin has switched the server to Free For All mode.'); | |
setModeFFA(%mission, %missionType); | |
} | |
else | |
{ | |
%totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; | |
// Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - ZOD | |
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) | |
{ | |
messageAll('MsgVotePassed', '\c2Server switched to Free For All mode by vote.'); | |
setModeFFA(%mission, %missionType); | |
} | |
else | |
messageAll('MsgVoteFailed', '\c2Free For All mode vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); | |
} | |
} | |
function DefaultGame::voteFFAMode( %game, %admin, %client ) | |
{ | |
%cause = ""; | |
%name = getTaggedString(%client.name); | |
if (%admin) | |
{ | |
messageAll('MsgAdminForce', '\c2The Admin has switched the server to Free For All mode.', %client); | |
setModeFFA( findNextCycleMission(), $CurrentMissionType); | |
%cause = "(admin)"; | |
} | |
else | |
{ | |
%totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; | |
// Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - ZOD | |
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) | |
{ | |
messageAll('MsgVotePassed', '\c2Server switched to Free For All mode by vote.', %client); | |
setModeFFA( findNextCycleMission(), $CurrentMissionType); | |
%cause = "(vote)"; | |
} | |
else | |
messageAll('MsgVoteFailed', '\c2Free For All mode vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); | |
} | |
if(%cause !$= "") | |
logEcho("free for all set "@%cause); | |
} | |
function DefaultGame::voteChangeTimeLimit(%game, %admin, %newLimit) | |
{ | |
if(%newLimit == 999) | |
%display = "unlimited"; | |
else | |
%display = %newLimit; | |
%cause = ""; | |
if(%admin) | |
{ | |
messageAll('MsgAdminForce', '\c2The Admin changed the mission time limit to %1 minutes.', %display); | |
$Host::TimeLimit = %newLimit; | |
%cause = "(admin)"; | |
// reset the voted time limit when changing mission | |
if($Host::EvoDefaultTimeLimit) | |
$Evo_DefaultTimeLimit = 1; | |
} | |
else if($Host::EvoAllowPlayerVoteTimeLimit) | |
{ | |
%totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; | |
// Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - ZOD | |
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) | |
{ | |
messageAll('MsgVotePassed', '\c2The mission time limit was set to %1 minutes by vote.', %display); | |
$Host::TimeLimit = %newLimit; | |
%cause = "(vote)"; | |
// reset the voted time limit when changing mission | |
if($Host::EvoDefaultTimeLimit) | |
$Evo_DefaultTimeLimit = 1; | |
} | |
else | |
messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); | |
} | |
//if the time limit was actually changed... | |
if(%cause !$= "") | |
{ | |
logEcho("time limit set to " @ %display SPC %cause); | |
//if the match has been started, reset the end of match countdown | |
if($matchStarted) | |
{ | |
//schedule the end of match countdown | |
%elapsedTimeMS = getSimTime() - $missionStartTime; | |
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) - %elapsedTimeMS; | |
CancelEndCountdown(); | |
if ( %newLimit != 999 ) | |
{ | |
EndCountdown(%curTimeLeftMS); | |
cancel( %game.timeSync ); | |
%game.checkTimeLimit( true ); | |
} | |
else | |
{ | |
cancel(%game.timeSync); | |
} | |
} | |
} | |
} | |
function DefaultGame::sendTimeLimitList(%game, %client, %key) | |
{ | |
if(!$Host::TournamentMode) | |
%list = $Host::EvoTimeLimitList; | |
else | |
%list = ""; | |
if(%list $= "" || %client.isAdmin) | |
Parent::sendTimeLimitList(%game, %client, %key); | |
else | |
{ | |
// Run through list sending them to the client | |
for(%i = 0; (%time = getWord(%list, %i)) !$= ""; %i++) | |
{ | |
%text = (%time == 999) ? 'No time limit' : %time @ " time limit"; | |
messageClient(%client, 'MsgVoteItem', "", %key, %time, "", %text); | |
} | |
} | |
} | |
function DefaultGame::passRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) | |
{ | |
if ( %admin && Game.scheduleVote !$= "" ) | |
{ | |
passCurrentVote(); | |
messageAll('MsgAdminForce', '\c2The admin has passed the vote.' ); | |
} | |
} | |
function DefaultGame::stopRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) | |
{ | |
if(%admin && Game.scheduleVote !$= "") | |
{ | |
stopCurrentVote(); | |
messageAll('MsgAdminForce', '\c2The Admin stopped the vote.~wfx/misc/bounty_completed.wav'); | |
} | |
} | |
function DefaultGame::voteSkipMission(%game, %admin, %missionName, %missionType, %arg3, %arg4) | |
{ | |
%realTotalVotes = %game.totalVotesFor + %game.totalVotesAgainst; | |
%totalVotes = %game.totalVotesFor + %game.totalVotesAgainst + %game.totalVotesNone; | |
if(%realTotalVotes > 0 && (%game.totalVotesFor / %totalVotes) > ($Host::VotePasspercent / 100)) | |
{ | |
messageAll('MsgVotePassed', '\c2The mission was skipped to %1 by vote.', %missionName); | |
%game.gameOver(); | |
loadMission(%missionName, %missionType, false); | |
} | |
else | |
messageAll('MsgVoteFailed', '\c2Skip mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/%totalVotes * 100)); | |
} | |
function DefaultGame::switchCRCCheck(%game, %admin) | |
{ | |
if(!%admin) | |
return; | |
if($Host::CRCTextures) | |
messageAll('MsgAdminForce', '\c2The Admin has disabled CRC checking.'); | |
else | |
messageAll('MsgAdminForce', '\c2The Admin has enabled CRC checking.'); | |
messageAll('MsgServerRestart', '\c2SERVER WILL REBOOT IN 10 SECONDS!'); | |
%banRowCount = 0; | |
// read the file | |
%read = new fileObject(); | |
%read.openForRead($serverprefs); | |
while(!%read.isEOF()) | |
{ | |
%banRow[%banRowCount++] = %read.readLine(); | |
if(strstr(%banRow[%banRowCount], "$Host::CRCTextures") != -1) | |
%lineRow = %banRowCount; // found | |
} | |
%read.close(); | |
%read.delete(); | |
// append the new line to the file | |
%write = new fileObject(); | |
%write.openForWrite($serverprefs); | |
for(%x = 1; %x <= %banRowCount; %x++) | |
{ | |
if(%x != %lineRow) | |
%write.writeLine(%banRow[%x]); | |
else | |
{ | |
if($Host::CRCTextures) | |
%write.writeLine("$Host::CRCTextures = 0;"); | |
else | |
%write.writeLine("$Host::CRCTextures = 1;"); | |
} | |
} | |
%write.close(); | |
%write.delete(); | |
$CRCCountdownStarted = 1; | |
$CRCRestartSchedule = schedule(10000, 0, reallyQuit); | |
} | |
function DefaultGame::cancelServerRestart(%game, %admin) | |
{ | |
if(%admin && $CRCCountdownStarted) | |
{ | |
$CRCCountdownStarted = 0; | |
// cancel the restart | |
if(isEventPending($CRCRestartSchedule)) | |
cancel($CRCRestartSchedule); | |
messageAll('MsgServerRestart', '\c2SERVER RESTART HAS BEEN CANCELED.~wfx/misc/diagnostic_on.wav'); | |
} | |
} | |
function DefaultGame::clearServerforMatch(%game, %admin) | |
{ | |
for ( %i = 0; %i < ClientGroup.getCount(); %i++ ) | |
{ | |
%client = ClientGroup.getObject(%i); | |
if (!%client.isAdmin) | |
{ | |
if( isObject( %client.player ) ) | |
%client.player.scriptKill(0); | |
if ( isObject( %client ) ) | |
{ | |
%client.setDisconnectReason( "The server has been cleared for a match/scrimmage." ); | |
%client.schedule(700, "delete"); | |
} | |
} | |
} | |
messageall(0, "Server has been cleared for match/scrimmage.~wfx/powered/nexus_deny.wav"); | |
} | |
function CTFGame::getTeamName(%game, %team) | |
{ | |
if ( $Evo::ThisMission::TeamName[%team] !$= "" ) | |
{ | |
return $Evo::ThisMission::TeamName[%team]; | |
} | |
if($Evo::ETMMode && %team != 0) | |
return $ETMmode::Team[$ETMCMap, %team]; | |
return parent::getTeamName( %game, %team ); | |
} | |
function CTFGame::flagReturn(%game, %flag, %player) | |
{ | |
// Kill the lava scedule - Ilys | |
if(isEventPending(%flag.lavaEnterThread)) | |
cancel(%flag.lavaEnterThread); | |
cancel($FlagReturnTimer[%flag]); | |
$FlagReturnTimer[%flag] = ""; | |
if(%flag.team == 1) | |
%otherTeam = 2; | |
else | |
%otherTeam = 1; | |
%teamName = %game.getTeamName(%flag.team); | |
// when the flag return, stop observing the flag, and go in observerFly mode | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0 && %cl.observingFlag && %cl.flagObsTeam == %flag.team) | |
{ | |
%cl.camera.mode = "observerFly"; | |
%cl.camera.setFlyMode(); | |
updateObserverFlyHud(%cl); | |
%cl.observingFlag = false; | |
%cl.flagObserved = ""; | |
%cl.flagObsTeam = ""; | |
} | |
} | |
if(%player !$= "") | |
{ | |
//a player returned it | |
%client = %player.client; | |
// if it's a mid air return, bottomprint a message | |
// <KATER> No, we do not really want that silly MA return message! | |
// </KATER> | |
messageTeamExcept(%client, 'MsgCTFFlagReturned', '\c2Teammate %1 returned your flag to base.~wfx/misc/flag_return.wav', %client.name, 0, %flag.team); | |
messageTeam(%otherTeam, 'MsgCTFFlagReturned', '\c2Enemy %1 returned the %2 flag.~wfx/misc/flag_return.wav', %client.name, %teamName, %flag.team); | |
messageTeam(0, 'MsgCTFFlagReturned', '\c2%1 returned the %2 flag.~wfx/misc/flag_return.wav', %client.name, %teamName, %flag.team); | |
messageClient(%client, 'MsgCTFFlagReturned', '\c2You returned your flag.~wfx/misc/flag_return.wav', %client.name, %teamName, %flag.team); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name | |
logEcho(%client.nameBase @ " (pl " @ %player @ "/cl " @ %client @ ") returned team " @ %flag.team @ " flag"); | |
// find out what type of return it is | |
// stalemate return? | |
if(%game.stalemate) | |
{ | |
%game.awardScoreStalemateReturn(%player.client); | |
} | |
else // regular return | |
{ | |
%enemyFlagDist = vectorDist($flagPos[%flag.team], $flagPos[%otherTeam]); | |
%dist = vectorDist(%flag.position, %flag.originalPosition); | |
%rawRatio = %dist/%enemyFlagDist; | |
%ratio = %rawRatio < 1 ? %rawRatio : 1; | |
%percentage = mFloor( (%ratio) * 10 ) * 10; | |
%game.awardScoreFlagReturn(%player.client, %percentage); | |
} | |
} | |
else | |
{ | |
//returned due to timer | |
messageTeam(%otherTeam, 'MsgCTFFlagReturned', '\c2The %2 flag was returned to base.~wfx/misc/flag_return.wav', 0, %teamName, %flag.team); //because it was dropped for too long | |
messageTeam(%flag.team, 'MsgCTFFlagReturned', '\c2Your flag was returned.~wfx/misc/flag_return.wav', 0, 0, %flag.team); | |
messageTeam(0, 'MsgCTFFlagReturned', '\c2The %2 flag was returned to base.~wfx/misc/flag_return.wav', 0, %teamName, %flag.team); | |
logEcho("team " @ %flag.team @ " flag returned (timeout)"); | |
} | |
%game.flagReset(%flag); | |
} | |
function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) | |
{ | |
// z0dd, ZOD - 9/27/02. Player must wait to grab after throwing it | |
if((%player.flagTossWait !$= "") && %player.flagTossWait) | |
return false; | |
// z0dd - ZOD, 9/28/02. Hack for flag collision bug. SquirrelOfDeath, 10/02/02: Moved from PlayerTouchFlag | |
cancel(%flag.searchSchedule); | |
// z0dd - ZOD, 8/4/02. Cancel this flag's thread to KineticPoet's flag updater | |
cancel(%game.updateFlagThread[%flag]); | |
%game.flagHeldTime[%flag] = getSimTime(); // z0dd - ZOD, 8/15/02. Store time player grabbed flag. | |
%client = %player.client; | |
%player.holdingFlag = %flag; //%player has this flag | |
%flag.carrier = %player; //this %flag is carried by %player | |
// attach the camera to the flag.carrier | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0 && %cl.observingFlag && %cl.flagObsTeam == %flag.team) | |
observeFlag(%cl, %player.client, 2, %flag.team); | |
} | |
%player.mountImage(FlagImage, $FlagSlot, true, %game.getTeamSkin(%flag.team)); | |
%game.playerGotFlagTarget(%player); | |
//only cancel the return timer if the player is in bounds... | |
if(!%client.outOfBounds) | |
{ | |
cancel($FlagReturnTimer[%flag]); | |
$FlagReturnTimer[%flag] = ""; | |
} | |
// if it's a mid air grab, bottomprint a message | |
//if this flag was "at home", see if both flags have now been taken | |
if(%flag.isHome) | |
{ | |
// tiebreaker score | |
%game.awardScoreFlagTouch( %client, %flag ); | |
%startStalemate = false; | |
if($TeamFlag[1] == %flag) | |
%startStalemate = !$TeamFlag[2].isHome; | |
else | |
%startStalemate = !$TeamFlag[1].isHome; | |
if(%startStalemate) | |
%game.stalemateSchedule = %game.schedule(%game.stalemateTimeMS, beginStalemate); | |
// Store time player grabbed flag | |
if($Host::EvoStats) | |
{ | |
%game.flagGrabHeldTime[%flag] = getSimTime(); | |
$Evo::stats::grabs[%client]++; | |
if($Evo::stats::grabs[%client] > $Evo::stats::grabs_counter) | |
{ | |
$Evo::stats::grabs_counter = $Evo::stats::grabs[%client]; | |
$Evo::stats::grabs_client = getTaggedString(%client.name); | |
} | |
} | |
} | |
if($Host::EvoStats && !%player.flagStatsWait && (!$Host::TournamentMode || ($Host::TournamentMode && $Host::EvoStatsTourney))) | |
{ | |
// get the grab speed | |
%grabspeed = mFloor(VectorLen(setWord(%player.getVelocity(), 2, 0)) * 3.6); | |
if(%grabspeed > $Evo::stats::MaxGrabSpeed || ($Evo::stats::MaxGrabSpeed $= "")) | |
{ | |
$Evo::stats::MaxGrabSpeed = %grabspeed; | |
$Evo::stats::Grabber = getTaggedString(%client.name); | |
} | |
} | |
%flag.hide(true); | |
%flag.startFade(0, 0, false); | |
%flag.isHome = false; | |
if(%flag.stand) | |
%flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand | |
$flagStatus[%flag.team] = %client.nameBase; | |
%teamName = %game.getTeamName(%flag.team); | |
if(%grabspeed) | |
{ | |
messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); | |
messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed); | |
messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); | |
messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); | |
} | |
else | |
{ | |
messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag.~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase); | |
messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1!~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase); | |
messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag.~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase); | |
messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag.~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase); | |
} | |
logEcho(%client.nameBase @ " (pl " @ %player @ "/cl " @ %client @ ") took team " @ %flag.team @ " flag"); | |
//call the AI function | |
%game.AIplayerTouchEnemyFlag(%player, %flag); | |
//if the player is out of bounds, then in 3 seconds, it should be thrown back towards the in bounds area... | |
if(%client.outOfBounds) | |
%game.schedule(3000, "boundaryLoseFlag", %player); | |
} | |
function CTFGame::playerDroppedFlag(%game, %player) | |
{ | |
%client = %player.client; | |
%flag = %player.holdingFlag; | |
// z0dd - ZOD, 8/4/02, Call to KineticPoet's flag updater | |
%game.updateFlagTransform(%flag); | |
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? | |
// reset cap time | |
if($Host::EvoStats) | |
%game.flagGrabHeldTime[%flag] = 0; | |
%game.playerLostFlagTarget(%player); | |
%player.holdingFlag = ""; //player isn't holding a flag anymore | |
%flag.carrier = ""; //flag isn't held anymore | |
$flagStatus[%flag.team] = "<In the Field>"; | |
// attach the camera again to the flag | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0 && %cl.observingFlag && %cl.flagObsTeam == %flag.team) | |
observeFlag(%cl, $TeamFlag[%flag.team], 1, %flag.team); | |
} | |
%player.unMountImage($FlagSlot); | |
%flag.hide(false); //Does the throwItem function handle this? | |
%teamName = %game.getTeamName(%flag.team); | |
messageTeamExcept(%client, 'MsgCTFFlagDropped', '\c2Teammate %1 dropped the %2 flag. (Held: %4)~wfx/misc/flag_drop.wav', %client.name, %teamName, %flag.team, %held); // z0dd - ZOD, 8/15/02. How long flag was held | |
messageTeam(%flag.team, 'MsgCTFFlagDropped', '\c2Your flag has been dropped by %1! (Held: %4)~wfx/misc/flag_drop.wav', %client.name, 0, %flag.team, %held); // z0dd - ZOD, 8/15/02. How long flag was held | |
messageTeam(0, 'MsgCTFFlagDropped', '\c2%1 dropped the %2 flag. (Held: %4)~wfx/misc/flag_drop.wav', %client.name, %teamName, %flag.team, %held); // z0dd - ZOD, 8/15/02. How long flag was held | |
if(!%player.client.outOfBounds) | |
messageClient(%client, 'MsgCTFFlagDropped', '\c2You dropped the %2 flag. (Held: %4)~wfx/misc/flag_drop.wav', %client.name, %teamName, %flag.team, %held); // z0dd - ZOD, 8/15/02. How long flag was held | |
logEcho(%client.nameBase @ " (pl " @ %player @ "/cl " @ %client @ ") dropped team " @ %flag.team @ " flag" @ " (Held: " @ %held @ ")"); | |
//don't duplicate the schedule if there's already one in progress... | |
if($FlagReturnTimer[%flag] <= 0) | |
$FlagReturnTimer[%flag] = %game.schedule(%game.FLAG_RETURN_DELAY - %game.fadeTimeMS, "flagReturnFade", %flag); | |
//call the AI function | |
%game.AIplayerDroppedFlag(%player, %flag); | |
} | |
function CTFGame::boundaryLoseFlag(%game, %player) | |
{ | |
// this is called when a player goes out of the mission area while holding | |
// the enemy flag. - make sure the player is still out of bounds | |
if(!%player.client.outOfBounds || !isObject(%player.holdingFlag)) | |
return; | |
// z0dd - ZOD - SquirrelOfDeath, 9/27/02. Delay on grabbing flag after tossing it | |
%player.flagTossWait = true; | |
%player.schedule(1000, resetFlagTossWait); | |
// Delay on calculating stats | |
%player.flagStatsWait = true; | |
%player.schedule(5000, resetFlagStatsWait); | |
%client = %player.client; | |
%flag = %player.holdingFlag; | |
%flag.setVelocity("0 0 0"); | |
%flag.setTransform(%player.getWorldBoxCenter()); | |
%flag.setCollisionTimeout(%player); | |
// reset cap time | |
if($Host::EvoStats) | |
%game.flagGrabHeldTime[%flag] = 0; | |
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? | |
%game.playerDroppedFlag(%player); | |
// now for the tricky part -- throwing the flag back into the mission area | |
// let's try throwing it back towards its "home" | |
%home = %flag.originalPosition; | |
%vecx = firstWord(%home) - firstWord(%player.getWorldBoxCenter()); | |
%vecy = getWord(%home, 1) - getWord(%player.getWorldBoxCenter(), 1); | |
%vecz = getWord(%home, 2) - getWord(%player.getWorldBoxCenter(), 2); | |
%vec = %vecx SPC %vecy SPC %vecz; | |
// normalize the vector, scale it, and add an extra "upwards" component | |
%vecNorm = VectorNormalize(%vec); | |
%vec = VectorScale(%vecNorm, 1500); | |
%vec = vectorAdd(%vec, "0 0 500"); | |
// z0dd - ZOD, 6/09/02. Remove anti-hover so flag can be thrown properly | |
%flag.static = false; | |
// z0dd - ZOD, 10/02/02. Hack for flag collision bug. | |
%flag.searchSchedule = %game.schedule(10, "startFlagCollisionSearch", %flag); | |
// apply the impulse to the flag object | |
%flag.applyImpulse(%player.getWorldBoxCenter(), %vec); | |
messageClient(%player.client, 'MsgCTFFlagDropped', '\c1You have left the mission area and lost the flag. (Held: %4)~wfx/misc/flag_drop.wav', %client.name, 0, %flag.team, %held); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name | |
logEcho(%player.client.nameBase @ " (pl " @ %player @ "/cl " @ %player.client @ ") lost flag (out of bounds)" @ " (Held: " @ %held @ ")"); | |
} | |
function CTFGame::flagCap(%game, %player) | |
{ | |
%client = %player.client; | |
%flag = %player.holdingFlag; | |
%flag.carrier = ""; | |
// when a player cap the flag, continue observing the player | |
for(%i = 0; %i < ClientGroup.getCount(); %i++) | |
{ | |
%cl = ClientGroup.getObject(%i); | |
if(%cl.team <= 0 && %cl.observingFlag && %cl.flagObsTeam == %flag.team) | |
{ | |
%cl.observingFlag = false; | |
%cl.flagObserved = ""; | |
%cl.flagObsTeam = ""; | |
} | |
} | |
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? | |
%game.playerLostFlagTarget(%player); | |
//award points to player and team | |
%teamName = %game.getTeamName(%flag.team); | |
%otherTeam = %game.getTeamName(%client.team); | |
if($Host::EvoStats) | |
{ | |
if(%game.flagGrabHeldTime[%flag]) // is it a grab-->cap ? | |
{ | |
%held2 = getSimTime() - %game.flagGrabHeldTime[%flag]; | |
%realTime = %game.formatTime(%held2, true); | |
if(%client.team == 1) // first team | |
{ | |
if((%held2 < $Evo::flagstats::heldTeam1) || $Evo::flagstats::heldTeam1 == 0) | |
{ | |
$Evo::flagstats::heldTeam1 = %held2; | |
$Evo::flagstats::realTeam1 = %realTime; | |
$Evo::flagstats::nickTeam1 = %client.nameBase; | |
messageAll('MsgCTFNewRecord', '\c2It\'s a new record! Time: \c3%1', %realTime); | |
%fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; | |
// i need to save this variables in the base directory and the classic directory | |
export("$Evo::flagstats::*", %fileOut, false); | |
export("$Evo::flagstats::*", "../base/stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt", false); | |
} | |
} | |
else if((%held2 < $Evo::flagstats::heldTeam2) || $Evo::flagstats::heldTeam2 == 0) | |
{ | |
$Evo::flagstats::heldTeam2 = %held2; | |
$Evo::flagstats::realTeam2 = %realTime; | |
$Evo::flagstats::nickTeam2 = %client.nameBase; | |
messageAll('MsgCTFNewRecord', '\c2It\'s a new record! Time: \c3%1', %realTime); | |
%fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; | |
// i need to save this variables in the base directory and the classic directory | |
export("$Evo::flagstats::*", %fileOut, false); | |
export("$Evo::flagstats::*", "../base/stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt", false); | |
} | |
if(!$Host::TournamentMode || ($Host::TournamentMode && $Host::EvoStatsTourney)) | |
bottomprint(%client, "You captured the flag in " @ %realTime @ " seconds", 3); | |
$Evo::stats::caps[%client]++; | |
if($Evo::stats::caps[%client] > $Evo::stats::caps_counter) | |
{ | |
$Evo::stats::caps_counter = $Evo::stats::caps[%client]; | |
$Evo::stats::caps_client = getTaggedString(%client.name); | |
} | |
if(%held2 < $Evo::stats::fastestCap || !$Evo::stats::fastestCap) | |
{ | |
$Evo::stats::fastestCap = %held2; | |
$Evo::stats::fastcap_time = %realTime; | |
$Evo::stats::fastcap_client = getTaggedString(%client.name); | |
} | |
} | |
} | |
if(%game.flagGrabHeldTime[%flag]) | |
{ | |
messageTeamExcept(%client, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %realTime); | |
messageTeam(%flag.team, 'MsgCTFFlagCapped', '\c2Your flag was captured by %1. (Held: %5)~wfx/misc/flag_lost.wav', %client.name, 0, %flag.team, %client.team, %realTime); | |
messageTeam(0, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %realTime); | |
messageClient(%client, 'MsgCTFFlagCapped', '\c2You captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %realTime); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name | |
} | |
else | |
{ | |
messageTeamExcept(%client, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); | |
messageTeam(%flag.team, 'MsgCTFFlagCapped', '\c2Your flag was captured by %1. (Held: %5)~wfx/misc/flag_lost.wav', %client.name, 0, %flag.team, %client.team, %held); | |
messageTeam(0, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); | |
messageClient(%client, 'MsgCTFFlagCapped', '\c2You captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name | |
} | |
logEcho(%client.nameBase @ " (pl " @ %player @ "/cl " @ %client @ ") capped team " @ %client.team @ " flag" @ " (Held: " @ %held @ ")"); | |
%player.holdingFlag = ""; //no longer holding it. | |
%player.unMountImage($FlagSlot); | |
%game.awardScoreFlagCap(%client, %flag); | |
%game.flagReset(%flag); | |
//call the AI function | |
%game.AIflagCap(%player, %flag); | |
//if this cap didn't end the game, play the announcer... | |
if($missionRunning) | |
{ | |
// classic uses only storm/inferno | |
if(%game.getTeamName(%client.team) $= 'Inferno' || ($Evo::ETMMode && (%otherTeam $= $ETMmode::Team[$ETMCMap, 2]))) | |
messageAll("", '~wvoice/announcer/ann.infscores.wav'); | |
else if(%game.getTeamName(%client.team) $= 'Storm' || ($Evo::ETMMode && (%otherTeam $= $ETMmode::Team[$ETMCMap, 1]))) | |
messageAll("", '~wvoice/announcer/ann.stoscores.wav'); | |
} | |
} | |
function Observer::onTrigger(%data, %obj, %trigger, %state) | |
{ | |
if (%state == 0 || %trigger > 5) | |
return; | |
//first, give the game the opportunity to prevent the observer action | |
if (!Game.ObserverOnTrigger(%data, %obj, %trigger, %state)) | |
return; | |
%client = %obj.getControllingClient(); | |
if (%client == 0) | |
return; | |
switch$(%obj.mode) | |
{ | |
case "followFlag": | |
if(!%client.observingFlag) | |
return; | |
if(%trigger == 0) // press FIRE, switch to the other flag | |
{ | |
if(%client.flagObserved == $TeamFlag[1]) | |
{ | |
%otherFlag = $TeamFlag[2]; | |
%otherFlagTeam = 2; | |
} | |
else if(%client.flagObserved == $TeamFlag[2]) | |
{ | |
%otherFlag = $TeamFlag[1]; | |
%otherFlagTeam = 1; | |
} | |
else | |
return; | |
// the flag isn't carried | |
if(%otherFlag.carrier $= "") | |
observeFlag(%client, %otherFlag, 1, %otherFlagTeam); | |
else if(isObject(%otherFlag.carrier.client)) | |
observeFlag(%client, %otherFlag.carrier.client, 2, %otherFlagTeam); | |
} | |
else if(%trigger == 3) // press JET, switch to the other flag | |
{ | |
if(%client.flagObserved == $TeamFlag[1]) | |
{ | |
%otherFlag = $TeamFlag[2]; | |
%otherFlagTeam = 2; | |
} | |
else if(%client.flagObserved == $TeamFlag[2]) | |
{ | |
%otherFlag = $TeamFlag[1]; | |
%otherFlagTeam = 1; | |
} | |
else | |
return; | |
// the flag isn't carried | |
if(%otherFlag.carrier $= "") | |
observeFlag(%client, %otherFlag, 1, %otherFlagTeam); | |
else if(isObject(%otherFlag.carrier.client)) | |
observeFlag(%client, %otherFlag.carrier.client, 2, %otherFlagTeam); | |
} | |
else if(%trigger == 2) //press JUMP, stop observing flag | |
{ | |
if(%client.observeClient != -1) | |
{ | |
observerFollowUpdate(%client, -1, false); | |
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); | |
%client.observeClient = -1; | |
} | |
%obj.mode = "observerFly"; | |
%obj.setFlyMode(); | |
updateObserverFlyHud(%client); | |
%client.observingFlag = false; | |
%client.flagObserved = ""; | |
%client.flagObsTeam = ""; | |
} | |
default: | |
Parent::onTrigger(%data, %obj, %trigger, %state); | |
} | |
} | |
function Observer::setMode(%data, %obj, %mode, %targetObj) | |
{ | |
if(%mode $= "") | |
return; | |
%client = %obj.getControllingClient(); | |
if(%client $= "") | |
return; | |
switch$(%mode) | |
{ | |
case "followFlag": | |
%transform = %targetObj.getTransform(); | |
// observe the flag 2x more far than the normal | |
%obj.setOrbitMode(%targetObj, %transform, 1.0, 9.0, 9.0); | |
default: | |
Parent::setMode(%data, %obj, %mode, %targetObj); | |
} | |
%obj.mode = %mode; | |
} | |
function serverCmdObserveFirstFlag(%client) | |
{ | |
// works only for CTF | |
if(Game.class !$= CTFGame) | |
return; | |
// client must be an observer | |
if(%client.team > 0) | |
return; | |
// check if the flag is carried by someone | |
%player = $TeamFlag[1].carrier; | |
if($TeamFlag[1].isHome || %player $= "") | |
observeFlag(%client, $TeamFlag[1], 1, 1); | |
else | |
observeFlag(%client, %player.client, 2, 1); | |
} | |
function serverCmdObserveSecondFlag(%client) | |
{ | |
// works only for CTF | |
if(Game.class !$= CTFGame) | |
return; | |
// client must be an observer | |
if(%client.team > 0) | |
return; | |
// check if the flag is carried by someone | |
%player = $TeamFlag[2].carrier; | |
if($TeamFlag[2].isHome || %player $= "") | |
observeFlag(%client, $TeamFlag[2], 1, 2); | |
else | |
observeFlag(%client, %player.client, 2, 2); | |
} | |
function observeFlag(%client, %target, %type, %flagTeam) | |
{ | |
if(!isObject(%client) || !isObject(%target) || !isObject(%client.camera)) | |
return; | |
if(Game.class !$= CTFGame) | |
return; | |
if(%client.team > 0) | |
return; | |
// cancel any scheduled update | |
if(isEventPending(%client.obsHudSchedule)) | |
cancel(%client.obsHudSchedule); | |
// must be an observer when observing other clients | |
if(%client.getControlObject() != %client.camera) | |
return; | |
//can't observer yourself | |
if(%client == %target) | |
return; | |
%count = ClientGroup.getCount(); | |
//can't go into observer mode if you're the only client | |
if(%count <= 1 && %type != 1) | |
return; | |
if(%type == 1) // Flag | |
{ | |
if(isObject(%client.player)) | |
%client.player.scriptKill(0); // the player is still playing (this shouldn't be happen) | |
%client.camera.getDataBlock().setMode(%client.camera, "followFlag", $TeamFlag[%flagTeam]); | |
%client.setControlObject(%client.camera); | |
clearBottomPrint(%client); | |
// was the client observing a player before? | |
if(%client.observeClient != -1) | |
{ | |
observerFollowUpdate(%client, -1, false); | |
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); | |
%client.observeClient = -1; | |
} | |
} | |
else // Player | |
{ | |
// make sure the target actually exists | |
if(%target > 0) | |
{ | |
%found = false; | |
for(%i = 0; %i < %count; %i++) | |
{ | |
if(ClientGroup.getObject(%i) == %target) | |
{ | |
%found = true; | |
break; | |
} | |
} | |
if(!%found) | |
return; | |
} | |
if(isObject(%client.player)) | |
%client.player.scriptKill(0); // the player is still playing (this shouldn't be happen) | |
observerFollowUpdate(%client, %target, true); | |
displayObserverHud(%client, %target); | |
messageClient(%target, 'Observer', '\c1%1 is now observing you.', %client.name); | |
// was the client observing a player before? | |
if(%client.observeClient != -1) | |
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); | |
%client.camera.getDataBlock().setMode(%client.camera, "observerFollow", %target.player); | |
%client.setControlObject(%client.camera); | |
%client.observeClient = %target; | |
} | |
//clear the observer fly mode var... | |
%client.observeFlyClient = -1; | |
%client.observingFlag = true; | |
%client.flagObserved = $TeamFlag[%flagTeam]; | |
%client.flagObsTeam = %flagTeam; | |
} | |
function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %playerVote) | |
{ | |
%isAdmin = (%client.isAdmin || %client.isSuperAdmin); | |
if(!%client.canVote && !%isAdmin) | |
return; | |
// Sinbinned players cannot take action | |
if ( %client.SinBinned ) | |
return; | |
%clientsVoting = 0; | |
// z0dd - ZOD, 5/19/03. Get the Admins client. | |
if(%isAdmin) | |
$AdminCl = %client; | |
// Is this a tricon style call | |
if ( TriconWrapper( %client, %arg1, %typename ) ) | |
return; | |
switch$(%typename) | |
{ | |
case "VoteKickPlayer": | |
if(%isAdmin && %client != %arg1) // client is an admin and the player to kick isn't the player himself | |
{ | |
if(!%client.isSuperAdmin && %arg1.isAdmin) // only super admins can kick admins | |
{ | |
messageClient(%client, '', '\c2You can not kick %1, %2 is an Admin!', %arg1.name, %arg1.sex $= "Male" ? 'he' : 'she'); | |
return; | |
} | |
Game.kickClientName = %arg1.name; | |
kick(%arg1, %client, %arg1.guid); // kick the player without entering the vote process | |
%authInfo = %arg1.getAuthInfo(); | |
adminLog(%client, " kicked " @ %arg1.nameBase @ "( " @ getField(%authInfo, 0) @ ", " @ getField(%authInfo, 1) @ ", " @ %arg1.guid @ ", " @ %arg1.getAddress() @ ")"); | |
} | |
else // normal vote | |
{ | |
if(%arg1.isAdmin) // don't let players to kick admins | |
{ | |
messageClient(%client, '', '\c2You can not kick %1, %2 is an Admin!', %arg1.name, %arg1.sex $= "Male" ? 'he' : 'she'); | |
return; | |
} | |
if(%client.team != %arg1.team && %arg1.team != 0) // kick works only with teammates or observers | |
{ | |
messageClient(%client, '', '\c2Kick votes must be team based.'); | |
return; | |
} | |
if(Game.scheduleVote !$= "") // a vote is already in progress | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
Game.kickClient = %arg1; | |
Game.kickClientName = %arg1.name; | |
Game.kickGuid = %arg1.guid; | |
Game.kickTeam = %arg1.team; | |
if(%arg1.team != 0 && Game.numTeams > 1) | |
{ | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(%cl.team == %client.team && !%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "kick player", %arg1.name); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting, true); | |
} | |
else | |
{ | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "kick player", %arg1.name); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
} | |
case "BanPlayer": | |
if((%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminBan)) && %client != %arg1) // only admins can use ban | |
{ | |
if(!%client.isSuperAdmin && %arg1.isAdmin) // only super admins can ban admins | |
{ | |
messageClient(%client, '', '\c2You can not ban %1, %2 is an Admin!', %arg1.name, %arg1.sex $= "Male" ? 'he' : 'she'); | |
return; | |
} | |
ban(%arg1, %client); // ban the player without entering the vote process | |
%authInfo = %arg1.getAuthInfo(); | |
adminLog(%client, " banned " @ %arg1.nameBase @ "( " @ getField(%authInfo, 0) @ ", " @ getField(%authInfo, 1) @ ", " @ %arg1.guid @ ", " @ %arg1.getAddress() @ ")"); | |
} | |
case "VoteAdminPlayer": | |
if((%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminAdmin)) && %client != %arg1) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " made " @ %arg1.nameBase @ " an Admin."); | |
} | |
else if($Host::allowAdminPlayerVotes) // normal vote | |
{ | |
if((ClientGroup.getCount() - $HostGameBotCount) < $Host::EvoAdminMinPlayers) | |
return; // ther aren't enough players | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "admin player", %arg1.name); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteChangeMission": | |
if(%isAdmin && !%client.ForceVote ) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " changed the mission to " @ %arg1 @ " (" @ %arg2 @ ")"); | |
} | |
else if($Host::TournamentMode || (!$Host::TournamentMode && $Host::EvoAllowPlayerVoteChangeMission)) | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
%mission = $HostMissionFile[%arg3]; | |
%missionType = $HostTypeName[%arg4]; | |
if(!checkMapExist(%mission, %missionType)) | |
return; // map doesn't exist | |
if(!$Host::TournamentMode && $Host::MapFFA[%mission, %missionType] !$= "" && $Host::MapFFA[%mission, %missionType] == 0) | |
return; // is FFA, but the map can't be played in FFA | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 (%4).', %client.name, "change the mission to", %arg1, %arg2); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteFFAMode": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " changed the server to FFA Mode."); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Free For All Mode.', %client.name, "change the server to"); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteFFA2Mode": // allow players to choose the mission | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " changed the server to FFA Mode."); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
%mission = $HostMissionFile[%arg3]; | |
%missionType = $HostTypeName[%arg4]; | |
if(!checkMapExist(%mission, %missionType)) | |
return; // map doesn't exist | |
if($Host::MapFFA[%mission, %missionType] !$= "" && $Host::MapFFA[%mission, %missionType] == 0) | |
return; // the map can't be played in FFA | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Free For All Mode (%3).', %client.name, "change the server to", %arg1); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteTournamentMode": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " changed the server to Tournament Mode " @ %arg1 @ " (" @ %arg2 @ ")"); | |
} | |
else if(!$Host::TournamentMode && $Host::EvoAllowPlayerVoteTournamentMode) | |
{ | |
if(getAdmin() == 0) | |
{ | |
messageClient(%client, 'clientMsg', 'There must be a server admin to play in Tournament Mode.'); | |
return; | |
} | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Tournament Mode (%3).', %client.name, "change the server to", %arg1); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteMatchStart": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " started the match."); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, "start the match"); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "CancelMatchStart": | |
if(%isAdmin) // only admins can cancel match start | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " canceled match start."); | |
} | |
case "VoteTeamDamage": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, (%arg1 $= "enable team damage" ? " ENABLED team damage." : " DISABLED team damage.")); | |
} | |
else if($Host::TournamentMode || (!$Host::TournamentMode && $Host::EvoAllowPlayerVoteTeamDamage)) | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
%actionMsg = $TeamDamage ? "disable team damage" : "enable team damage"; | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteChangeTimeLimit": | |
if(%isAdmin && !%client.ForceVote ) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " changed the time limit to " @ %arg1); | |
} | |
else if($Host::TournamentMode || (!$Host::TournamentMode && $Host::EvoAllowPlayerVoteTimeLimit)) | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "change the time limit to", %arg1); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteGreedMode": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, (%arg1 $= "enable greed mode" ? " ENABLED Greed mode." : " DISABLED Greed mode.")); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
%actionMsg = Game.greedMode ? "disable Greed mode" : "enable Greed mode"; | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteHoardMode": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, (%arg1 $= "enable hoard mode" ? " ENABLED Hoard mode." : " DISABLED Hoard mode.")); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
%actionMsg = Game.hoardMode ? "disable Hoard mode" : "enable Hoard mode"; | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
case "VoteETMMode": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " changed the server to enhanced Tournament Mode " @ %arg1 @ " (" @ %arg2 @ ")"); | |
} | |
case "modSwitcher": | |
if((%client.isSuperAdmin && $Host::EvoSuperAdminSwitch) || (%client.isAdmin && $Host::EvoAdminSwitch)) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " switched the mod to BASE."); | |
} | |
case "cancelSwitchMod": | |
if((%client.isSuperAdmin && $Host::EvoSuperAdminSwitch) || (%client.isAdmin && $Host::EvoAdminSwitch)) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " canceled mod switch."); | |
} | |
case "passRunningVote": | |
if ((%client.isSuperAdmin && $Host::EvoSuperPassVote) || (%client.isAdmin && $Host::EvoAdminPassVote)) | |
{ | |
adminStartNewVote( %client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " passed the vote in progress."); | |
} | |
case "stopRunningVote": | |
if(%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminStopVotes)) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " stopped the vote in progress."); | |
} | |
case "VoteResetServer": | |
if((%client.isSuperAdmin && $Host::EvoSuperAdminReset) || (%client.isAdmin && $Host::EvoAdminReset)) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " resetted the server."); | |
} | |
case "ForceVote": | |
if (%client.isAdmin && $Host::EvoForcedVotes) | |
{ | |
if (%client.ForceVote) | |
{ | |
%client.ForceVote = 0; | |
messageClient( %client, '', 'Vote to ... cancelled.' ); | |
} | |
else | |
{ | |
%client.ForceVote = 2; | |
messageClient( %client, '', "Now select what to vote on, please." ); | |
} | |
} | |
case "switchCRCCheck": | |
if($Host::EvoSuperAdminCRCCheck && (%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminCRCCheck))) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, (%arg1 $= "Enable CRC Check" ? " ENABLED CRC Check." : " DISABLED CRC Check.")); | |
} | |
case "cancelServerRestart": | |
if(%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminCRCCheck)) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, " canceled a server restart."); | |
} | |
case "clearServerForMatch": | |
if ((%client.isSuperAdmin && $Host::EvoSuperClearServer) || (%client.isAdmin && $Host::EvoAdminClearServer)) | |
{ | |
adminStartNewVote( %client, %typename, %arg1, %arg2, %arg3, %arg4 ); | |
adminLog(%client, " cleared server for match."); | |
} | |
case "showServerRules": | |
if (($Host::EvoServerRules[1] !$= "") && (!%client.CantView)) | |
{ | |
for ( %i = 1; $Host::EvoServerRules[%i] !$= ""; %i++ ) | |
{ | |
messageClient(%client, 'ServerRule', '\c2%1', $Host::EvoServerRules[%i] ); | |
} | |
%client.cantView = true; | |
%client.schedViewRules = schedule( 10000, %client, "resetViewSchedule", %client ); | |
} | |
// | |
// sonic9k 11/6/2003 - Added support for LakRabbit DuelMode option | |
// | |
case "VoteDuelMode": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Duel Mode.', %client.name, (Game.duelMode) ? "disable" : "enable"); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
// | |
// sonic9k 11/6/2003 - Added support for LakRabbit SplashDamage option | |
// | |
case "VoteSplashDamage": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 No Splash Damage.', %client.name, (Game.noSplashDamage) ? "disable" : "enable"); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
//---------------------------- CLASSIC MOD | |
case "VoteArmorLimits": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, %arg3); | |
} | |
case "VoteRandomTeams": | |
if(%isAdmin) | |
{ | |
adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); | |
adminLog(%client, %arg3); | |
} | |
else | |
{ | |
if(Game.scheduleVote !$= "") | |
{ | |
messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); | |
return; | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %arg3, %arg1); | |
%clientsVoting++; | |
} | |
} | |
playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); | |
} | |
} | |
} | |
function resetViewSchedule(%client) | |
{ | |
%client.cantView = false; | |
%client.schedViewRules = ""; | |
} | |
function autoVote(%typeName, %arg1, %arg2, %arg3, %arg4) | |
{ | |
// works only for kicking players or skipping mission | |
if(%typeName !$= "VoteKickPlayer" && %typeName !$= "VoteSkipMission") | |
return; | |
// only works for FFA mode | |
if($Host::TournamentMode) | |
return; | |
// a vote is already running, cancel it | |
if(Game.scheduleVote !$= "") | |
stopCurrentVote(); | |
%clientsVoting = 0; | |
if(%typeName $= "VoteKickPlayer") | |
{ | |
// admins can't be kicked | |
if(%arg1.isAdmin) | |
return; | |
Game.kickClient = %arg1; | |
Game.kickClientName = %arg1.name; | |
Game.kickGuid = %arg1.guid; | |
Game.kickTeam = %arg1.team; | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(%cl.team == %arg1.team && !%cl.isAIControlled() && %cl !$= %arg1) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2Vote initiated to kick the teamkiller %1.', %arg1.name); | |
%clientsVoting++; | |
} | |
} | |
for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++) | |
{ | |
%cl = ClientGroup.getObject(%clientIndex); | |
if(%cl.team == %arg1.team && !%cl.isAIControlled() && %cl !$= %arg1) | |
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); | |
} | |
} | |
else if(%typeName $= "VoteSkipMission") | |
{ | |
if(!checkMapExist(%arg1, %arg2)) | |
return; // map doesn't exist | |
if($Host::MapFFA[%arg1, %arg2] !$= "" && $Host::MapFFA[%arg1, %arg2] == 0) | |
return; // the map can't be played in FFA | |
// don't start the vote if the server is empty | |
if((ClientGroup.getCount() - $HostGameBotCount) == 0) | |
return; | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled() && %cl.isReady) | |
{ | |
messageClient(%cl, 'VoteStarted', '\c2Vote initiated to skip the mission to %1.', %arg1); | |
%clientsVoting++; | |
} | |
} | |
for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++) | |
{ | |
%cl = ClientGroup.getObject(%clientIndex); | |
if(!%cl.isAIControlled() && %cl.isReady) | |
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); | |
} | |
} | |
clearVotes(); | |
Game.voteType = %typeName; | |
Game.scheduleVote = schedule(($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4); | |
Game.scheduleVoteArgs[typename] = %typename; | |
Game.scheduleVoteArgs[arg1] = %arg1; | |
Game.scheduleVoteArgs[arg2] = %arg2; | |
Game.scheduleVoteArgs[arg3] = %arg3; | |
Game.scheduleVoteArgs[arg4] = %arg4; | |
} | |
function calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4) | |
{ | |
if(%typeName $= "voteMatchStart") | |
{ | |
if(($MatchStarted || $countdownStarted) && Game.scheduleVote !$= "") | |
{ | |
stopCurrentVote(); | |
return; | |
} | |
} | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
messageClient(%cl, 'closeVoteHud', ""); | |
if(%cl.vote !$= "") | |
{ | |
if(%cl.vote) | |
{ | |
Game.votesFor[%cl.team]++; | |
Game.totalVotesFor++; | |
} | |
else | |
{ | |
Game.votesAgainst[%cl.team]++; | |
Game.totalVotesAgainst++; | |
} | |
} | |
else | |
{ | |
Game.votesNone[%cl.team]++; | |
Game.totalVotesNone++; | |
} | |
} | |
Game.evalVote(%typeName, false, %arg1, %arg2, %arg3, %arg4); | |
Game.scheduleVote = ""; | |
Game.scheduleVoteArgs = ""; | |
Game.kickClient = ""; | |
clearVotes(); | |
} | |
function passCurrentVote() // Edit GG | |
{ | |
cancel(Game.scheduleVote); | |
Game.totalVotesFor = ClientGroup.getCount() - $HostGameBotCount; | |
Game.totalVotesAgainst = 0; | |
Game.evalVote(Game.scheduleVoteArgs[typeName], false, Game.scheduleVoteArgs[arg1], Game.scheduleVoteArgs[arg2], Game.scheduleVoteArgs[arg3], Game.scheduleVoteArgs[arg4]); | |
Game.scheduleVote = ""; | |
Game.scheduleVoteArgs = ""; | |
Game.kickClient = ""; | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
messageClient(%cl, 'closeVoteHud', ""); | |
if(%cl.team != 0) | |
clearBottomPrint(%cl); | |
} | |
clearVotes(); | |
} | |
function stopCurrentVote() | |
{ | |
cancel(Game.scheduleVote); | |
Game.scheduleVote = ""; | |
Game.kickClient = ""; | |
Game.scheduleVoteArgs = ""; | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
messageClient(%cl, 'closeVoteHud', ""); | |
if(%cl.team != 0) | |
clearBottomPrint(%cl); | |
} | |
clearVotes(); | |
} | |
function adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4) | |
{ | |
// this function handle only admin votes | |
if(%client.isAdmin && %client != %arg1) | |
{ | |
if(Game.scheduleVote !$= "" && Game.voteType $= %typeName) | |
{ | |
messageAll('closeVoteHud', ""); | |
cancel(Game.scheduleVote); | |
Game.scheduleVote = ""; | |
Game.scheduleVoteArgs = ""; | |
} | |
Game.evalVote(%typeName, true, %arg1, %arg2, %arg3, %arg4); | |
} | |
} | |
function playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting, %teamSpecific) | |
{ | |
if(!%teamSpecific) // isn't a team specific vote (kick) | |
{ | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(!%cl.isAIControlled()) | |
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); | |
} | |
} | |
else // is a team specific vote (kick) | |
{ | |
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) | |
{ | |
%cl = ClientGroup.getObject(%idx); | |
if(%cl.team == %client.team && !%cl.isAIControlled()) | |
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); | |
} | |
} | |
clearVotes(); | |
Game.voteType = %typeName; | |
Game.scheduleVote = schedule(($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4); | |
Game.scheduleVoteArgs[typename] = %typename; | |
Game.scheduleVoteArgs[arg1] = %arg1; | |
Game.scheduleVoteArgs[arg2] = %arg2; | |
Game.scheduleVoteArgs[arg3] = %arg3; | |
Game.scheduleVoteArgs[arg4] = %arg4; | |
%client.vote = true; | |
messageAll('addYesVote', ""); | |
if(%client.team != 0) | |
clearBottomPrint(%client); | |
%client.canVote = false; | |
%client.rescheduleVote = schedule(($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client); | |
} | |
function setModeFFA(%mission, %missionType) | |
{ | |
if($Host::TournamentMode) | |
{ | |
if(isObject(Game)) | |
Game.gameOver(); | |
$Host::TournamentMode = false; | |
if($Evo::ETMMode) | |
ETMreset(); | |
$Evo::ETMMode = false; | |
loadMission(%mission, %missionType, false); | |
} | |
} | |
function setModeTournament(%mission, %missionType) | |
{ | |
if(!$Host::TournamentMode) | |
{ | |
if(isObject(Game)) | |
Game.gameOver(); | |
$Host::TournamentMode = true; | |
$Evo::ETMMode = false; | |
loadMission(%mission, %missionType, false); | |
} | |
} | |
function setModeETM(%mission, %missionType) | |
{ | |
if(isObject(Game)) | |
Game.gameOver(); | |
$Host::TournamentMode = true; | |
$Evo::ETMMode = true; | |
CycleMissions(); | |
} | |
}; | |
activatePackage(evolution_package); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment