Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Big fucking thanks to solid files for shitting its fucking pants lately -_-
- /* GPL */
- /* PawnCacheMate - A simple Cacheing system for sa-mp!
- Copyright (C) 2012 iToast / Mathew Brunning
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- Also add information on how to contact you by electronic and paper mail.
- */
- // If you have a problem with the GPLv3 You clearly wan't to use my script for comercial uses! //
- /* PawnCacheMate */
- /* Developers */
- // iToast - This
- // Sa-mp Dev Team - Sa-mp
- // Rockstar Games - GTA SA
- // Anyone I forgot...
- #if defined _PawnCacheMate_included
- #endinput
- #endif
- #define _PawnCacheMate_included
- #pragma library PawnCacheMate
- // Limit the ammount to your needs!
- #define MAX_CACHED_OBJECTS 600
- // Handler for cached objects
- new CACHED_OBJECTS[MAX_CACHED_OBJECTS] = false;
- stock AddCachedObject(object[])
- {
- for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
- {
- if(!CACHED_OBJECTS[i])
- {
- CACHED_OBJECTS[i] = object;
- return 1;
- }
- }
- return 0;
- }
- stock RemoveCachedObject(object[])
- {
- for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
- {
- if(CACHED_OBJECTS[i] == object)
- {
- CACHED_OBJECTS[i] = false;
- return 1;
- }
- }
- return 0;
- }
- stock RemoveCachedObjectByID(id[])
- {
- CACHED_OBJECTS[id] = false;
- }
- stock GetCachedObject(object[])
- {
- for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
- {
- if(CACHED_OBJECTS[i] == object)
- {
- return CACHED_OBJECTS[i];
- }
- }
- return 0;
- }
- stock GetCachedObjectByID(id[])
- {
- return CACHED_OBJECTS[id];
- }
- stock VerifyCachedObject(object[], object2[])
- {
- for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
- {
- if(CACHED_OBJECTS[i] == object)
- {
- return 1;
- }
- }
- return 0;
- }
- stock VerifyCachedObjectByID(id[], object[])
- {
- if(CACHED_OBJECTS[id] == object)
- {
- return 1;
- }else{
- return 0;
- }
- }
- stock RemoveAllCache()
- {
- for(new i = 0; i < MAX_CACHED_OBJECTS; i++)
- {
- CACHED_OBJECTS[i] = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement