AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Very basic code (https://forums.alliedmods.net/showthread.php?t=337684)

OW3R 05-07-2022 13:07

Very basic code
 
Hi guys, I want it to do the task when the IN_RELOAD key is pressed for 3 seconds. can you give me this code

Supremache 05-07-2022 14:32

Re: Very basic code
 
PHP Code:

public plugin_init() {    
    
register_forward(FM_CmdStart"fw_CmdStart");
}

public 
fw_CmdStart(id)
{
    if( 
pevidpev_button ) & IN_RELOAD )
    {
        
set_task1.0"OnReload"id )
    }



Craxor 05-07-2022 15:10

Re: Very basic code
 
supremache, did you test your code and works?

I think hooking reload works a bit trickier than that: https://forums.alliedmods.net/showth...ht=hook+reload


Not sure honestly .

edit: Now i see , the above code will check when pressing R button but will not hook the actual reload (Use ham for that ).

Here: https://forums.alliedmods.net/showpo...2&postcount=20

Also the author wanted an code snippet if you hold the button pressed more than three seconds.

OW3R 05-08-2022 03:40

Re: Very basic code
 
Quote:

Originally Posted by Craxor (Post 2778880)
supremache, did you test your code and works?

I think hooking reload works a bit trickier than that: https://forums.alliedmods.net/showth...ht=hook+reload


Not sure honestly .

edit: Now i see , the above code will check when pressing R button but will not hook the actual reload (Use ham for that ).

Here: https://forums.alliedmods.net/showpo...2&postcount=20

Also the author wanted an code snippet if you hold the button pressed more than three seconds.

Works really well thanks


All times are GMT -4. The time now is 08:48.

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