is there any way of knowing if any player holding a key pressed? for example that I keep pressed the key h for 30 seconds and tell me a message? If you can or not?
and if you can with this function I could tell as works is that put
function GUI::KeyPressed()
{
}
and I get nothing
Thanks already ;)
Untested, but should give an idea.
g_Time_Key_Pressed <- array(100, 0);
function onScriptLoad()
{
enter <- BindKey( true, 0x0D, 0, 0 ); // The Key Code of enter is 0x0D . we will use bindkey function to set the key. And it is required.
}
function onKeyDown( player, key )
{
if ( key == enter )
{
g_Time_Key_Pressed[ player.ID ] = time();
}
}
function onKeyUp( player, key )
{
if ( key == enter )
{
if ( g_Time_Key_Pressed[ player.ID ] != 0 && (time() - g_Time_Key_Pressed[ player.ID ]) >= 30 )
{
// Do something funky
} else {
// Didn't hold for 30 seconds.
}
}
}
Quote from: Thijn on Oct 31, 2016, 07:04 AMUntested, but should give an idea.
:Dgreat friend thank you ;) ;D