Raised This Month: $32 Target: $400
 8% 

get_user_attacker returns wrong id [PARTLY SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
VEN
Veteran Member
Join Date: Jan 2005
Old 10-04-2006 , 15:21   Re: get_user_attacker returns wrong id
Reply With Quote #11

Quote:
Originally Posted by Silencer123 View Post
well i got it from somewhere and it worked for me.
Not many people understand what they doing. Some of them just blindly copy the code from somewhere.

Quote:
where you get the information from what part of the message is what?
Firstly i've got it from some kind of message/event list. And Message Logging plugin by Damaged Soul proved that numerous times. Though for CS i've never saw the first argument other than zero. It's happen because dmg_save pev is never changed for a player for a some reason.
VEN is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-04-2006 , 15:59   Re: get_user_attacker returns wrong id
Reply With Quote #12

Well, what is dmg_save?
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 10-04-2006 , 16:09   Re: get_user_attacker returns wrong id
Reply With Quote #13

Quote:
Originally Posted by VEN View Post
Not many people understand what they doing. Some of them just blindly copy the code from somewhere.
Yea, I am one of those persons. Well, not actually blind, but its a bit blurry to say the least. Maybe the message is differant in TFC.

This is what i get from a Damage message in TFC.

Quote:
L 10/04/2006 - 19:57:42: Logging started for message (Damage "72")
L 10/04/2006 - 19:57:44: MessageBegin (Damage "72") (Destination "One<1>") (Args "6") (Entity "1") (Classname "player") (Netname "Lt Llama") (Origin "0.000000 0.000000 0.000000")
L 10/04/2006 - 19:57:44: Arg 1 (Byte "0")
L 10/04/2006 - 19:57:44: Arg 2 (Byte "0")
L 10/04/2006 - 19:57:44: Arg 3 (Byte "0")
L 10/04/2006 - 19:57:44: Arg 4 (Coord "148.009201")
L 10/04/2006 - 19:57:44: Arg 5 (Coord "-338.805358")
L 10/04/2006 - 19:57:44: Arg 6 (Coord "-111.968750")
Im afraid i dont know what Im looking for.
Im still confused why I get a 3 digit id number from a player (me or a bot) in a function which is said to return

Quote:
get_user_attacker - Returns the index of an attacking player.
index is a player index from 1 to 32.
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.
Lt Llama is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-04-2006 , 16:18   Re: get_user_attacker returns wrong id
Reply With Quote #14

If the number is 0 it is worldspawn. (Drowning, Falling, etc.)
If it is higher than 32 (33, 34, ..., 194, ..., 1232, ..., 7045, ...)
it is an Entity. (trigger_hurt, func_door, func_train, any kind of Monster, etc.)
Try adding is_user_connected check.
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 10-04-2006 , 16:24   Re: get_user_attacker returns wrong id
Reply With Quote #15

Quote:
Originally Posted by XxAvalanchexX View Post
Try this and see what it says the classname is for the entities above 32:

Code:
new bum = get_user_attacker(id), classname[32] if(is_valid_ent(bum)) entity_get_string(bum,EV_SZ_classname,classname,31) else classname = "null" client_print(0,print_chat, "DEBUG: Bum id = %d (%s), Victim id = %d",bum,classname,id)
Huh! This is what it returns

Whats returned with XxAvalanchexX code


It thinks the attacker is a tf_rpg_rocket when it should return the player id i guess. As no second or third argument is there it SHOULD return the id according to
http://www.amxmodx.org/funcwiki.php?...cker&go=search.

And now i used

Code:
register_event("Damage", "Event_Damage","b","2!0");
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.
Lt Llama is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 10-04-2006 , 17:05   Re: get_user_attacker returns wrong id
Reply With Quote #16

Quote:
Originally Posted by Silencer123 View Post
Try adding is_user_connected check.
Wont do me any good as I cant get a correct id to check.
I tried it but it cant find me as the attacker, just my weapon.
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.
Lt Llama is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-04-2006 , 17:31   Re: get_user_attacker returns wrong id
Reply With Quote #17

Your Weapon is connected to the Server, but you are not? O_o
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 10-04-2006 , 17:38   Re: get_user_attacker returns wrong id
Reply With Quote #18

Quote:
Originally Posted by Silencer123 View Post
Your Weapon is connected to the Server, but you are not? O_o
I need a break
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.

Last edited by Lt Llama; 10-04-2006 at 17:40.
Lt Llama is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-04-2006 , 18:19   Re: get_user_attacker returns wrong id
Reply With Quote #19

No see, I told you to do a simple check, but you misinterperting where to put it or what to check for.

I'm not saying do this
Code:
public MyFuncForDamageOrWhatever(id) {      if (!is_user_alive(id))           // Code... }

But this:

Code:
public MyForDamageOrWhatever(id) {       // Normal code...       new attacker = get_user_attacker(/*params here*/);       if (!is_user_alive(attacker))            // User is not alive, or it's some other entity. }

Hope you understand now.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-04-2006 , 21:28   Re: get_user_attacker returns wrong id
Reply With Quote #20

"index is a player index from 1 to 32" is just something I added to about every single function that references the word "index" in regards to players (on grounds of consistency, most original functions had them, but new ones had the phrase left out), when I was still a part of the funcwiki.

get_user_attacker just returns your pev->dmg_inflictor, basically. If it's a player, it returns that. If it's an entity but not a player, it checks to see if the entity has an owner which is a player. If so, it returns the owner. Otherwise it returns the entity itself. In this case, you're getting hit with a rocket (I assume), so your dmg_inflictor is being set to the rocket entity. I'm surprised that the rocket entity doesn't have an owner set though.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 23:57.


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