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 , 11:45   Re: Change suicide to regular kill
Reply With Quote #1

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 #2

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
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 03:20.


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