Author Topic: Preventing enemy vehicle entry via PlayerData points  (Read 601 times)

Slayer has a fancy vehicle check in it's minigameCanSlayerUse function to prevent people from entering enemy vehicles and driving around invincible.  
I assume it calls that function in WheeledVehicleData::onCollision like other lock mods for vehicles do.

The point players are entering from to circumvent this lock are PlayerData datablocks.  Can you use PlayerData::onCollision and duplicate the check there too?
Is that even a thing?  Or is there some other way?

You could package armor::onCollision(%this, %obj, %col, %vec, %vecLen) and then not call the parent if you don't want them entering the vehicle.

Thanks, and to clarify, this is to prevent players from entering enemy vehicles through bot mount points such as tank turrets. (Slayer does not protect against this)
Any further suggestions?

Code: [Select]
package restrictedEnemyVehicles
{
  function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
   {
if(%col.getClassName() $= "Player")                                                                     // if it's a playerData
{
if(isObject(%col.spawnBrick) && MinigameCanDamage(%obj,%col))                     // if it has a spawnbrick and you can damage it (your teams' vehicle)
return Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);  // then it's fine to enter
else
return %obj.client.player.schedule(100, dismount);                                  // otherwise, eject them
}
return Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
   }
};
activatePackage(restrictedEnemyVehicles);
« Last Edit: October 12, 2015, 05:58:13 PM by Tezuni 2.0 »

More like
Code: [Select]
package restrictedEnemyVehicles
{
function armor::onCollision(%this, %obj, %col, %vec, %vecLen)
{
if(%col.getClassName() $= "Player" && isObject(%col.spawnBrick) && !minigameCstar fishe(%obj, %col))
{
return;
}

parent::onCollision(%this, %obj, %col, %vec, %vecLen);
}
};
activatePackage(restrictedEnemyVehicles);
There's no point in trying to unmount them because if you don't parent it, they don't mount the vehicle at all.

I think this is fixed in the NEXT VERSION OF SLAYER because I tested it and I couldn't mount enemy bot based vehicles.

Unfortunately the current slayer release STILL has the uniform bug. 
And Slayer 4 beta is not compatible with CTF, so i'm stuck using an old version of slayer in the meantime.

Thanks for the tips.