AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hook reload (https://forums.alliedmods.net/showthread.php?t=313339)

tolpecek 01-05-2019 18:56

hook reload
 
hello
can somebody show me ho to hook reload event? i need this

Code:

        register_clcmd("+reload","cmdMoveEnt")                                                   
        register_clcmd("-reload","cmdStopEnt")

it moves with blocks on basebuilder.. thanks

CrazY. 01-05-2019 20:44

Re: hook reload
 
Ham_Weapon_Reload

Bugsy 01-05-2019 21:21

Re: hook reload
 
Quote:

Originally Posted by CrazY. (Post 2633111)
Ham_Weapon_Reload

I'm pretty sure that will spam. Look at this thread.

tolpecek 01-06-2019 03:53

Re: hook reload
 
Code:

RegisterHam(Ham_Weapon_Reload, "player", "ham_reload",1)
Code:

public ham_reload(id)
{
        if(g_CanBuild)
        {
                cmdMoveEnt(id)
        }
        else
        {
                cmdStopEnt(id)
        }
}

doesnt work

fysiks 01-06-2019 03:54

Re: hook reload
 
You should read all the replies to your posts. I.e. look at what Bugsy said.

tolpecek 01-06-2019 05:41

Re: hook reload
 
it looks difficult for me :(

CrazY. 01-06-2019 06:38

Re: hook reload
 
Did you try? If not, you should. If you have problems, try to search or ask here.

eat1k 01-06-2019 07:09

Re: hook reload
 
FakeMeta: pev(id, pev_buttons) & IN_RELOAD
I don't think Ham_Weapon_Reload will help you to do what you're trying to do. It's called only when a weapon is reloading so if you will press "R" without reloading a weapon it will not work.

tolpecek 01-06-2019 09:04

Re: hook reload
 
Quote:

Originally Posted by eat1k (Post 2633175)
FakeMeta: pev(id, pev_buttons) & IN_RELOAD
I don't think Ham_Weapon_Reload will help you to do what you're trying to do. It's called only when a weapon is reloading so if you will press "R" without reloading a weapon it will not work.

can u give me an example how to use it?

tolpecek 01-06-2019 09:15

Re: hook reload
 
Quote:

Originally Posted by eat1k (Post 2633175)
FakeMeta: pev(id, pev_buttons) & IN_RELOAD
I don't think Ham_Weapon_Reload will help you to do what you're trying to do. It's called only when a weapon is reloading so if you will press "R" without reloading a weapon it will not work.

Code:

register_forward(FM_PlayerPreThink, "fw_Player_PreThink")
Code:

public fw_Player_PreThink(id)
{
       
new buttons = pev(id, pev_button)
if(buttons & IN_RELOAD)
        {
                if(g_CanBuild)
                {
                        cmdMoveEnt(id)
                }
                else
                {
                        cmdStopEnt(id)
                }
        }
}

doesnt work


All times are GMT -4. The time now is 07:39.

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