Guest User

Untitled

a guest
Apr 23rd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.49 KB | None | 0 0
  1. stock HexToInt(string[])
  2.     {
  3.         if (string[0] == 0)
  4.         {
  5.             return 0;
  6.         }
  7.         new i;
  8.         new cur = 1;
  9.         new res = 0;
  10.         for (i = strlen(string); i > 0; i--)
  11.         {
  12.             if (string[i-1] < 58)
  13.             {
  14.                 res = res + cur * (string[i - 1] - 48);
  15.             }
  16.             else
  17.             {
  18.                 res = res + cur * (string[i-1] - 65 + 10);
  19.                 cur = cur * 16;
  20.             }
  21.         }
  22.         return res;
  23.     }
Add Comment
Please, Sign In to add comment