Raised This Month: $ Target: $400
 0% 

Change suicide to regular kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
B3N4K
Senior Member
Join Date: Jun 2008
Location: Czech Republic
Old 08-01-2011 , 05:23   Change suicide to regular kill
Reply With Quote #1

Hello,

I tried to search, but i didn't found any specific way how to change suicide to regular kill. I mean lets say i have a plugin that poison enemy when he gets shot. And then it takes him 3 HP/s. And when it reaches zero he just die.

In death messages it shows up like suicide etc. But i want it to show like kill (show name who killed him and give him frag).

Thanks for help!
B3N4K is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-01-2011 , 06:54   Re: Change suicide to regular kill
Reply With Quote #2

The plugin must store the killer and then parse it into the deathmsg or to the function that deals the damage.

Show your code if you want real help.
__________________
Hunter-Digital is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-01-2011 , 08:06   Re: Change suicide to regular kill
Reply With Quote #3

I think I would execute ham_takedamage when damage is given to the victim with the killer's id as attacker (and probably inflictor). That way, the killer get's teh kill.
__________________
fysiks is offline
B3N4K
Senior Member
Join Date: Jun 2008
Location: Czech Republic
Old 08-01-2011 , 11:45   Re: Change suicide to regular kill
Reply With Quote #4

Hunter-Digital: Sorry but i don't have any code yet. Thats what i am asking for ;-)

fysiks: Thanks
So it should look like this?
Code:
g_player_killed_by[MAXPLAYERS+1] = 0;
RegisterHam("Ham_TakeDamage", "player", "event_player_damage");

public event_player_damage(victim, inflictor, attacker, dmg, dmgbits)
{
  if (g_player_killed_by[victim] != 0) //if this is takedmg that kills user, change attacker id
  {
    setHamParamInteger(3, g_player_killed_by[victim]);
    g_player_killed_by[victim] = 0;
  }
}

public doPoison(id, attacker)
{
  if (is_user_alive(id))
  {
    new health, args[2];
    health = get_user_health(id);
    if (health-3 <= 0) // If this is takedmg that kills user, tell event_player_damage to change attacker
    {
      g_player_killed_by[id] = attacker;
    }
     set_user_health(id, (health-3));
    args[0] = id;
    args[1] = attacker;
    set_task(1.0, "doPoison", id, args, 1);
  }
}
Or do i have to do something with executeHam(Ham_TakeDamage, ... ... ? ??) ? I Never worked with executeHam, so if it is necessary to do this this way where can i find some documentation?

Last edited by B3N4K; 08-01-2011 at 11:51.
B3N4K is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-01-2011 , 11:59   Re: Change suicide to regular kill
Reply With Quote #5

If you're making it, you don't need to store the attacker then if you'll use ExecuteHam().
Input for ExecuteHam() is like the callback's inputs:
Quote:
event_player_damage(victim, inflictor, attacker, dmg, dmgbits)
Those beeing Ham_TakeDamage's params, ExecuteHam would be:
Code:
ExecuteHam(Ham_TakeDamage, victim, inflictor, attacker, 3.0, DMG_POISON)
You should look into ham_const.inc for future ham related hooks.

Also your "doPoison" is not called by anything... and registering Ham_TakeDamage doesn't really do anything there, unless that's the way you're triggering poison, but I can't see it be called.
__________________
Hunter-Digital is offline
B3N4K
Senior Member
Join Date: Jun 2008
Location: Czech Republic
Old 08-01-2011 , 12:08   Re: Change suicide to regular kill
Reply With Quote #6

Oh i see. Thank you very much for your help ;-)

PS: doPoison is not called because it was there just for demonstration. It will be part of greater plugin ;-)
And about Ham_TakeDamage - i thought that it's triggered when i use set_user_health, but it really doesn't make sense (i am setting user's health, not dealing damage to him, so really no reason to trigger ham_takedamage) :-D

Thank you very much ;-)
B3N4K is offline
B3N4K
Senior Member
Join Date: Jun 2008
Location: Czech Republic
Old 08-01-2011 , 12:32   Re: Change suicide to regular kill
Reply With Quote #7

Last question: What should inflictor be? :-)
B3N4K is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-01-2011 , 14:51   Re: Change suicide to regular kill
Reply With Quote #8

Inflictor is the entity that caused the damage. Like a weapon or another entity (Damage block in bm for example)
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-01-2011 , 15:09   Re: Change suicide to regular kill
Reply With Quote #9

Quote:
Originally Posted by drekes View Post
Inflictor is the entity that caused the damage. Like a weapon or another entity (Damage block in bm for example)
If it is a gun, then the inflictor is the same as the attacker.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
B3N4K
Senior Member
Join Date: Jun 2008
Location: Czech Republic
Old 08-01-2011 , 15:22   Re: Change suicide to regular kill
Reply With Quote #10

So what should it be if i want to show skull image in deathmsg? I knew that all you wrote, but i don't know what should it be now.. Because he wasn't killed by any weapon.. Or by any other entity.. He just died because of "poison"..
B3N4K is offline
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 07:13.


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