Advertisement
Guest User

Untitled

a guest
Aug 19th, 2012
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. //Big fucking thanks to solid files for shitting its fucking pants lately -_-
  2.  
  3.  
  4. /* GPL */
  5.  
  6. /* PawnCacheMate - A simple Cacheing system for sa-mp!
  7. Copyright (C) 2012 iToast / Mathew Brunning
  8.  
  9. This program is free software: you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation, either version 3 of the License, or
  12. (at your option) any later version.
  13.  
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. Also add information on how to contact you by electronic and paper mail.
  22. */
  23.  
  24. // If you have a problem with the GPLv3 You clearly wan't to use my script for comercial uses! //
  25.  
  26.  
  27. /* PawnCacheMate */
  28.  
  29. /* Developers */
  30.  
  31. // iToast - This
  32. // Sa-mp Dev Team - Sa-mp
  33. // Rockstar Games - GTA SA
  34. // Anyone I forgot...
  35.  
  36. #if defined _PawnCacheMate_included
  37. #endinput
  38. #endif
  39.  
  40. #define _PawnCacheMate_included
  41. #pragma library PawnCacheMate
  42.  
  43. // Limit the ammount to your needs!
  44. #define MAX_CACHED_OBJECTS 600
  45.  
  46. // Handler for cached objects
  47. new CACHED_OBJECTS[MAX_CACHED_OBJECTS] = false;
  48.  
  49. stock AddCachedObject(object[])
  50. {
  51. for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
  52. {
  53. if(!CACHED_OBJECTS[i])
  54. {
  55. CACHED_OBJECTS[i] = object;
  56. return 1;
  57. }
  58. }
  59. return 0;
  60. }
  61.  
  62. stock RemoveCachedObject(object[])
  63. {
  64. for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
  65. {
  66. if(CACHED_OBJECTS[i] == object)
  67. {
  68. CACHED_OBJECTS[i] = false;
  69. return 1;
  70. }
  71. }
  72. return 0;
  73. }
  74.  
  75. stock RemoveCachedObjectByID(id[])
  76. {
  77. CACHED_OBJECTS[id] = false;
  78. }
  79.  
  80. stock GetCachedObject(object[])
  81. {
  82. for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
  83. {
  84. if(CACHED_OBJECTS[i] == object)
  85. {
  86. return CACHED_OBJECTS[i];
  87. }
  88. }
  89. return 0;
  90. }
  91.  
  92. stock GetCachedObjectByID(id[])
  93. {
  94. return CACHED_OBJECTS[id];
  95. }
  96.  
  97. stock VerifyCachedObject(object[], object2[])
  98. {
  99. for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
  100. {
  101. if(CACHED_OBJECTS[i] == object)
  102. {
  103. return 1;
  104. }
  105. }
  106. return 0;
  107. }
  108.  
  109. stock VerifyCachedObjectByID(id[], object[])
  110. {
  111. if(CACHED_OBJECTS[id] == object)
  112. {
  113. return 1;
  114. }else{
  115. return 0;
  116. }
  117. }
  118.  
  119. stock RemoveAllCache()
  120. {
  121. for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
  122. {
  123. CACHED_OBJECTS[i] = false;
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement