Raised This Month: $ Target: $400
 0% 

fake_touch doesn't work for a weaponbox in the air


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sekac
Senior Member
Join Date: Nov 2016
Old 07-07-2018 , 17:49   fake_touch doesn't work for a weaponbox in the air
Reply With Quote #1

So if I call fake_touch on a weaponbox that's in the air it doesn't work.
Here is the code:
PHP Code:
new ent find_ent_by_owner(-1"weaponbox"id)
        
fake_touch(entid
And the entity index is always the same, it doesn't matter if it's in the air or not.

Any way to do this?

Last edited by sekac; 07-07-2018 at 17:54.
sekac is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-08-2018 , 02:33   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #2

weaponbox has owner? Maybe use find_ent_by_class ?
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
sekac
Senior Member
Join Date: Nov 2016
Old 07-08-2018 , 06:19   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #3

When I use find_ent_by_owner when a weapon is in the air it returns the same entity as when the weapon is on the ground, but fake_touch only works if it's on the ground for some reason.
sekac is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-08-2018 , 06:48   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #4

https://github.com/s1lentq/ReGameDLL...pons.cpp#L1603

PHP Code:
if (!(pev->flags FL_ONGROUND))
    {
        return;
    } 
That's why it doesn't work. The weaponbox must be on ground for the touch to work. This is done most likely to avoid the initial touch when the weapon is dropped. Without that check you would pick back the weapon instantly.
__________________

Last edited by HamletEagle; 07-08-2018 at 06:59.
HamletEagle is offline
sekac
Senior Member
Join Date: Nov 2016
Old 07-08-2018 , 06:59   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #5

So is there a way of doing this? It doesn't even return a value so we can do it until it's successful...
sekac is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-08-2018 , 07:08   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #6

Quote:
Originally Posted by sekac View Post
So is there a way of doing this? It doesn't even return a value so we can do it until it's successful...
What return value are you talking about? Better explain what you REALLY want to do because touching a weaponbox that's in air doesn't make much sense.
__________________
HamletEagle is offline
sekac
Senior Member
Join Date: Nov 2016
Old 07-08-2018 , 07:12   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #7

I mean it doesn't return 1 if it is successful and 0 otherwise. Touching a weaponbox in the air is not my intention, but often when I call fake_touch it fails because it's in the air and I want to fix that.
sekac is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-08-2018 , 07:15   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #8

Quote:
Originally Posted by sekac View Post
I mean it doesn't return 1 if it is successful and 0 otherwise. Touching a weaponbox in the air is not my intention, but often when I call fake_touch it fails because it's in the air and I want to fix that.
Then simply check if it's on ground before calling fake_touch(pev_flags & FL_ONGROUND).
__________________

Last edited by HamletEagle; 07-08-2018 at 07:15.
HamletEagle is offline
sekac
Senior Member
Join Date: Nov 2016
Old 07-08-2018 , 07:18   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #9

Yes, but I need it to work even if it's in the air. So if I call it while it's in the air how would I wait for the weaponbox to be on the ground to call fake touch?
sekac is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-08-2018 , 07:29   Re: fake_touch doesn't work for a weaponbox in the air
Reply With Quote #10

I'm afraid this is some kind of XY problem. Again, what are you trying to do? And no, the answer is not "touching a weaponbox". What's the purpose of this? In what context you want to force the touch?
__________________
HamletEagle 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 12:43.


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