Raised This Month: $ Target: $400
 0% 

if (killed by bomb)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flynn
Senior Member
Join Date: Sep 2009
Old 09-26-2009 , 15:27   Re: if (killed by bomb)
Reply With Quote #1

You have to get the name of the weapon that causes the death. If you are unsure what weapon the explosion if, use a printtochatall function to print out the weapon that caused the death.

I'm moving between places so I don't have my code base to reference from, but the line to retrieve the code would be...

Code:
new String:WeaponName[128];
GetEventString(DeathEvent,"weapon",WeaponName, 128);
PrintToChatAll("Method of death was %s",WeaponName);
Once you find the name of the weapon (event_death uses a different naming convention than standard!) that causes the death, just do a StrContains check for it in the death_event.

Edit: Poop. I completely didn't read your post. Sorry Dude. Although I find it strange there is no death event (I thought that was de-facto standard?). Are you sure you're not having issues with that instead?

Last edited by Flynn; 09-26-2009 at 15:32.
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 09-26-2009 , 18:33   Re: if (killed by bomb)
Reply With Quote #2

thx, ill give that a shot. thats exactly what i did to check if there was an attacker. i made a quick plugin printing the attacker index and nothing at all got printed when the bomb killed me. but maybe there is a weapon.

*edit
no weapon either. pretty sure the event isnt called. would make sense since death by bomb doesnt count as a death in the players score. intercepted by the engine!

Last edited by meng; 09-26-2009 at 23:34.
meng is offline
Send a message via Yahoo to meng
Flynn
Senior Member
Join Date: Sep 2009
Old 09-28-2009 , 23:29   Re: if (killed by bomb)
Reply With Quote #3

Quote:
Originally Posted by meng View Post
no weapon either. pretty sure the event isnt called. would make sense since death by bomb doesnt count as a death in the players score. intercepted by the engine!
Now my head is screwed on, is there a bomb event (aha lateral thinking) that is called by the bomb? When it occurs, have it check for any deaths within a given timeframe.

For example (Pseudo Code warning!)
Code:
 
public BombPreEvent()
{
  StoreAlivePlayersToArray();
  CreateTimer(0.3,Check);
}
 
public CheckStoredPlayers()
{
  for()
  {
    if(Stored[X] == dead)
    {
      DeathByBomb[Stored[X]] = true;
    }
  }
}
 
public Action:Check(Handle:timer)
{
  CheckStoredPlayers();
}
You get the idea. Store all the currently alive players to an array *before* the bomb event using a prehook, then check for any of them who have died after the bomb event has occurred and set them as death by bomb.

Obviously downside is that it might catch non-bomb related deaths during that split-second frame (unless they trigger a death_event, in which case you can tell it to set death by bomb as false again - because our bomb doesn't apparently trigger that).
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 09-29-2009 , 00:10   Re: if (killed by bomb)
Reply With Quote #4

thx,

maybe check between bomb_exploded and round_start? but, how the hell do i keep track of that? is there a set interval by the engine there? maybe create a timer for the same time?
meng is offline
Send a message via Yahoo to meng
Flynn
Senior Member
Join Date: Sep 2009
Old 10-01-2009 , 13:28   Re: if (killed by bomb)
Reply With Quote #5

Quote:
Originally Posted by meng View Post
maybe check between bomb_exploded and round_start? but, how the hell do i keep track of that? is there a set interval by the engine there? maybe create a timer for the same time?
Well, just setup an array of currently alive players on the bomb explosion, and then a timer after a matter of 0.5 seconds later to check who of the previously alive players died.
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode