Advertisement
RaFaeLs

## SA:MP RaFaeL's file plugin ##

Jan 28th, 2013
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.21 KB | None | 0 0
  1. /*
  2.  *                              rl_files 0.1.2
  3.  *        All right reserved! © By: RaFaeL
  4.  *
  5.  * Owner                : RaFaeL
  6.  * Time                 : 28.01.2013
  7.  *
  8.  * Thanks to:
  9.  *                      RaFaeL                           - Scripting, PAWN
  10.  *                      SA:MP Team past, present, future - SA:MP.
  11.  *
  12.  *
  13.  * Functions:
  14.  *          fcheck(dir[], idx) - Check if file exist by idx
  15.  *          fnum(dir[]) - Return how much files in dir
  16.  *          fname(dir[], idx, name[], len = sizeof(name)) - Return the file name by idx
  17.  *          fprint(dir[]) - Print all files in dir
  18.  *
  19.  * CallBacks:
  20.  *          None.
  21.  *
  22.  * Update:
  23.  *      28.01.2013:
  24.  *          Other:              - First Release
  25.  *                              - Bug fixed
  26.  *
  27.  */
  28.  
  29. #define RL_FILE_TYPE     32768
  30. #define MAX_FILE_NAME    64
  31. #define NULL_DIR         "."
  32.  
  33. native fname(dir[], idx, name[], len = sizeof(name));
  34. native fnum(dir[]);
  35.  
  36. stock fprint(dir[]) {
  37.     new
  38.         idx,
  39.         file[MAX_FILE_NAME];
  40.     while(idx < fnum(dir)) {
  41.         fname(dir, idx, file);
  42.         printf("%s/%s", dir, file);
  43.         idx++;
  44.     }
  45.     return 1;
  46. }
  47.  
  48. stock fcheck(dir[], idx) {
  49.     new
  50.         file[MAX_FILE_NAME];
  51.     if(!fname(dir, idx, file))
  52.         return 0;
  53.     return 1;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement