Forums Index >> Modding >> Sorry, snipers!



Page : <1> :


You have to hate it when you kill someone and they spawn right next to you. Well, try this code, and you'll hate it even more!

 

                                        
function TankData::onDestroyed(%db,%this,%killer)
{
If ($Game::SinglePlayer)
{
%db.onSPDestroyed(%this,%killer);
Return;
}
If ($Game::TargetRange)
{
%db.onTargetDestroyed(%this,%killer);
Return;
}
// need to deal with both ai bots and players as killer's and killee's
%client = %this.client;
%client.deaths++;
// echo("killed tank: " @ %this @ ", client: " @ %client);
// echo("killer tank: " @ %killer @ ", client: " @ %killerClient);
If (isObject(%killer))
{
MessageAll('MsgClientKilled','%1 has been eliminated by %2!',%client.name,%killer.client.name);
If ($Game::MissionType $= "Deathmatch")
{
// this is a score...
If ($Game::TeamGame)
{
If (%killer.client.team.getId() != %client.team.getId())
%killer.incScore(1,1);
}
Else
%killer.incScore(1,1);
}
%killer.client.kills++;
}
Else
{
MessageAll('MsgClientKilled','%1 has been eliminated!',%client.name);
}
If ($Game::MissionType $= "Deathmatch")
{
If ($Game::TeamGame)
{
If (isObject(%killer) && %killer.client.team.getId() == %client.team.getId())
// team killer, lose point
%killer.incScore(-1,-1);
Else
%this.incScore(-1,0);
}
Else
%this.incScore(-1,-1);
}
If (!isObject(%client.ai))
{
If ($Game::aiControlMode)
{
%client.player = 0;
%client.schedule(4000,"spawnPlayer");
}
Else
CommandToClient(%client,'CenterPrint',"Your brain has been separated from your tank, press SPACE.", 0, 1 );
}
Else
SpawnBotPlayer(%client);
if isObject(%killer)
{
%pos = %this.getPosition();
%rot = %this.Rotation;
%newPos = (VectorAdd(%killer.getPosition(), "-10 -10 10") @ " " @ %rot);
%this.setTransform(%newPos);
}
}

 

Transplanted the code from a teleporter into Tank2.cs. Snipers will never be safe again. It spawns you, then whisks you away to the person who shot you. I've decided to keep my promise. NOTE: I haven't tested it yet. Use at your own risk!
NOTE BEFORE USING: Un-capitalize all the lines that start with caps! They were formatted that way by PTT!

Last edited: Friday, February 24, 2006 at 11:54:15 AM

Friday, February 24, 2006 at 10:58:31 AM

I can use this for my racing mods! Thanks!

EDIT: So... Where do I put it in? Tank2.cs?

Last edited: Friday, February 24, 2006 at 11:08:32 AM

Friday, February 24, 2006 at 11:06:20 AM

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒╔╬════╬╗▒▒▒▒
▒▒▒Ж-۝-۞-۝-۞-Ж▒▒▒▒
▒▒▒╚╬════╬╝▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

 

I love my randylion

 

Friday, February 24, 2006 at 9:26:03 PM

Page : <1> :

insert quote insert url insert email insert image bold italic underline superscript subscript horizontal rule : : Help on using forum codes

Add comment:

HTML is disabled within comments, but ZBB Code is enabled.

Back to the top

Web site designed, maintained and funded by -z- and Dan MacDonald