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

Solved detect if player presses the reload button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AnimalMonster
Senior Member
Join Date: May 2020
Old 10-04-2021 , 05:50   detect if player presses the reload button
Reply With Quote #1

So, to get this straight forward, i made a ability plugin which makes my job on abilties easier and there i would detect when player uses the drop button (register_clcmd("drop", "AbStart1") but the same method doesn't work with "reload" so i tried fakemeta and engine to detect button. Zombie Problem (with mod from scratch, not zp).

So, how can i detect when player presses the reload button as a zombie(which has knife lol).

Last edited by AnimalMonster; 10-04-2021 at 07:41.
AnimalMonster is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-04-2021 , 06:35   Re: detect if player presses the reload button
Reply With Quote #2

IN_RELOAD does work but not as a register_clcmd. Ham can detect better as no think is needed like IN_RELOAD.
__________________
DJEarthQuake is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 10-04-2021 , 06:47   Re: detect if player presses the reload button
Reply With Quote #3

Code:
public AbStartPre2(weaponid) //  Ham_Weapon_reload
{
	static id
	id = get_pdata_int(weaponid, 43, 4)
	
	client_print(id, print_chat, "%n Pressed Reload", id)
	
	if(!cso_is_zombie(id) || is_user_bot(id)) return;
	
	if(get_gametime()-g_LastReload[id] >= 0.1)
	{
		g_LastReload[id] = get_gametime()
		g_PressedReload[id] = true
	}
	else g_PressedReload[id] = false
}
Earlier made this code for that detecting but didn't really work.. tried to get id with pev(weaponid, pev_owner) but fail
Edit:Either it doesn't get called bcs knife or idk

Edit2: Lol, idk which was the reason the engine button method didn t work first time but now does. and also Thanks!

Last edited by AnimalMonster; 10-04-2021 at 07:41.
AnimalMonster is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-04-2021 , 07:46   Re: detect if player presses the reload button
Reply With Quote #4

https://forums.alliedmods.net/showthread.php?t=123645

Just noticed, you want this for knife only?
__________________

Last edited by HamletEagle; 10-04-2021 at 07:47.
HamletEagle is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-04-2021 , 11:06   Re: detect if player presses the reload button
Reply With Quote #5

Quote:
Originally Posted by AnimalMonster View Post
Thanks!
Pretty sure you did it all on your own.

Client_command will catch reload also.
__________________

Last edited by DJEarthQuake; 10-04-2021 at 11:08.
DJEarthQuake 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 16:56.


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