I have been doing some testing about holding and releasing button and I have notice when you stand still (no key press or mouse movement) then double tap on Attack1, it will automanticly record as holding it
Is it anyway to prevent that to happen?
Code used to test:
Spoiler
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
//#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <fun>
// #include <xs>
// #include <sqlx>
#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Celena Luna"
new g_iBarTime
new g_Holding [ 33 ]
public plugin_init ()
{
register_plugin ( PLUGIN , VERSION , AUTHOR )
//Forwards
//register_forward(FM_SetModel, "fw_SetModel")
RegisterHam ( Ham_Player_PreThink , "player" , "fw_Player_Prethink" )
g_iBarTime = get_user_msgid ( "BarTime" )
}
public fw_Player_Prethink ( id ) {
new buttons = pev ( id , pev_button ) // buttons in current frame
new oldbuttons = pev ( id , pev_oldbuttons ) // buttons in previous frame
if( buttons & IN_USE && !( oldbuttons & IN_ATTACK ) )
{
client_print ( id , print_chat , "press the Attack key" )
}
if( buttons & IN_ATTACK && oldbuttons & IN_ATTACK )
{
if(! g_Holding [ id ])
{
message_begin ( MSG_ONE_UNRELIABLE , g_iBarTime , . player = id )
write_short ( 10 )
message_end ()
g_Holding [ id ] = 1
}
}
if( oldbuttons & IN_ATTACK && !( buttons & IN_ATTACK ) )
{
message_begin ( MSG_ONE_UNRELIABLE , g_iBarTime , . player = id )
write_short ( 0 )
message_end ()
g_Holding [ id ] = 0
client_print ( id , print_chat , "release the Attack key" )
}
return FMRES_IGNORED
}
__________________