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

Solved grenade_bounce (How to take owner(thrower) of projectile_ or grenade)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
neatek
AlliedModders Donor
Join Date: Jul 2010
Location: Russia
Old 10-15-2017 , 14:30   grenade_bounce (How to take owner(thrower) of projectile_ or grenade)
Reply With Quote #1

https://wiki.alliedmods.net/Counter-...grenade_bounce

Hello everyone.

Why this event doesnt have option like (int)"entity"?
or its mistake?

i really need (int)entity, but there only userid.

Last edited by neatek; 10-17-2017 at 15:53. Reason: solved
neatek is offline
sdz
Senior Member
Join Date: Feb 2012
Old 10-15-2017 , 14:32   Re: grenade_bounce
Reply With Quote #2

Quote:
Originally Posted by neatek View Post
https://wiki.alliedmods.net/Counter-...grenade_bounce

Hello everyone.

Why this event doesnt have option like (int)"entity"?
or its mistake?

i really need (int)entity, but there only userid.
check and make sure it's not a mistake, it is a wiki after all
sdz is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 10-15-2017 , 15:35   Re: grenade_bounce
Reply With Quote #3

Try in this way:
When the decoy spawns:
PHP Code:
SDKHook(entitySDKHook_TouchPostDecoyTouchPost); 
then
PHP Code:
public Action DecoyTouchPost(int entityint other)
{
int owner GetEntPropEnt(entityProp_Data"m_hOwnerEntity"); //Get the owner
//Your code

SDKUnhook(entitySDKHook_TouchPostDecoyTouchPost);

I took this way from FuturistcGrandes,
not user if you can do:
PHP Code:
int owner GetEntPropEnt(entityProp_Data"m_hOwnerEntity"); 
Even in 'your' event, but i think so.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-16-2017 , 11:58   Re: grenade_bounce
Reply With Quote #4

Quote:
Originally Posted by EasSidezz View Post
check and make sure it's not a mistake, it is a wiki after all
In csgo modevents.res
Code:
	"grenade_bounce"
	{
		"userid"	"short"
	}
You can use tricks to find it.
*edit
Seems not work well, example smokegrenades and decoys stay a while and player can throw new grenades after.
PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
HookEventEx("grenade_bounce"grenade_bounce);
}

public 
void grenade_bounce(Event event, const char[] namebool dontBroadcast)
{

    
int client GetClientOfUserId(event.GetInt("userid"));

    if(
client != 0)
    {
        
int ent = -1;
        
char buffer[30];

        while( (
ent FindEntityByClassname(ent"*")) != -)
        {
            
GetEntityClassname(entbuffersizeof(buffer));

            if(
StrContains(buffer"_projectile"false) != -&& GetEntProp(entProp_Send"m_fFlags") == && GetEntPropEnt(entProp_Data"m_hThrower") == client)
            {
                
PrintToServer("%s %i %i"bufferentclient);
            }
        }
    }


*edit
You can hook grenade bounce sounds...
__________________
Do not Private Message @me

Last edited by Bacardi; 10-16-2017 at 12:34.
Bacardi is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 10-16-2017 , 14:11   Re: grenade_bounce
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
In csgo modevents.res
PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
HookEventEx("grenade_bounce"grenade_bounce);
}

public 
void grenade_bounce(Event event, const char[] namebool dontBroadcast)
{

    
int client GetClientOfUserId(event.GetInt("userid"));

    if(
client != 0)
    {
        
int ent = -1;
        
char buffer[30];

        while( (
ent FindEntityByClassname(ent"*")) != -)
        {
            
GetEntityClassname(entbuffersizeof(buffer));

            if(
StrContains(buffer"_projectile"false) != -&& GetEntProp(entProp_Send"m_fFlags") == && GetEntPropEnt(entProp_Data"m_hThrower") == client)
            {
                
PrintToServer("%s %i %i"bufferentclient);
            }
        }
    }

.
I think
PHP Code:
int owner GetEntPropEnt(entityProp_Data"m_hOwnerEntity"); 
Will Work too, and it's much simpler.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 10-16-2017 at 14:12.
Papero is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-16-2017 , 17:14   Re: grenade_bounce
Reply With Quote #6

Quote:
Originally Posted by Papero View Post
I think
PHP Code:
int owner GetEntPropEnt(entityProp_Data"m_hOwnerEntity"); 
Will Work too, and it's much simpler.
That work too
__________________
Do not Private Message @me
Bacardi is offline
neatek
AlliedModders Donor
Join Date: Jul 2010
Location: Russia
Old 10-17-2017 , 15:48   Re: grenade_bounce
Reply With Quote #7

Oh, thanks guys for all answers, it's really helpful!

PHP Code:
GetEntPropEnt(GRENADE_ENTITYProp_Data"m_hThrower");
GetEntPropEnt(GRENADE_ENTITYProp_Data"m_hOwnerEntity");
// as you like 

Last edited by neatek; 10-17-2017 at 15:53.
neatek 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:05.


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