Raised This Month: $ Target: $400
 0% 

Altering ham parameters


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-14-2014 , 17:53   Altering ham parameters
Reply With Quote #1

I am trying to alter Ham_TakeDamage parameters with SetHamParam*.
This is how far I've got:
PHP Code:
    // Don't know if I need this temp
    
new temp victim;
    
SetHamParamEntity(1attacker);
    
SetHamParamEntity(3temp); 
But if I kill that victim, I get this DeathMsg:
Code:
Victim killed Attacker with player
I can see that that entities have swapped, but how do I change weapon to not show "player"?
Also, do I need that temp, or can I change those parameters directly? I will test, but answer from somebody who know for sure would help

EDIT: Also, what I'm trying to do is swap attacker and victim, so team damage would do damage to attacker.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 07-14-2014 at 18:16.
GuskiS is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-14-2014 , 18:36   Re: Altering ham parameters
Reply With Quote #2

Try putting second param same as third, I heard that when you are being attack by a gun, both attacker and inflictor are one player entity. Or try putting them to attacker's gun entity, or just inflictor to gun entity.
klippy is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-14-2014 , 19:37   Re: Altering ham parameters
Reply With Quote #3

Setting to attacker didn't work. Will test weapons ent.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 07-14-2014 , 20:09   Re: Altering ham parameters
Reply With Quote #4

Just for testing purposes

PHP Code:
public fw_takedamage(victiminflictorattackerFloat:damagebits)
{
    if(!
is_user_alive(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED

    
if(victim != attacker)
        return 
HAM_IGNORED

    
//option 1
    
SetHamParamEntity(1attacker)
    
SetHamParamEntity(2attacker == inflictor victim:inflictor)
    
SetHamParamEntity(3victim)

    
//option 2
    /*SetHamParamFloat(4, 0.0)
    ExecuteHam(Ham_TakeDamage, attacker, attacker == inflictor ? victim:inflictor, victim, damage, bits)*/
    
return HAM_SUPERCEDE


Last edited by NikKOo31; 07-14-2014 at 20:09.
NikKOo31 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-14-2014 , 23:40   Re: Altering ham parameters
Reply With Quote #5

Quote:
Originally Posted by GuskiS View Post
I can see that that entities have swapped, but how do I change weapon to not show "player"?
You never said what you wanted it to show.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-15-2014 , 04:41   Re: Altering ham parameters
Reply With Quote #6

Attackers weapon instead of message "player".

EDIT: Victim killed Attacker with "attackerweap"
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 07-15-2014 at 06:22.
GuskiS is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-15-2014 , 05:13   Re: Altering ham parameters
Reply With Quote #7

Try leaving attacker as it is, and just swap first(this) and second(inflictor) parameter.
klippy is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-15-2014 , 06:30   Re: Altering ham parameters
Reply With Quote #8

Quote:
Originally Posted by NikKOo31 View Post
Just for testing purposes

PHP Code:
public fw_takedamage(victiminflictorattackerFloat:damagebits)
{
    if(!
is_user_alive(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED

    
if(victim != attacker)
        return 
HAM_IGNORED

    
//option 1
    
SetHamParamEntity(1attacker)
    
SetHamParamEntity(2attacker == inflictor victim:inflictor)
    
SetHamParamEntity(3victim)

    
//option 2
    /*SetHamParamFloat(4, 0.0)
    ExecuteHam(Ham_TakeDamage, attacker, attacker == inflictor ? victim:inflictor, victim, damage, bits)*/
    
return HAM_SUPERCEDE

This changes "player" to weapon the actual victim(target) is carrying. I need actual attackers weapon.

Quote:
Originally Posted by KliPPy View Post
Try leaving attacker as it is, and just swap first(this) and second(inflictor) parameter.
Nope, doesn't work.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-15-2014 , 09:29   Re: Altering ham parameters
Reply With Quote #9

Create a dummy entity, set the classname to whatever weapon the attacker is using. Replace the inflictor parameter with this entity.
Don't create the entity with every event. Make one global and just change the classname.
__________________
Black Rose 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 21:17.


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