AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting old buttons (https://forums.alliedmods.net/showthread.php?t=5977)

Twilight Suzuka 09-18-2004 12:23

Getting old buttons
 
Ok, could someone explain what get_user_oldbutton can do?
Can it get the buttons the person pressed BEFORE pressing the button they just did? I'm not getting it. Help me please!

PM 09-18-2004 12:30

Its the buttons of the last frame (although i prefer to get them on my own in server_frame because I have a bad experience with this).
When you have the current and the last buttons, you can easily get what buttons were pressed / released between this frame and the frame before.

Code:
            g_PlayerKeysPressed[i] = (g_PlayerKeys[i] ^ g_PlayerOldKeys[i]) & g_PlayerKeys[i];      // (new xor old) and new             g_PlayerKeysReleased[i] = (g_PlayerKeys[i] ^ g_PlayerOldKeys[i]) & g_PlayerOldKeys[i]// (new xor old) and old

That is how i do it in my superkeeper plugin.

Twilight Suzuka 09-18-2004 14:25

Thank you!


All times are GMT -4. The time now is 17:12.

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