SendClientMessage won't display
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

Quote:
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".

Quote:
How to check for a key

So, if the variable can contain multiple keys at once, how do you check for just a single one? The answer is bit masking. Each key has its own bit in the variable (some keys have the same bit, but they are onfoot/incar keys, so can never be pressed at the same time anyway) and you need to check for just that single bit:
Код:
if (newkeys & KEY_FIRE)
As for your problem, I don't know. Is the teleport working but the message not sending?
Reply


Messages In This Thread
SendClientMessage won't display - by NBass - 17.03.2017, 21:55
Re: SendClientMessage won't display - by Toroi - 17.03.2017, 22:00
Re: SendClientMessage won't display - by NBass - 17.03.2017, 22:16
Re: SendClientMessage won't display - by Toroi - 17.03.2017, 22:20
Re: SendClientMessage won't display - by NBass - 17.03.2017, 23:00

Forum Jump:


Users browsing this thread: 2 Guest(s)