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

Distance kill


Post New Thread Reply   
 
Thread Tools Display Modes
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-06-2016 , 00:05   Re: Distance kill
Reply With Quote #21

Quote:
Originally Posted by wickedd View Post
That's true Bugsy but he checked if the weapon != knife, so anything after that will not be called. The reason I said is_user_connected is needless in this case is because he's not doing anything to the attacker. I may be wrong but I don't see any need to check in this particular situation. Now if he wouldn't have checked for the weapon then I would agree.

P.S. If missed something please let me know.
I'm not sure why you're not directly pointing out why exactly he doesn't need to check the killer is connected. But I went ahead and looked into it, and for anyone wondering, it's because get_user_weapon returns 0 if the client isn't connected. So does get_user_origin.

Quote:
Originally Posted by Hedgehog95 View Post
Can someone explain this to me?
get_user_weapon will return true if the kill is a nade kill and the user has their knife out at the time of the kill.
PartialCloning is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-06-2016 , 04:48   Re: Distance kill
Reply With Quote #22

About Hedgehog's code and is_user_connected() check on the attacker - he has to have it because attacker can be any entity, not just a player. is_user_connected() checks if the entity is a valid connected player.

@PartialCloning, get_user_origin won't just return 0 on invalid player index, it will throw an error and halt the running function. Take a look here. You don't really want that to happen.
klippy is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-06-2016 , 06:15   Re: Distance kill
Reply With Quote #23

Yeah for some reason I assumed he was checking if entity is within maxclients.
PartialCloning 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 17:37.


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