Advertisement
fakuivan

Untitled

Feb 8th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. #if defined _tf2idb_included //{
  2. //older versions of tf2idb don't include TF2IDB_UsedByClasses
  3. //this function gets around that restriction
  4. stock int TF2IDB_UsedByClasses_Compat(int i_id)
  5. {
  6.     char s_query[255 /* the query without the id is ~249 chars */ - 2 + 12];
  7.    
  8.     Format(s_query, sizeof(s_query),
  9.         "SELECT replace(replace(replace(replace(replace(replace(replace(replace(replace(" ...
  10.         "`class`, 'scout', 1), 'sniper', 2), 'soldier', 3), 'demoman', 4), 'medic', 5), 'heavy', 6), 'pyro', 7), 'spy', 8), 'engineer', 9) " ...
  11.         "FROM `tf2idb_class` WHERE `id` IS %d",
  12.         i_id);
  13.    
  14.     ArrayList h_classes = view_as<ArrayList>(TF2IDB_FindItemCustom(s_query));
  15.     int i_bitmask;
  16.    
  17.     for (int i_iter = 0; i_iter < GetArraySize(h_classes); i_iter++)
  18.     {
  19.         i_bitmask |= (1 << GetArrayCell(h_classes, i_iter));
  20.     }
  21.     return i_bitmask;
  22. }
  23. #endif //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement