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

csgo weapon_healthshoot hook


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Maind
Member
Join Date: Dec 2009
Old 07-09-2016 , 15:25   csgo weapon_healthshoot hook
Reply With Quote #1

Hello, im new in scripting and i cant find solution to my problem.

Im trying to hook something after useing medishot in csgo, however i can't find proper event to hook with. Looked through modevents,gameevents,serverevents and there is nothing about medishot. Tried to hook it to "weapon_fire" but it acts strange and sends multiple signals and code

Code:
public Event_WeaponFire(Event event, const String:name[], bool:dontBroadcast)
{
	char weapon[64];	
	event.GetString("weapon", weapon, sizeof(weapon));
	PrintToChatAll("Which weapon do we use - WEAPON: %s", weapon);	
}
produce smth like this after just one use
Quote:
Which weapon do we use - WEAPON: weapon_healthshot
Which weapon do we use - WEAPON: weapon_healthshot
Which weapon do we use - WEAPON: weapon_healthshot
...
Which weapon do we use - WEAPON: weapon_healthshot
It does not even have to finish i can just start apply shot, interrupt it, and it still continues to send events like i wouldnt stop it.

How to hook to medishoot then (the succesfull use)??

Ps. btw not to add another thread, it is impossible to apply healthshoot if u have 100% hp. How can i bypass it?

Ps2. Sorry for my bad english, i hope its understandable
Maind is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-09-2016 , 20:49   Re: csgo weapon_healthshoot hook
Reply With Quote #2

I would hook the entity being destroyed at a quick glance of your question.
__________________
Neuro Toxin is offline
Maind
Member
Join Date: Dec 2009
Old 07-10-2016 , 02:29   Re: csgo weapon_healthshoot hook
Reply With Quote #3

Yeah now it looks much better! However i got another problem - i can't get the client who used it code
Code:
public  OnEntityDestroyed(entity)
{
	new String:name[32];
	
	GetEdictClassname(entity, name, sizeof(name));
	new client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
	//CreateTimer(0.1, SpeedUp, client, TIMER_REPEAT);
	
	if (!strcmp(name, "weapon_healthshot"))
	{
		PrintToChatAll("Entity Destoryed: (index %i , name %s , client %i )", entity, name, client);
	}
}
retur me that client is "-1" ;/
Maind is offline
Maind
Member
Join Date: Dec 2009
Old 03-22-2017 , 12:07   Re: csgo weapon_healthshoot hook
Reply With Quote #4

Bump - Still can't find the solution ;/
Maind is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 03-22-2017 , 14:29   Re: csgo weapon_healthshoot hook
Reply With Quote #5

I think the entity is already destroyed when OnEntityDestroyed is called, so some of the netprops can't be called.

You can try this:

Code:
public void OnEntityCreated(int entity, const char[] classname)
{
	if (!strcmp(classname, "weapon_healthshot"))
	{
		SDKHook(entity, SDKHook_Use, Hook_Use);
	}
}

public Action Hook_Use(int entity, int activator, int caller, UseType type, float value)
{
	if (1 <= activator <= MaxClients)
	{
		char[] name = "weapon_healthshot";	//You hooked onto, wepaon_healthshot so it should be the same
		PrintToChatAll("Entity Destoryed: (index %i , name %s , client %i )", entity, name, activator);
	}
}
__________________

Last edited by Chaosxk; 03-22-2017 at 14:38.
Chaosxk is offline
Maind
Member
Join Date: Dec 2009
Old 09-28-2018 , 15:05   Re: csgo weapon_healthshoot hook
Reply With Quote #6

If somebody gets stucked with same problem, i've got solution with use of dhooks https://forums.alliedmods.net/showpo...72&postcount=8
Maind is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-28-2018 , 16:31   Re: csgo weapon_healthshoot hook
Reply With Quote #7

Im pretty sure there is an event for healthshots being used.
__________________
Neuro Toxin is offline
Reply


Thread Tools
Display Modes

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 22:20.


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