SA-MP Forums Archive
I need help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: I need help (/showthread.php?tid=227892)



I need help - Ironboy - 18.02.2011

I want to do something in "OnPlayerKeyStateChange"
But i want a key like this..
pawn Код:
if(newkeys & KEY_HORN)
but it says
pawn Код:
C:\Documents and Settings\Ironboy\Desktop\Windows server\gamemodes\Paradise_City.pwn(2203) : error 017: undefined symbol "KEY_HORN"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
how to fix it? plz help me


Re: I need help - HyperZ - 18.02.2011

Put this under INC's
pawn Код:
#define KEY_HORN 2



Re: I need help - Ironboy - 18.02.2011

what is INC? you mean Includes?


Re: I need help - HyperZ - 18.02.2011

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
what is INC? you mean Includes?
Yes.


Re: I need help - Mean - 18.02.2011

Why not then just:
pawn Код:
if(newkeys && 2)
?
Also, you had to put the & twice (&&).


Re: I need help - Calgon - 18.02.2011

Quote:
Originally Posted by Mean
Посмотреть сообщение
Also, you had to put the & twice (&&).
Mean, you're wrong once again. You really need to stop posting and gain understanding of how SA-MP works before you continue to make yourself look even more stupid.

The single '&' sign is required for the operation for bit masking, the single sign indicates that the operation in use is a bitwise AND sign and not a logical AND operator.

Add the code:
pawn Код:
#define KEY_HORN 2
Or (doing it properly, providing 2 is the correct code for it) - there's no need for the useless macro
pawn Код:
if(newkeys & 2)



Re: I need help - Ironboy - 18.02.2011

ok ty very much