AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved detect if player presses the reload button (https://forums.alliedmods.net/showthread.php?t=334562)

AnimalMonster 10-04-2021 05:50

detect if player presses the reload button
 
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).

DJEarthQuake 10-04-2021 06:35

Re: detect if player presses the reload button
 
IN_RELOAD does work but not as a register_clcmd. Ham can detect better as no think is needed like IN_RELOAD.

AnimalMonster 10-04-2021 06:47

Re: detect if player presses the reload button
 
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!

HamletEagle 10-04-2021 07:46

Re: detect if player presses the reload button
 
https://forums.alliedmods.net/showthread.php?t=123645

Just noticed, you want this for knife only?

DJEarthQuake 10-04-2021 11:06

Re: detect if player presses the reload button
 
Quote:

Originally Posted by AnimalMonster (Post 2759582)
Thanks!

Pretty sure you did it all on your own.

Client_command will catch reload also.


All times are GMT -4. The time now is 11:35.

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