Xor - 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: Xor (
/showthread.php?tid=112535)
Xor -
KKashimia - 08.12.2009
I was wondering - in turbo pascal we have or and xor operators. Does pawno have an alternative for xor? (1011 xor 0101 = 1110)
Re: Xor -
dice7 - 08.12.2009
The logical XOR should be something like this
pawn Код:
p = true;
q = true;
(p || q) && !(p && q)
1 and 1 is 0
1 and 0 is 1
0 and 1 is 1
0 and 0 is 0
Re: Xor -
KKashimia - 08.12.2009
That would, in some cases, get it done, but how can I make it work with integers? I just sooo need a xor operator around here...
Example: 6 xor 2 = 7 (binary: 0110 xor 0010 = 0111)
Re: Xor -
Donny_k - 08.12.2009
Look in YSI, the misc file contains one IIRC.
Re: Xor -
KKashimia - 08.12.2009
Maybe you know where I could find a pawn function that would convert an integer to binary code? Or atleast emulate that with outputing an array/string of integers (1-0)
Re: Xor -
Joe Staff - 08.12.2009
Take a good look
HERE It's pertaining to keys and keys are in binary.
Re: Xor -
Malice - 08.12.2009
XOR is ^. e.g. a ^ b
The guy just wants xor people...
Re: Xor -
Westie - 08.12.2009
The XOR operator in PAWN (and most C-like languages) is ^.
(Oh damn you...)
Also,
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange does not contain an example of exclusive or.
Re: Xor -
KKashimia - 08.12.2009
Thanks. I don't really know C languages that well