Advertisement
Guest User

vDebug - 0.1 teste

a guest
Sep 10th, 2012
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.44 KB | None | 0 0
  1. // by Victor
  2.  
  3. #include a_samp
  4.  
  5. #if defined ___vDBG_included___
  6.     #error ___vDBG_included___ ja esta definido! usando a include 2 vezes no mesmo script?
  7. #endif
  8.  
  9. #define ___vDBG_included___
  10.  
  11. #define CDebug::%0(%1)  forward %0(%1); \
  12.                         public %0(%1)
  13.                        
  14. #define cDebug->%0(%1)  %0(%1)
  15.  
  16. #define varCDebug   new
  17.  
  18. #define FALSE 0
  19. #define TRUE 1
  20.  
  21. enum eDebug
  22. {
  23.     DebugUF[64],
  24. }
  25.  
  26. varCDebug vDebug[eDebug];
  27.  
  28. CDebug::MarcarUltimaFuncao(vDebug_funcao[])
  29. {
  30.     if(strlen(vDebug_funcao) < 1) return FALSE;
  31.    
  32.     varCDebug vDebug_hora, vDebug_minuto, vDebug_segundo, vDebug_ano, vDebug_mes, vDebug_dia;
  33.  
  34.     gettime(vDebug_hora, vDebug_minuto, vDebug_segundo);
  35.     getdate(vDebug_ano, vDebug_mes, vDebug_dia);
  36.    
  37.     format(vDebug[DebugUF], 64, "[%i-%i-%i . %i/%i/%i] %s",
  38.                                 vDebug_hora, vDebug_minuto, vDebug_segundo, vDebug_ano,
  39.                                 vDebug_mes, vDebug_dia, vDebug_funcao);
  40.  
  41.     varCDebug File:arq = fopen("Debug/UF.txt", io_write);
  42.     if(!arq) return FALSE;
  43.    
  44.     fwrite(arq, vDebug[DebugUF]);
  45.     fclose(arq);
  46.    
  47.     return TRUE;
  48. }
  49.  
  50. CDebug::LerUltimaFuncao(vDebug_str[])
  51. {
  52.     varCDebug File:arq = fopen("Debug/UF.txt", io_read);
  53.     if(!arq) return FALSE;
  54.  
  55.     fread(arq, vDebug_str, 64);
  56.     fclose(arq);
  57.  
  58.     return TRUE;
  59. }
  60.  
  61. // Exemplo
  62. public OnFilterScriptInit()
  63. {
  64.     cDebug->MarcarUltimaFuncao("OnFilterScriptInit()");
  65.     varCDebug vDebug_ReadStr[64];
  66.  
  67.     cDebug->LerUltimaFuncao(vDebug_ReadStr);
  68.  
  69.     printf("%s", vDebug_ReadStr);
  70.     return TRUE;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement