Updated T6 AC GSC (#214)

* PlutoT6 AC GSC Updated

PlutoT6's GSC modding capabilities changed, this allows us to bring the script on parity with the IW4x one. The following things changed:
*  Script no longer replaces stock GSC since custom GSC files are now supported.
* The Script now captures the last time the client used his attack button; this is used to detect trigger bots.
* Cleaned up the code a bit

* Create README.MD

Basic installation guide.
This commit is contained in:
xerxes-at 2021-08-25 18:06:46 +02:00 committed by GitHub
parent 596272a3de
commit 8c5ff440db
4 changed files with 56 additions and 40 deletions

35
GameFiles/PT6/README.MD Normal file
View File

@ -0,0 +1,35 @@
# T6
This brings IW4M-Admins's Anti-cheat to Plutonium T6
The following limitations are known:
* Can't get the recoil from weapons fire; you have to disable this detection type manually.
* in extreme cases it can produce false positives for Snap and Offset detection.
## Installation
Move `_customcallbacks.gsc` to `%localappdata%\Plutonium\storage\t6\scripts\mp\`
Add this to the WeaponNameParserConfigurations List in the StatsPluginSettings.json file:
```
{
"Game": "T6",
"Delimiters": [
"_",
"+"
],
"WeaponSuffix": "mp",
"WeaponPrefix": null
}
```
Now create the following entry for __EVERY__ T6 server you are using this on in the ServerDetectionTypes list:
```
"1270014976": [
"Offset",
"Strain",
"Snap"
]
```

View File

@ -3,24 +3,6 @@
#include common_scripts\utility;
init()
{
level.clientid = 0;
level thread onplayerconnect();
level thread IW4MA_init();
}
onplayerconnect()
{
for ( ;; )
{
level waittill( "connecting", player );
player.clientid = level.clientid;
level.clientid++;
}
}
IW4MA_init()
{
SetDvarIfUninitialized( "sv_customcallbacks", true );
SetDvarIfUninitialized( "sv_framewaittime", 0.05 );
@ -29,53 +11,52 @@ IW4MA_init()
SetDvarIfUninitialized( "sv_printradarupdates", 0 );
SetDvarIfUninitialized( "sv_printradar_updateinterval", 500 );
SetDvarIfUninitialized( "sv_iw4madmin_url", "http://127.0.0.1:1624" );
level thread IW4MA_onPlayerConnect();
level thread onPlayerConnect();
if (getDvarInt("sv_printradarupdates") == 1)
{
level thread runRadarUpdates();
}
level waittill( "prematch_over" );
level.callbackPlayerKilled = ::Callback_PlayerKilled;
level.callbackPlayerDamage = ::Callback_PlayerDamage;
level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
}
//Does not exist in T6
//It's called slightly different in T6
//set_dvar_if_unset(dvar, val, reset)
SetDvarIfUninitialized(dvar, val)
{
curval = getDvar(dvar);
if (curval == "")
SetDvar(dvar,val);
set_dvar_if_unset(dvar,val);
}
IW4MA_onPlayerConnect( player )
onPlayerConnect( player )
{
for( ;; )
{
level waittill( "connected", player );
player thread waitForFrameThread();
//player thread waitForAttack();
player thread waitForAttack();
}
}
//Does not work in T6
/*waitForAttack()
//Got added to T6 on April 2020
waitForAttack()
{
self endon( "disconnect" );
self.lastAttackTime = 0;
for( ;; )
{
self notifyOnPlayerCommand( "player_shot", "+attack" );
self waittill( "player_shot" );
self.lastAttackTime = getTime();
}
}*/
}
runRadarUpdates()
{
@ -95,7 +76,7 @@ runRadarUpdates()
}
wait( interval / 1000 );
}
}
}
hitLocationToBone( hitloc )
@ -144,7 +125,7 @@ hitLocationToBone( hitloc )
waitForFrameThread()
{
self endon( "disconnect" );
self.currentAnglePosition = 0;
self.anglePositions = [];
@ -152,7 +133,7 @@ waitForFrameThread()
{
self.anglePositions[i] = self getPlayerAngles();
}
for( ;; )
{
self.anglePositions[self.currentAnglePosition] = self getPlayerAngles();
@ -165,9 +146,9 @@ waitForAdditionalAngles( logString, beforeFrameCount, afterFrameCount )
{
currentIndex = self.currentAnglePosition;
wait( 0.05 * afterFrameCount );
self.angleSnapshot = [];
for( j = 0; j < self.anglePositions.size; j++ )
{
self.angleSnapshot[j] = self.anglePositions[j];
@ -209,7 +190,7 @@ waitForAdditionalAngles( logString, beforeFrameCount, afterFrameCount )
i++;
}
lastAttack = 100;//int(getTime()) - int(self.lastAttackTime);
lastAttack = int(getTime()) - int(self.lastAttackTime);
isAlive = isAlive(self);
logPrint(logString + ";" + anglesStr + ";" + isAlive + ";" + lastAttack + "\n" );
@ -261,7 +242,7 @@ Callback_PlayerDamage( eInflictor, attacker, iDamage, iDFlags, sMeansOfDeath, sW
{
return;
}
if ( self.health - iDamage > 0 )
{
self Process_Hit( "Damage", attacker, sHitLoc, sMeansOfDeath, iDamage, sWeapon );