Advertisement
ipsBruno

(Pawn) Include a_udtf.inc - Plugin

Jul 21st, 2012
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.53 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////////
  2.  
  3. // a_gvars.inc -> Por Bruno
  4. #if !defined varGet
  5. #define varGet(%0)      getproperty(0,%0)
  6. #endif
  7.  
  8. #if !defined varSet
  9. #define varSet(%0,%1) setproperty(0, %0, %1)
  10. #endif
  11.  
  12. // defina aqui o máximo de downloads que podem ser feitos
  13. #define MAX_DOWNLOADS 500
  14.  
  15. ///////////////////////////////////////////////////////////////////////////////
  16.  
  17. new szSiteDownload[MAX_DOWNLOADS][128];
  18. new szFileDownload[MAX_DOWNLOADS][064];
  19. new giDownloads;
  20.  
  21. native URLDownloadToFileInterno(site[], arquivo[]);
  22.  
  23. stock URLDownloadToFile(site[], arquivo[])
  24. {
  25.  
  26.     static strBuff[64];
  27.     format(strBuff, 64, "%s", arquivo);
  28.  
  29.     URLDownloadToFileInterno(site, strBuff);
  30.  
  31.     varSet(strBuff, SetTimerEx("gDown_CHKFile", 900, true, "i", giDownloads));
  32.  
  33.     format(szFileDownload[giDownloads], 64, arquivo);
  34.     format(szSiteDownload[giDownloads], 00128, site);
  35.  
  36.     giDownloads++;
  37.  
  38.     return true;
  39. }
  40.  
  41.  
  42. forward gDown_CHKFile(fileid);
  43. public gDown_CHKFile(fileid)
  44. {
  45.  
  46.     if(szFileDownload[fileid][0]) {
  47.  
  48.         static stmpHeCK[64];
  49.         format(stmpHeCK, 64, "%s_OX_", szFileDownload[fileid]);
  50.  
  51.         if(fexist(stmpHeCK)) {
  52.  
  53.             KillTimer(varGet(szFileDownload[fileid]));
  54.  
  55. // public OnURlDownloaded(site[], file[])
  56.             CallLocalFunction("OnURlDownloaded", "ss", szSiteDownload[fileid], szFileDownload[fileid]);
  57.  
  58.             fremove(stmpHeCK);
  59.  
  60.         }
  61.  
  62.     }
  63.     return true;
  64. }
  65.  
  66.  
  67. forward OnURlDownloaded(site[], arquivo[]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement