When i try to shoot a C4 it only damages the players around it, but not the player that shoot it.
Heres part of the code:
function GameConnection::C4Detonate(%client,%killer)
{
if(!isObject(%client.c4))
return;
if(!%killer)
%killer = %client;
cancel(%client.c4tick);
%pos = %client.c4.getTransform();
%p = new Projectile()
{
dataBlock = C4ExplosionP;
initialPosition = %pos;
initialVelocity = "0 0 0";
client = %killer;
};
MissionCleanup.Add(%p);
%p.explode();
%client.c4Timer = 1;
if(%client.c4.getClassName() $= "StaticShape")
%client.c4.delete();
else
%client.c4 = "";
}
function ProjectileData::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
if(%col.getClassName() !$= "StaticShape")
return;
if(%obj.client.minigame != %col.client.minigame)
return;
if(%col.getDatablock() $= nametoid("C4Shape"))
{
if(%obj.client.player.getMountedImage(0).melee != 1)
{
%col.client.C4Detonate(%obj.client);
commandtoclient(%col.client,'clearbottomprint');
}
else
{
if(isEventPending(%col.client.c4tick))
{
%col.diffused = 1;
commandtoclient(%col.client,'clearbottomprint');
commandtoclient(%obj.client,'bottomprint',"\c4C4 bomb diffused.");
cancel(%col.client.c4tick);
%col.schedule(2000,delete);
}
}
return;
}
}