22.01.2010, 08:34
Quote:
Originally Posted by Samp wiki ;)
How NOT to check for a key
Lets presume that you want to detect when a player presses their FIRE button, the obvious code would be: if (newkeys == KEY_FIRE) This code may even work in your testing, but it is wrong and your testing is insufficient. Try crouching and pressing fire - your code will instantly stop working. Why? Because "newkeys" is no longer the same as "KEY_FIRE", it is the same as "KEY_FIRE" COMBINED WITH "KEY_CROUCH". |