Romanius

Bit tag. PAWN

Jun 22nd, 2011
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.59 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. stock Bit:operator+(Bit:val1, Bit:val2)
  4. {
  5.     return val1 | val2;
  6. }
  7.  
  8. stock Bit:operator-(Bit:val1, Bit:val2)
  9. {
  10.     return val1 & ~val2;
  11. }
  12.  
  13. stock bool:operator==(Bit:val1, Bit:val2)
  14. {
  15.     return bool:(val1 & val2);
  16. }
  17.  
  18. stock bool:operator!=(Bit:val1, Bit:val2)
  19. {
  20.     return !(val1 & val2);
  21. }
  22.  
  23. enum Bit ( <<=1 )
  24. {
  25.     NONE,
  26.     ONE = 1,
  27.     TWO,
  28.     THREE,
  29. }
  30.  
  31. public OnFilterScriptInit()
  32. {
  33.     new Bit:MyFirstBit = Bit:NONE;
  34.    
  35.     MyFirstBit += Bit:ONE;
  36.     MyFirstBit += Bit:TWO;
  37.     MyFirstBit += Bit:FREE;
  38.    
  39.     MyFirstBit -= Bit:ONE;
  40.    
  41.     printf("%b", _:MyFirstBit);
  42.    
  43.     return 1;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment