Advertisement
Guest User

exobjects

a guest
Dec 11th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.18 KB | None | 0 0
  1. /*
  2.     exobjects - Extended object functions.
  3.     kvann 2013, no rights reserved at all.
  4. */
  5.  
  6. #include <a_samp>
  7.  
  8. #if defined _exobjects_included
  9.     #endinput
  10. #endif
  11. #define _exobjects_included
  12.  
  13. /*
  14.     native CountObjects();
  15.     native DestroyAllObjects();
  16. */
  17.  
  18. new exobj_biggestid = -1;
  19. new exobj_count;
  20.  
  21. stock exobj_CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0)
  22. {
  23.     new id = CreateObject(modelid, X, Y, Z, rX, rY, rZ, DrawDistance);
  24.     if (id > exobj_biggestid) exobj_biggestid = id;
  25.     exobj_count++;
  26.     return 1;
  27. }
  28.  
  29. #if defined _ALS_CreateObject
  30.     #undef CreateObject
  31. #else
  32.     #define _ALS_CreateObject
  33. #endif
  34. #define CreateObject exobj_CreateObject
  35.  
  36. stock exobj_DestroyObject(objectid)
  37. {
  38.     DestroyObject(objectid);
  39.     exobj_count--;
  40.     return 1;
  41. }
  42.  
  43. #if defined _ALS_DestroyObject
  44.     #undef DestroyObject
  45. #else
  46.     #define _ALS_DestroyObject
  47. #endif
  48. #define DestroyObject exobj_DestroyObject
  49.  
  50. stock DestroyAllObjects()
  51. {
  52.     if (exobj_biggestid != -1) for (new i; i < exobj_biggestid; i++) if (IsValidObject(i)) DestroyObject(i);
  53.     exobj_biggestid = -1;
  54.     exobj_count = 0;
  55.     return 1;
  56. }
  57.  
  58. stock CountObjects() return exobj_count;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement