Basically a function to kill players or vehicles that collide with a vehicle if that vehicle is going above a set speed.
I've been loving around with onCollision but the results are very unreliable. I tried this:
function LegoFreightvehicle::onCollision(%this, %obj, %col, %vec, %vecLen)
{
%speed2 = vectorLen(%obj.getVelocity());
if(minigameCanDamage(%col,%obj) && isObject(%Col.Client.player) && %speed2 > 5)
{
%Col.kill();
%col.addVelocity("0 0 10");
}
if(%Col.getclassname() $= "AiPlayer")
{
%Col.kill();
%col.addVelocity("0 0 10");
}
if(%Col.getclassname() $= "Armor")
{
%Col.kill();
}
return parent::onCollision(%this, %obj, %col, %vec, %vecLen);
}
Right now it instakills any bots that walk into it, however it only occasionally kills players (the threshold was too high, players work reliably now) and it never kills vehicles.
Thanks in advance.