isplayerinrangepoint Problem
#2

Код:
else if(newkeys == KEY_FIRE)
Quote:
Originally Posted by Wiki
How NOT to check for a key

Let's 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".
Use
Код:
if(newkeys & KEY_FIRE)
I don't think the else is necessary either.
Reply


Messages In This Thread
isplayerinrangepoint Problem - by StarPeens - 03.04.2015, 16:03
Re: isplayerinrangepoint Problem - by CalvinC - 03.04.2015, 16:07
Re: isplayerinrangepoint Problem - by StarPeens - 03.04.2015, 16:16
Re: isplayerinrangepoint Problem - by CalvinC - 03.04.2015, 16:21
Re: isplayerinrangepoint Problem - by StarPeens - 03.04.2015, 16:24
Re: isplayerinrangepoint Problem - by CalvinC - 03.04.2015, 16:28
Re: isplayerinrangepoint Problem - by StarPeens - 03.04.2015, 16:32
Re: isplayerinrangepoint Problem - by CalvinC - 03.04.2015, 16:36
Re: isplayerinrangepoint Problem - by StarPeens - 03.04.2015, 16:46

Forum Jump:


Users browsing this thread: 3 Guest(s)