Merge branch 'NoEvo'

This commit is contained in:
ChocoTaco1 2020-04-11 15:41:04 -04:00
commit 296c523b6b
11 changed files with 1024 additions and 222 deletions

View file

@ -30,6 +30,8 @@ $Host::ClassicBadWordFilter = 0;
$Host::ClassicBanlist = "prefs/banlist.cs";
$Host::ClassicBalancedBots = 0;
$Host::ClassicCanKickBots = 0;
$Host::ClassicChatLog = 1;
$Host::ClassicChatLogPath = "logs/Chat/";
$Host::ClassicConnectLog = 1;
$Host::ClassicConnLogPath = "logs/Connect/Connect.log";
$Host::ClassicCycleMisTypes = 0;

View file

@ -17,62 +17,6 @@ function VehicleData::onRemove(%this, %obj)
parent::onRemove(%this, %obj);
}
// stationTrigger::onEnterTrigger(%data, %obj, %colObj)
// Info: If the MPB is destroyed, don't allow players to use the inv
function stationTrigger::onEnterTrigger(%data, %obj, %colObj)
{
//make sure it's a player object, and that that object is still alive
if(%colObj.getDataBlock().className !$= "Armor" || %colObj.getState() $= "Dead")
return;
// Part of hack to keep people from mounting vehicles in disallowed armors.
if(%obj.station.getDataBlock().getName() !$= "StationVehicle")
%colObj.client.inInv = true;
%colObj.inStation = true;
commandToClient(%colObj.client,'setStationKeys', true);
if(Game.stationOnEnterTrigger(%data, %obj, %colObj))
{
//verify station.team is team associated and isn't on player's team
if((%obj.mainObj.team != %colObj.client.team) && (%obj.mainObj.team != 0))
{
messageClient(%colObj.client, 'msgStationDenied', '\c2Access Denied -- Wrong team.~wfx/powered/station_denied.wav');
}
else if(%obj.disableObj.isDisabled())
{
messageClient(%colObj.client, 'msgStationDisabled', '\c2Station is disabled.');
}
else if(!%obj.mainObj.isPowered())
{
messageClient(%colObj.client, 'msgStationNoPower', '\c2Station is not powered.');
}
else if(%obj.station.notDeployed)
{
messageClient(%colObj.client, 'msgStationNotDeployed', '\c2Station is not deployed.');
}
else if(%obj.station.isDestroyed)
{
messageClient(%colObj.client, 'msgStationDestroyed', '\c2Station is destroyed.');
}
else if(%obj.station.triggeredBy $= "")
{
if(%obj.station.getDataBlock().setPlayersPosition(%obj.station, %obj, %colObj))
{
messageClient(%colObj.client, 'CloseHud', "", 'inventoryScreen');
commandToClient(%colObj.client, 'TogglePlayHuds', true);
%obj.station.triggeredBy = %colObj;
%obj.station.getDataBlock().stationTriggered(%obj.station, 1);
%colObj.station = %obj.station;
%colObj.lastWeapon = ( %colObj.getMountedImage($WeaponSlot) == 0 ) ? "" : %colObj.getMountedImage($WeaponSlot).getName().item;
%colObj.unmountImage($WeaponSlot);
}
}
}
}
// END MPB INSTANT ENERGY FIX
// VEHICLE STATION SPAM FIX
@ -283,17 +227,6 @@ function resetObserveFollow( %client, %dismount )
}
}
// ilys - checkSpeed function. Kill the driver and MPB if going too fast.
function WheeledVehicle::checkSpeed(%data, %obj)
{
if(VectorLen(%obj.getVelocity()) > 200)
{
if(%obj.getMountNodeObject(0)) %obj.getMountNodeObject(0).scriptKill(36);
%obj.setDamagelevel(4);
}
%obj.schedule(5000, "checkSpeed", %data, %obj);
}
// ilys - No lava, please.
function StationVehiclePad::createStationVehicle(%data, %obj)
{
@ -425,19 +358,6 @@ function Armor::onMount(%this,%obj,%vehicle,%node)
if(%obj.client.isAIControlled()) %this.AIonMount(%obj, %vehicle, %node);
}
// TracerDX/ilys - Server crash exploit fix
function serverCmdTeamMessageSent(%client, %text)
{
if((%client.voice $= "") && (strstr(%text, "~w") != -1) && (getSubStr(%text, (strlen(%text) - 4), 4) !$= ".wav")) return;
parent::serverCmdTeamMessageSent(%client, %text);
}
function serverCmdMessageSent(%client, %text)
{
if((%client.voice $= "") && (strstr(%text, "~w") != -1) && (getSubStr(%text, (strlen(%text) - 4), 4) !$= ".wav")) return;
parent::serverCmdMessageSent(%client, %text);
}
// Fix a problem with the package system
// dropping the first package when a non-active
// package is deactivated

View file

@ -62,21 +62,54 @@ function connectLog(%client, %isDisconnect)
}
}
// voteLog(%client, %votemsg)
// Info: Logs the vote events
function voteLog(%client, %votemsg)
{
if($Host::ClassicVoteLog)
{
// get the client info
%authInfo = %client.getAuthInfo();
%ip = getField(strreplace(%client.getAddress(),":","\t"),1);
// show name for Votekick
if(%typeName $= "VoteKickPlayer")
%arg1 = %arg1.nameBase;
// this is the info that will be logged
$VoteLog = "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[HH:nn]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ "," SPC %client.guid @ ") Initiated a vote:" SPC %votemsg SPC "CM[" @ $CurrentMission @ "]";
$VoteLog = "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[HH:nn]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ "," SPC %client.guid @ ") Initiated a vote:" SPC %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4 SPC "CM[" @ $CurrentMission @ "]";
%logpath = $Host::ClassicVoteLogPath;
export("$VoteLog", %logpath, true);
logEcho($VoteLog);
}
}
// From Goon
// Slightly more elegant solution rather than spamming console
function ClassicChatLog(%client, %id, %team, %msg)
{
// We don't care about bots.
if(%client.isAIControlled())
return;
// Don't log voicepack stuff.
if(strstr(%msg, "~w") != -1)
return;
switch$(%id)
{
case 0:
%team = "[Global]";
case 1:
%team = "["@getTaggedString(Game.getTeamName(%team))@"]";
case 2:
%team = "[Admin]";
case 3:
%team = "[Bottomprint]";
case 4:
%team = "[Centerprint]";
}
// Make it all uppercase
%team = strupr(%team);
$ClassicChatLog = "["@formattimestring("H:nn:ss")@"]" SPC %team SPC getTaggedString(%client.name) @": "@%msg;
$ClassicChatLog = stripChars($ClassicChatLog, "\c0\c1\c2\c3\c4\c5\c6\c7\c8\c9\x10\x11\co\cp");
%path = $Host::ClassicChatLogPath @ formatTimeString("/yy/mm-MM/dd.log");
export("$ClassicChatLog", %path, true);
}

View file

@ -10,7 +10,7 @@ package ObserverTimeout
function serverCmdClientMakeObserver( %client )
{
//10 second cooldown on becoming an observer
if( !%client.MakeObserverTimeout )
if( !%client.MakeObserverTimeout || %client.isAdmin )
{
if ( isObject( Game ) && Game.kickClient != %client )
Game.forceObserver( %client, "playerChoose" );

View file

@ -93,6 +93,61 @@ function VehicleData::onDestroyed(%data, %obj, %prevState)
// -----------------------------------------------------------------------------------------
}
// stationTrigger::onEnterTrigger(%data, %obj, %colObj)
// Info: If the MPB is destroyed, don't allow players to use the inv
function stationTrigger::onEnterTrigger(%data, %obj, %colObj)
{
//make sure it's a player object, and that that object is still alive
if(%colObj.getDataBlock().className !$= "Armor" || %colObj.getState() $= "Dead")
return;
// z0dd - ZOD, 7/13/02 Part of hack to keep people from mounting
// vehicles in disallowed armors.
if(%obj.station.getDataBlock().getName() !$= "StationVehicle")
%colObj.client.inInv = true;
%colObj.inStation = true;
commandToClient(%colObj.client,'setStationKeys', true);
if(Game.stationOnEnterTrigger(%data, %obj, %colObj))
{
//verify station.team is team associated and isn't on player's team
if((%obj.mainObj.team != %colObj.client.team) && (%obj.mainObj.team != 0))
{
//%obj.station.playAudio(2, StationAccessDeniedSound);
messageClient(%colObj.client, 'msgStationDenied', '\c2Access Denied -- Wrong team.~wfx/powered/station_denied.wav');
}
else if(%obj.disableObj.isDisabled())
{
messageClient(%colObj.client, 'msgStationDisabled', '\c2Station is disabled.');
}
else if(!%obj.mainObj.isPowered())
{
messageClient(%colObj.client, 'msgStationNoPower', '\c2Station is not powered.');
}
else if(%obj.station.notDeployed)
{
messageClient(%colObj.client, 'msgStationNotDeployed', '\c2Station is not deployed.');
}
else if(%obj.station.isDestroyed)
{
messageClient(%colObj.client, 'msgStationDestroyed', '\c2Station is destroyed.');
}
else if(%obj.station.triggeredBy $= "")
{
if(%obj.station.getDataBlock().setPlayersPosition(%obj.station, %obj, %colObj))
{
messageClient(%colObj.client, 'CloseHud', "", 'inventoryScreen');
commandToClient(%colObj.client, 'TogglePlayHuds', true);
%obj.station.triggeredBy = %colObj;
%obj.station.getDataBlock().stationTriggered(%obj.station, 1);
%colObj.station = %obj.station;
%colObj.lastWeapon = ( %colObj.getMountedImage($WeaponSlot) == 0 ) ? "" : %colObj.getMountedImage($WeaponSlot).item;
%colObj.unmountImage($WeaponSlot);
}
}
}
}
//OG Blaster Buff
function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC)
{

View file

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

View file

@ -756,6 +756,36 @@ $dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "shockHitMaxDist";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "scoutFlyerEK";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "bomberFlyerEK";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "hapcFlyerEK";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "chatallCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "chatteamCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "voicebindsallCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "voicebindsteamCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "kickCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "obstimeoutkickCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "spawnobstimeoutCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "voteCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairgenCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairsolarpanelCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairsensorlargeCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairstationinvCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairstationvehCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairturretlargeCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairturretsentryCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairdepmotsensorCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairturretspiderclampCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairturretlandspikeCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairdepinvstationCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairmpbteleCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "leavemissionareaCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "teamkillCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "switchteamCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "flipflopCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "packpickupCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "weaponpickupCount";
$dtStats::FV[$dtStats::FC["dtStats"]++,"dtStats"] = "repairpackpickupCount";
///////////////////////////////////////////////////////////////////
$dtStats::uFC["dtStats"] = 0; // not saved but used to calculate other stats that are saved
@ -1229,6 +1259,9 @@ package dtStats{
function DefaultGame::forceObserver( %game, %client, %reason ){
parent::forceObserver( %game, %client, %reason );
if($dtStats::Enable){
if(%reason $= "spawnTimeout"){
%client.spawnobstimeoutCount++;
}
%client.gt = %client.at = 0;//air time ground time reset
}
}
@ -1298,6 +1331,48 @@ package dtStats{
return false;
}
//////////////////////////////////////////////////////////////////////////////////
function chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 ){
parent::chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
if($dtStats::Enable){
if(strstr(%msgString, "~w") != -1)
%sender.voicebindsallCount++;
else
%sender.chatallCount++;
}
}
function chatMessageTeam( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 ){
parent::chatMessageTeam( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
if($dtStats::Enable){
if(strstr(%msgString, "~w") != -1)
%sender.voicebindsteamCount++;
else
%sender.chatteamCount++;
}
}
function cannedChatMessageAll( %sender, %msgString, %name, %string, %keys )
{
parent::cannedChatMessageAll( %sender, %msgString, %name, %string, %keys );
if($dtStats::Enable)
%sender.voicebindsallCount++;
}
function cannedChatMessageTeam( %sender, %team, %msgString, %name, %string, %keys )
{
parent::cannedChatMessageTeam( %sender, %team, %msgString, %name, %string, %keys );
if($dtStats::Enable)
%sender.voicebindsteamCount++;
}
function kick( %client, %admin, %guid ){
if($dtStats::Enable)
%client.kickCount++;
parent::kick( %client, %admin, %guid );
}
function cmdAutoKickObserver(%client, %key){ // Edit GG
parent::cmdAutoKickObserver(%client, %key);
if($dtStats::Enable)
%client.obstimeoutkickCount++;
}
//////////////////////////////////////////////////////////////////////////////////
};
//helps with game types that override functions and dont use parent
// that way we get called first then the gametype can do whatever
@ -1339,7 +1414,7 @@ package dtStatsGame{
clientDmgStats(%data,%position,%sourceObject,%targetObject, %damageType,%amount);
parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC);
}
//0 Fire 1 ??? 2 jump 3 jet 4 gernade 5 mine
//0 Fire 1 ??? 2 jump 3 jet 4 grenade 5 mine
function Armor::onTrigger(%data, %player, %triggerNum, %val){
parent::onTrigger(%data, %player, %triggerNum, %val);
if($dtStats::Enable){
@ -1490,6 +1565,82 @@ package dtStatsGame{
}
parent::flagCap(%game, %player);
}
function CTFGame::staticShapeOnRepaired(%game, %obj, %objName){
parent::staticShapeOnRepaired(%game, %obj, %objName);
if($dtStats::Enable){
%repairman = %obj.repairedBy;
if (%game.testValidRepair(%obj) && isObject(%repairman)){
%dataName = %obj.getDataBlock().getName();
switch$ (%dataName){
case "GeneratorLarge":
%repairman.repairgenCount++;
case "SolarPanel":
%repairman.repairsolarpanelCount++;
case "SensorLargePulse" or "SensorMediumPulse":
%repairman.repairsensorlargeCount++;
case "StationInventory" or "StationAmmo":
%repairman.repairstationinvCount++;
case "StationVehicle":
%repairman.repairstationvehCount++;
case "TurretBaseLarge":
%repairman.repairturretlargeCount++;
case "SentryTurret":
%repairman.repairturretsentryCount++;
case "DeployedMotionSensor" or "DeployedPulseSensor":
%repairman.repairdepmotsensorCount++;
case "TurretDeployedWallIndoor" or "TurretDeployedFloorIndoor" or "TurretDeployedCeilingIndoor":
%repairman.repairturretspiderclampCount++;
case "TurretDeployedOutdoor":
%repairman.repairturretlandspikeCount++;
case "DeployedStationInventory":
%repairman.repairdepinvstationCount++;
case "MPBTeleporter":
%repairman.repairmpbteleCount++;
default:
return;
}
}
}
}
//exec("scripts/autoexec/zDarkTigerStats.cs");
function CTFGame::leaveMissionArea(%game, %playerData, %player){
parent::leaveMissionArea(%game, %playerData, %player);
if($dtStats::Enable)
%player.client.leavemissionareaCount++;
}
function SCtFGame::leaveMissionArea(%game, %playerData, %player){
parent::leaveMissionArea(%game, %playerData, %player);
if($dtStats::Enable)
%player.client.leavemissionareaCount++;
}
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned){ // z0dd - ZOD, 6/06/02. Don't send a message if player used respawn feature. Added %respawned
parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
if($dtStats::Enable)
%client.switchteamCount++;
}
function FlipFlop::playerTouch(%data, %flipflop, %player){
parent::playerTouch(%data, %flipflop, %player);
if($dtStats::Enable)
%player.client.flipflopCount++;
}
function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg){
parent::playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg);
if($dtStats::Enable)
%client.voteCount++;
}
function ItemData::onPickup(%this, %pack, %player, %amount){
parent::onPickup(%this, %pack, %player, %amount);
if($dtStats::Enable){
if(%this.getname() $= "RepairPack")
%player.client.repairpackpickupCount++;
%player.client.packpickupCount++;
}
}
function Weapon::onPickup(%this, %obj, %shape, %amount){
parent::onPickup(%this, %obj, %shape, %amount);
if($dtStats::Enable)
%this.weaponpickupCount++;
}
};
function chkGrounded(%player){
@ -2917,13 +3068,13 @@ function DefaultGame::postGameStats(%game,%client){ //stats to add up at the end
%client.totalTime = ((getSimTime() - %client.joinTime)/1000)/60;//convert it to min
%client.cgScore = %client.cgKill + %client.cgMA + %client.cgKillAir + (%client.cgKillMaxDist/100) + %client.cgCom;
%dtStats.cgScore = (%dtStats.cgKill + %dtStats.cgMA + %dtStats.cgKillAir + (%dtStats.cgKillMaxDist/100) + %dtStats.cgCom) / 100;
%client.discScore = %client.discKill + %client.discMA + %client.discKillAir + (%client.discKillMaxDist/100) + %client.discCom;
%client.hGrenadeScore = %client.hGrenadeKill + %client.hGrenadeMA + %client.hGrenadeKillAir + (%client.hGrenadeKillMaxDist/20) + %client.hGrenadeCom;
%client.grenadeScore = %client.grenadeKill + %client.grenadeMA + %client.grenadeKillAir + (%client.grenadeKillMaxDist/100) + %client.grenadeCom;
%client.laserScore = %client.laserKill + %client.laserMA + %client.laserKillAir + (%client.laserKillMaxDist/250) + %client.laserCom + %client.laserHeadShot;
%client.mortarScore = %client.mortarKill + %client.mortarMA + %client.mortarKillAir + (%client.mortarKillMaxDist/50) + %client.mortarCom;
%client.missileScore = %client.missileKill + %client.missileMA + %client.missileKillAir + (%client.missileKillMaxDist/500) + %client.missileCom;
%dtStats.missileScore = (%dtStats.missileKill+ %dtStats.missileMA + %dtStats.missileKillAir + (%dtStats.missileKillMaxDist/500)+ %dtStats.missileCom) / 10;
%client.shockScore = %client.shockKill + %client.shockMA + %client.shockKillAir + (%client.shockKillMaxDist/2) + %client.shockCom + %client.shockRearShot;
%client.plasmaScore = %client.plasmaKill + %client.plasmaMA + %client.plasmaKillAir + (%client.plasmaKillMaxDist/50) + %client.plasmaCom;
%client.blasterScore = %client.blasterKill + %client.blasterMA + %client.blasterKillAir + (%client.blasterKillMaxDist/50) + %client.blasterCom;
@ -3650,14 +3801,14 @@ function getTimeDif(%time){
%ms += mFloor((%min*60)+0.5) * (60 * 1000); // %min * 60 to convert back to mins , * 60kms for one min
return mFloor(%ms);
}
function genBlanks(){ // optimization thing saves on haveing to do it with every setValueField
function genBlanks(){ // optimization thing saves on having to do it with every setValueField
$dtStats::blank["g"] = $dtStats::blank["t"] = "";
if($dtStats::MaxNumOfGames > 300){
$dtStats::MaxNumOfGames = 300; //cap it
}
$dtStats::blank["g"] = $dtStats::blank["t"] = 0;
for(%i=0; %i < $dtStats::MaxNumOfGames-2; %i++){
for(%i=0; %i < $dtStats::MaxNumOfGames-1; %i++){
$dtStats::blank["g"] = $dtStats::blank["g"] TAB 0;
}
for(%i=0; %i < 8; %i++){
@ -3881,6 +4032,10 @@ function clientKillStats(%game,%clVictim, %clKiller, %damageType, %implement, %d
%clVictim.ttl += getSimTime() - %clVictim.spawnTime;
%clVictim.timeTL = mFloor((%clVictim.ttl/(%clVictim.deaths+%clVictim.suicides ? %clVictim.deaths+%clVictim.suicides : 1))/1000);
//Teamkills
if(%clKiller.team == %clVictim.team)
%clKiller.teamkillCount++;
if(%clKiller.team != %clVictim.team){
if(isObject(%clKiller.player) && isObject(%clVictim.player)){
@ -6554,10 +6709,10 @@ case "LBOARDS":
%line = '<font:univers condensed:18><lmargin:75><a:gamelink\tStats\tLB\t%5\t%3><color:0befe7>Longest Shot: <color:03d597>%1</a><lmargin:350><a:gamelink\tStats\tLB\t%5\t%4><color:0befe7>Highest Speed: <color:03d597>%2</a>';
messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%i1,%i2,"weaponHitMaxDistMax-Longest Shot-Max Distance","maxSpeedMax-Highest Speed-Speed km/h",%vClient);
%i1 = getField($lData::data["discInDmg",%client.lgame,%lType,%mon,%year],0) ? getField($lData::name["discInDmg",%client.lgame,%lType,%mon,%year],0) : %NA;
%i2 = getField($lData::data["shotsFired",%client.lgame,%lType,%mon,%year],0) ? getField($lData::name["shotsFired",%client.lgame,%lType,%mon,%year],0) : %NA;
%line = '<font:univers condensed:18><lmargin:75><a:gamelink\tStats\tLB\t%5\t%3><color:0befe7>Most Damage: <color:03d597>%1</a><lmargin:350><a:gamelink\tStats\tLB\t%5\t%4><color:0befe7>Rounds Fired: <color:03d597>%2</a>';
messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%i1,%i2,"discInDmg-Most Damage-Total","shotsFired-Most Rounds Fired-Total",%vClient);
%i1 = getField($lData::data["totalWepDmg",%client.lgame,%lType,%mon,%year],0) ? getField($lData::name["totalWepDmg",%client.lgame,%lType,%mon,%year],0) : %NA;
%i2 = getField($lData::data["shotsFired",%client.lgame,%lType,%mon,%year],0) ? getField($lData::name["shotsFired",%client.lgame,%lType,%mon,%year],0) : %NA;
%line = '<font:univers condensed:18><lmargin:75><a:gamelink\tStats\tLB\t%5\t%3><color:0befe7>Most Damage: <color:03d597>%1</a><lmargin:350><a:gamelink\tStats\tLB\t%5\t%4><color:0befe7>Rounds Fired: <color:03d597>%2</a>';
messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%i1,%i2,"totalWepDmg-Most Damage-Total","shotsFired-Most Rounds Fired-Total",%vClient);
%i1 = getField($lData::data["shockRearShot",%client.lgame,%lType,%mon,%year],0) ? getField($lData::name["shockRearShot",%client.lgame,%lType,%mon,%year],0) : %NA;
%i2 = getField($lData::data["laserHeadShot",%client.lgame,%lType,%mon,%year],0) ? getField($lData::name["laserHeadShot",%client.lgame,%lType,%mon,%year],0) : %NA;

440
Classic/scripts/message.cs Normal file
View file

@ -0,0 +1,440 @@
$MaxMessageWavLength = 5200;
function addMessageCallback(%msgType, %func)
{
for(%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++)
{
// only add each callback once
if(%afunc $= %func)
return;
}
$MSGCB[%msgType, %i] = %func;
}
function messagePump(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7 ,%a8, %a9, %a10)
{
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%tag = getWord(%msgType, 0);
for(%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
if(%tag !$= "")
for(%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++)
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
if ( %msgString $= "" )
return;
%message = detag( %msgString );
// search for wav tag marker
%wavStart = strstr( %message, "~w" );
if ( %wavStart != -1 )
{
%wav = getSubStr( %message, %wavStart + 2, 1000 );
%wavLengthMS = alxGetWaveLen( %wav );
if ( %wavLengthMS <= $MaxMessageWavLength )
{
%handle = alxCreateSource( AudioChat, %wav );
alxPlay( %handle );
}
else
error( "WAV file \"" @ %wav @ "\" is too long! **" );
%message = getSubStr( %message, 0, %wavStart );
if ( %message !$= "" )
addMessageHudLine( %message );
}
else
addMessageHudLine( %message );
}
//--------------------------------------------------------------------------
function handleClientJoin(%msgType, %msgString, %clientName, %clientId, %targetId, %isAI, %isAdmin, %isSuperAdmin, %isSmurf, %guid)
{
logEcho("got client join: " @ detag(%clientName) @ " : " @ %clientId);
//create the player list group, and add it to the ClientConnectionGroup...
if(!isObject("PlayerListGroup"))
{
%newGroup = new SimGroup("PlayerListGroup");
ClientConnectionGroup.add(%newGroup);
}
%player = new ScriptObject()
{
className = "PlayerRep";
name = detag(%clientName);
guid = %guid;
clientId = %clientId;
targetId = %targetId;
teamId = 0; // start unassigned
score = 0;
ping = 0;
packetLoss = 0;
chatMuted = false;
canListen = false;
voiceEnabled = false;
isListening = false;
isBot = %isAI;
isAdmin = %isAdmin;
isSuperAdmin = %isSuperAdmin;
isSmurf = %isSmurf;
};
PlayerListGroup.add(%player);
$PlayerList[%clientId] = %player;
if ( !%isAI )
getPlayerPrefs(%player);
lobbyUpdatePlayer( %clientId );
}
function handleClientDrop( %msgType, %msgString, %clientName, %clientId )
{
logEcho("got client drop: " @ detag(%clientName) @ " : " @ %clientId);
%player = $PlayerList[%clientId];
if( %player )
{
%player.delete();
$PlayerList[%clientId] = "";
lobbyRemovePlayer( %clientId );
}
}
function handleClientJoinTeam( %msgType, %msgString, %clientName, %teamName, %clientId, %teamId )
{
%player = $PlayerList[%clientId];
if( %player )
{
%player.teamId = %teamId;
lobbyUpdatePlayer( %clientId );
}
}
function handleClientNameChanged( %msgType, %msgString, %oldName, %newName, %clientId )
{
%player = $PlayerList[%clientId];
if( %player )
{
%player.name = detag( %newName );
lobbyUpdatePlayer( %clientId );
}
}
addMessageCallback("", defaultMessageCallback);
addMessageCallback('MsgClientJoin', handleClientJoin);
addMessageCallback('MsgClientDrop', handleClientDrop);
addMessageCallback('MsgClientJoinTeam', handleClientJoinTeam);
addMessageCallback('MsgClientNameChanged', handleClientNameChanged);
//---------------------------------------------------------------------------
// Client chat'n
//---------------------------------------------------------------------------
function isClientChatMuted(%client)
{
%player = $PlayerList[%client];
if(%player)
return(%player.chatMuted ? true : false);
return(true);
}
//---------------------------------------------------------------------------
function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
%message = detag( %msgString );
%voice = detag( %voice );
if ( ( %message $= "" ) || isClientChatMuted( %sender ) )
return;
// search for wav tag marker
%wavStart = strstr( %message, "~w" );
if ( %wavStart == -1 )
addMessageHudLine( %message );
else
{
%wav = getSubStr(%message, %wavStart + 2, 1000);
if (%voice !$= "")
%wavFile = "voice/" @ %voice @ "/" @ %wav @ ".wav";
else
%wavFile = %wav;
//only play voice files that are < 5000ms in length
if (%pitch < 0.5 || %pitch > 2.0)
%pitch = 1.0;
%wavLengthMS = alxGetWaveLen(%wavFile) * %pitch;
if (%wavLengthMS < $MaxMessageWavLength )
{
if ( $ClientChatHandle[%sender] != 0 )
alxStop( $ClientChatHandle[%sender] );
$ClientChatHandle[%sender] = alxCreateSource( AudioChat, %wavFile );
//pitch the handle
if (%pitch != 1.0)
alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %pitch);
alxPlay( $ClientChatHandle[%sender] );
}
else
error( "** WAV file \"" @ %wavFile @ "\" is too long! **" );
%message = getSubStr(%message, 0, %wavStart);
addMessageHudLine(%message);
}
}
//---------------------------------------------------------------------------
function clientCmdCannedChatMessage( %sender, %msgString, %name, %string, %keys, %voiceTag, %pitch )
{
%message = detag( %msgString );
%voice = detag( %voiceTag );
if ( $defaultVoiceBinds )
clientCmdChatMessage( %sender, %voice, %pitch, "[" @ %keys @ "]" SPC %message );
else
clientCmdChatMessage( %sender, %voice, %pitch, %message );
}
//---------------------------------------------------------------------------
// silly spam protection...
$SPAM_PROTECTION_PERIOD = 10000;
$SPAM_MESSAGE_THRESHOLD = 4;
$SPAM_PENALTY_PERIOD = 10000;
$SPAM_MESSAGE = '\c3FLOOD PROTECTION:\cr You must wait another %1 seconds.';
function GameConnection::spamMessageTimeout(%this)
{
if(%this.spamMessageCount > 0)
%this.spamMessageCount--;
}
function GameConnection::spamReset(%this)
{
%this.isSpamming = false;
}
function spamAlert(%client)
{
if($Host::FloodProtectionEnabled != true)
return(false);
if(!%client.isSpamming && (%client.spamMessageCount >= $SPAM_MESSAGE_THRESHOLD))
{
%client.spamProtectStart = getSimTime();
%client.isSpamming = true;
%client.schedule($SPAM_PENALTY_PERIOD, spamReset);
}
if(%client.isSpamming)
{
%wait = mFloor(($SPAM_PENALTY_PERIOD - (getSimTime() - %client.spamProtectStart)) / 1000);
messageClient(%client, "", $SPAM_MESSAGE, %wait);
return(true);
}
%client.spamMessageCount++;
%client.schedule($SPAM_PROTECTION_PERIOD, spamMessageTimeout);
return(false);
}
function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
//see if the client has muted the sender
if ( !%client.muted[%sender] )
commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}
function cannedChatMessageClient( %client, %sender, %msgString, %name, %string, %keys )
{
if ( !%client.muted[%sender] )
commandToClient( %client, 'CannedChatMessage', %sender, %msgString, %name, %string, %keys, %sender.voiceTag, %sender.voicePitch );
}
function chatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %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 );
}
if($Host::ClassicChatLog)
ClassicChatLog(%sender, 1, %sender.team, %a2);
}
function cannedChatMessageTeam( %sender, %team, %msgString, %name, %string, %keys )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
if ( %obj.team == %sender.team )
cannedChatMessageClient( %obj, %sender, %msgString, %name, %string, %keys );
}
}
function chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
{
return;
}
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%obj = ClientGroup.getObject( %i );
//----------------------------------------------------------------------------------------------------------------------------------------------------
// z0dd - ZOD, 6/03/02. Allow observer global chat to be seen by all, not just admins and other observers
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//if(%sender.team != 0)
//{
// chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//}
//else
//{
// message sender is an observer -- only send message to other observers
//if(%obj.team == %sender.team || %obj.isAdmin || %obj.isSuperAdmin)
//{
// chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
//}
//}
//----------------------------------------------------------------------------------------------------------------------------------------------------
}
// z0dd - ZOD 5/13/02. Echo chat to console for remote telnet apps.
if($Host::ClassicEchoChat)
{
echo( stripTaggedVar(%sender.name), ": ", %a2 );
}
//echo( "SAY: " @ stripchars(detag(gettaggedstring(%sender.name)),"\cp\co\c6\c7\c8\c9") @ " \"" @ %a2 @ "\"");
if($Host::ClassicChatLog)
ClassicChatLog(%sender, 0, 0, %a2);
}
function cannedChatMessageAll( %sender, %msgString, %name, %string, %keys )
{
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
return;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
cannedChatMessageClient( ClientGroup.getObject(%i), %sender, %msgString, %name, %string, %keys );
// z0dd - ZOD 5/13/02. Echo chat to console for remote telnet apps.
if($Host::ClassicEchoChat)
{
echo( stripTaggedVar(%sender.name), ": ", getSubStr(%string, 0, strstr(%string, "~w")) );
}
//echo("SAY: " @ stripchars(detag(gettaggedstring(%sender.name)),"\cp\co\c6\c7\c8\c9") @ " \"" @ %string @ "\"");
}
//---------------------------------------------------------------------------
function messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
commandToClient(%client, 'ServerMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if(%recipient.team == %team)
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageTeamExcept(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient.team == %team) && (%recipient != %client))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
%count = ClientGroup.getCount();
for(%cl = 0; %cl < %count; %cl++)
{
%client = ClientGroup.getObject(%cl);
messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
function messageAllExcept(%client, %team, %msgtype, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
//can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
//messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
%count = ClientGroup.getCount();
for(%cl= 0; %cl < %count; %cl++)
{
%recipient = ClientGroup.getObject(%cl);
if((%recipient != %client) && (%recipient.team != %team))
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
}
}
//---------------------------------------------------------------------------
// functions to support repair messaging
//---------------------------------------------------------------------------
function clientCmdTeamRepairMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
if($pref::ignoreTeamRepairMessages)
%msgString = ""; // z0dd - ZOD, 8/23/02. Yogi. The message gets to the client but is "muted" from the HUD
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
}
function teamRepairMessage(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%recipient = ClientGroup.getObject(%i); // z0dd - ZOD, 8/20/02. param to getObject was $cl, which is an error
if((%recipient.team == %team) && (%recipient != %client))
{
commandToClient(%recipient, 'TeamRepairMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6); // z0dd - ZOD, 6/18/02. Was sending to the wrong variable. 1st param was %client
}
}
}
// -----------------------------------------------------------------------------------------------------------
// z0dd - ZOD, 8/20/02. Added this team destroy message function
function teamDestroyMessage(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
{
%team = %client.team;
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%recipient = ClientGroup.getObject(%i);
if((%recipient.team == %team) && (%recipient != %client))
{
commandToClient(%recipient, 'TeamDestroyMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
}
}
}
// -----------------------------------------------------------------------------------------------------------

View file

@ -953,6 +953,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice,
}
}
}
if($Host::EmptyServerReset && isEventPending($EmptyServerResetSchedule))
{
error(formatTimeString("HH:nn:ss") SPC "Previous Timed Server Reset schedule cancelled..." );
@ -973,7 +974,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice,
%client.nameBase = %name;
}
// If we still don't have a GUID or name, time to boot the player (unless a local game).
if(getIPAddress(%client) !$= "Local" && (!%client.guid $= "" || %name $= ""))
if(%client.getIPAddress() !$= "Local" && (!%client.guid $= "" || %name $= ""))
{
//statEchoInfo("No name/GUID kick for CID (" @ %client @ ") with IP (" @ getIPAddress(%client) @ ")");
KickByCID(%client, "You joined the server with a blank name and/or GUID. Try rejoining.",2);
@ -1037,57 +1038,6 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice,
}
}
// From Eolks
// Minor improvement by Teratos
function getIPAddress(%client)
{
%port = nextToken(nextToken(%client.getAddress(), "ip", ":"), "addr", ":");
if(%client.isAIControlled()) {
%addr = "bot";
}
return (%addr $= "" ? "Local" : %addr);
}
// From Eolks
// We are not an admin MOD but this comes in handy when name is missing on races.
function KickByCID(%client, %reason, %time)
{
if(!isObject(%client))
return;
// AI handler
if(%client.isAIControlled())
{
%client.drop();
$HostGameBotCount--;
if($HostGameBotCount < 0)
$HostGameBotCount = 0;
return;
}
if (%reason $= "")
%reason = "You have been kicked from the server.";
// Perhaps we don't want time done.
//if (%time < 0 || %time $= "")
// %time = $Host::KickBanTime;
// Send proper messages
messageClient(%client, 'onClientKicked', "");
messageAllExcept(%client, -1, 'MsgClientDrop', "", %client.name, %client);
// Remove their player, if one exists
if (isObject(%client.player))
%client.player.scriptKill(0);
// Set reason, schedule removal
%client.setDisconnectReason(%reason);
%client.schedule(500, "delete");
// Keep them out
// if(%time != 0)
// BanList::add(%client.guid, %client.getAddress(), %time);
}
function GameConnection::onDrop(%client, %reason)
{
if(isObject(Game))
@ -3451,70 +3401,4 @@ function GameConnection::ResetTagSwitchWait(%this)
function serverCmdGetTargetGameName(%client)
{
// No more spam
}
//////////////////////////////////////////////////////////////////////////////
// Eolk - Ban functions.
//////////////////////////////////////////////////////////////////////////////
function ClassicAddBan(%label, %entry, %skipExport)
{
// Add to in-memory list
$ClassicPermaBan[$ClassicPermaBans] = %entry TAB %label;
$ClassicPermaBans++;
// Only write to file if we're supposed to.
if (!%skipExport)
{
// Write to file
%fp = new FileObject();
if (%fp.openForAppend($Host::ClassicBanlist))
%fp.writeLine("ClassicAddBan(\"" @ %label @ "\", \"" @ %entry @ "\", true);");
else
error("Encountered an I/O error while updating banlist.");
%fp.close();
%fp.delete();
}
}
function ClassicAddWhitelist(%label, %entry)
{
$ClassicWhitelist[$ClassicWhitelists] = %entry TAB %label;
$ClassicWhitelists++;
}
function ClassicIsBanned(%client)
{
%guid = %client.guid;
%addr = %client.getIPAddress();
%type = 0;
for (%i = 0; %i < $ClassicPermaBans; %i++)
{
%entry = getField($ClassicPermaBan[%i], 0);
if (%guid == %entry)
%type |= 1;
if (strstr(%addr, %entry) == 0)
%type |= 2;
}
for (%x = 0; %x < $ClassicWhitelists; %x++)
{
%entry = getField($ClassicWhitelist[%x], 0);
error(%entry);
if (%guid == %entry || strstr(%addr, %entry) == 0)
return error("SUCCESS!"); // We're whitelisted! Whee!
}
return %type;
}
function ClassicLoadBanlist()
{
$ClassicPermaBans = 0;
exec($Host::ClassicBanlist);
$ClassicWhitelists = 0;
exec($Host::ClassicWhitelist);
}

View file

@ -156,6 +156,8 @@ $Host::LoadScreenMOTD4 = "Big CTF games Fridays, Saturdays, and Sundays!"; //M
$Host::ClassicBanlist = "prefs/banlist.cs";
$Host::ClassicAdminLog = 1;
$Host::ClassicAdminLogPath = "logs/Admin/log.txt";
$Host::ClassicChatLog = 1;
$Host::ClassicChatLogPath = "logs/Chat/";
$Host::ClassicConnectLog = 1;
$Host::ClassicConnLogPath = "logs/Connect/log.txt";
$Host::ClassicMOTD = "<color:3cb4b4><font:Sui Generis:22>Discord PUB\n<color:3cb4b4><font:Univers:16>Server Hosted/Provided by Branzone/Ravin\n<color:3cb4b4><font:Univers:16>Get Mappacks at https://playt2.com/";

View file

@ -0,0 +1,316 @@
/////////////////////////////////////////////////////////////////////////////////////////
// z0dd - ZOD: Generic Console Spam fixes ///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
function Projectile::isMounted(%this)
{
return 0;
}
function VehicleBlocker::getDataBlock(%this)
{
return %this;
}
function VehicleBlocker::getName(%this)
{
return %this;
}
function WaterBlock::damage(%this)
{
// Do nothing
}
function InteriorInstance::getDataBlock(%this)
{
return %this;
}
function InteriorInstance::getName(%this)
{
return "InteriorInstance";
}
function TerrainBlock::getDataBlock(%this)
{
return %this;
}
function TerrainBlock::getName(%this)
{
return "Terrain";
}
function AIConnection::isMounted(%client)
{
%vehicle = %client.getControlObject();
%className = %vehicle.getDataBlock().className;
if(%className $= WheeledVehicleData || %className $= FlyingVehicleData || %className $= HoverVehicleData)
return true;
else
return false;
}
function ForceFieldBareData::isMounted(%obj)
{
// created to prevent console errors
}
function ForceFieldBareData::damageObject(%data, %targetObject, %position, %sourceObject, %amount, %damageType)
{
// created to prevent console errors
}
/////////////////////////////////////////////////////////////////////////////////////////
// Random Teams code by Founder (founder@mechina.com) 6/13/02 ///////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// Couple other files edited for Random Teams.
// Hud.cs and DefaultGame.cs
function AIConnection::startMission(%client)
{
// assign the team
if (%client.team <= 0)
Game.assignClientTeam(%client);
if(%client.lastTeam !$= "")
{
if(%client.team != %client.lastTeam)
Game.AIChangeTeam( %client, %client.lastTeam );
}
// set the client's sensor group...
setTargetSensorGroup( %client.target, %client.team );
%client.setSensorGroup( %client.team );
// sends a message so everyone know the bot is in the game...
Game.AIHasJoined(%client);
%client.matchStartReady = true;
// spawn the bot...
onAIRespawn(%client);
}
/////////////////////////////////////////////////////////////////////////////////////////
// z0dd - ZOD: Universal functions //////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
function stripTaggedVar(%var)
{
return stripChars( detag( getTaggedString( %var ) ), "\cp\co\c6\c7\c8\c9" );
}
// Removes triggers from Siege when players switch sides, also used in practiceCTF
function cleanTriggers(%group)
{
if (%group > 0)
%depCount = %group.getCount();
else
return;
for(%i = 0; %i < %depCount; %i++)
{
%deplObj = %group.getObject(%i);
if(isObject(%deplObj))
{
if(%deplObj.trigger !$= "")
%deplObj.trigger.schedule(0, "delete");
}
}
}
// -----------------------------------------------------
// z0dd - ZOD, 6/22/02. Hack to eliminate texture cheats
package cloaking
{
function ShapeBase::setCloaked(%obj, %bool)
{
parent::setCloaked(%obj, %bool);
if(%bool)
%obj.startFade(0, 800, true);
else
%obj.startFade(0, 0, false);
}
};
activatePackage(cloaking);
// z0dd - ZOD, 5/18/03. Bug fix, added !=0 for deployed turrets because of tagging players name to nameTag.
// No package because this file declared AFTER GameBase.cs
function GameBaseData::onRemove(%data, %obj)
{
%target = %obj.getTarget();
// first 32 targets are team targets
if(%target >= 32)
{
if(%obj.nameTag !$= "" && %obj.nameTag != 0)
removeTaggedString(%obj.nameTag);
freeTarget(%target);
}
}
function serverCmdPrivateMessageSent(%client, %target, %text)
{
// Client side:
//commandToServer('PrivateMessageSent', %target, %text);
if((%text $= "") || spamAlert(%client))
return;
if(%client.isAdmin)
{
%snd = '~wfx/misc/diagnostic_on.wav';
if(strlen(%text) >= $Host::MaxMessageLen)
%text = getSubStr(%text, 0, $Host::MaxMessageLen);
messageClient(%target, 'MsgPrivate', '\c5Message from %1: \c3%2%3', %client.name, %text, %snd);
}
else
messageClient(%client, 'MsgError', '\c4Only admins can send private messages');
}
//////////////////////////////////////////////////////////////////////////////
// z0dd - ZOD, 10/03/02. Part of flag collision bug hack.
//////////////////////////////////////////////////////////////////////////////
datablock TriggerData(flagTrigger)
{
tickPeriodMS = 10;
};
function flagTrigger::onEnterTrigger(%data, %obj, %colObj)
{
%flag = %obj.flag;
if($flagStatus[%flag.team] $= "<At Base>")
%flag.getDataBlock().onCollision(%flag, %colObj);
else
return;
}
function flagTrigger::onLeaveTrigger(%data, %obj, %colObj)
{
// Thou shalt not spam
}
function flagTrigger::onTickTrigger(%data, %obj)
{
// Thou shalt not spam
}
//////////////////////////////////////////////////////////////////////////////
// Eolk - Ban functions.
//////////////////////////////////////////////////////////////////////////////
function ClassicAddBan(%label, %entry, %skipExport)
{
// Add to in-memory list
$ClassicPermaBan[$ClassicPermaBans] = %entry TAB %label;
$ClassicPermaBans++;
// Only write to file if we're supposed to.
if (!%skipExport)
{
// Write to file
%fp = new FileObject();
if (%fp.openForAppend($Host::ClassicBanlist))
%fp.writeLine("ClassicAddBan(\"" @ %label @ "\", \"" @ %entry @ "\", true);");
else
error("Encountered an I/O error while updating banlist.");
%fp.close();
%fp.delete();
}
}
function ClassicAddWhitelist(%label, %entry)
{
$ClassicWhitelist[$ClassicWhitelists] = %entry TAB %label;
$ClassicWhitelists++;
}
function ClassicIsBanned(%client)
{
%guid = %client.guid;
%addr = %client.getIPAddress();
%type = 0;
for (%i = 0; %i < $ClassicPermaBans; %i++)
{
%entry = getField($ClassicPermaBan[%i], 0);
if (%guid == %entry)
%type |= 1;
if (strstr(%addr, %entry) == 0)
%type |= 2;
}
for (%x = 0; %x < $ClassicWhitelists; %x++)
{
%entry = getField($ClassicWhitelist[%x], 0);
error(%entry);
if (%guid == %entry || strstr(%addr, %entry) == 0)
return error("SUCCESS!"); // We're whitelisted! Whee!
}
return %type;
}
function ClassicLoadBanlist()
{
$ClassicPermaBans = 0;
exec($Host::ClassicBanlist);
$ClassicWhitelists = 0;
exec($Host::ClassicWhitelist);
}
// From Eolks
// Minor improvement by Teratos
function getIPAddress(%client)
{
%port = nextToken(nextToken(%client.getAddress(), "ip", ":"), "addr", ":");
if(%client.isAIControlled()) {
%addr = "bot";
}
return (%addr $= "" ? "Local" : %addr);
}
// From Eolks
// We are not an admin MOD but this comes in handy when name is missing on races.
function KickByCID(%client, %reason, %time)
{
if(!isObject(%client))
return;
// AI handler
if(%client.isAIControlled())
{
%client.drop();
$HostGameBotCount--;
if($HostGameBotCount < 0)
$HostGameBotCount = 0;
return;
}
if (%reason $= "")
%reason = "You have been kicked from the server.";
// Perhaps we don't want time done.
//if (%time < 0 || %time $= "")
// %time = $Host::KickBanTime;
// Send proper messages
messageClient(%client, 'onClientKicked', "");
messageAllExcept(%client, -1, 'MsgClientDrop', "", %client.name, %client);
// Remove their player, if one exists
if (isObject(%client.player))
%client.player.scriptKill(0);
// Set reason, schedule removal
%client.setDisconnectReason(%reason);
%client.schedule(500, "delete");
// Keep them out
// if(%time != 0)
// BanList::add(%client.guid, %client.getAddress(), %time);
}