SHOW:
|
|
- or go back to the newest paste.
| 1 | #if defined ___vDBG_included___ | |
| 2 | #error ___vDBG_included___ ja esta definido! usando a include 2 vezes no mesmo script? | |
| 3 | #endif | |
| 4 | ||
| 5 | #define ___vDBG_included___ | |
| 6 | ||
| 7 | #if !defined _samp_included | |
| 8 | #include a_samp | |
| 9 | #endif | |
| 10 | ||
| 11 | - | #pragma library "vDebug" |
| 11 | + | #pragma library "plugin_vDebug" |
| 12 | ||
| 13 | #define CDebug::%0(%1) forward CDebug_%0(%1); \ | |
| 14 | public CDebug_%0(%1) | |
| 15 | ||
| 16 | #define cDebug->%0(%1) CDebug_%0(%1) | |
| 17 | ||
| 18 | #define FALSE 0 | |
| 19 | #define TRUE 1 | |
| 20 | ||
| 21 | native plugin_MarcarUltimaFuncao(const funcao[]); | |
| 22 | native plugin_LerUltimaFuncao(const str[]); | |
| 23 | ||
| 24 | enum eDebug | |
| 25 | {
| |
| 26 | DebugUF[64], | |
| 27 | } | |
| 28 | ||
| 29 | static vDebug[eDebug]; | |
| 30 | ||
| 31 | CDebug::MarcarUltimaFuncao(const vDebug_funcao[]) | |
| 32 | {
| |
| 33 | format(vDebug[DebugUF], 64, "\0"); | |
| 34 | ||
| 35 | #if defined vDBG_PrintTimeStamps | |
| 36 | ||
| 37 | static vDebug_hora, vDebug_minuto, vDebug_segundo, vDebug_ano, vDebug_mes, vDebug_dia; | |
| 38 | ||
| 39 | gettime(vDebug_hora, vDebug_minuto, vDebug_segundo); | |
| 40 | getdate(vDebug_ano, vDebug_mes, vDebug_dia); | |
| 41 | ||
| 42 | format(vDebug[DebugUF], 64, "[%i-%i-%i . %i/%i/%i] %s", | |
| 43 | vDebug_hora, vDebug_minuto, vDebug_segundo, vDebug_ano, | |
| 44 | vDebug_mes, vDebug_dia, vDebug_funcao); | |
| 45 | ||
| 46 | return plugin_MarcarUltimaFuncao(vDebug[DebugUF]); | |
| 47 | #else | |
| 48 | return plugin_MarcarUltimaFuncao(vDebug_funcao); | |
| 49 | ||
| 50 | #endif | |
| 51 | } | |
| 52 | ||
| 53 | CDebug::LerUltimaFuncao(const vDebug_str[]) | |
| 54 | return plugin_LerUltimaFuncao(vDebug_str); | |
| 55 | ||
| 56 | // Exemplo | |
| 57 | public OnFilterScriptInit() | |
| 58 | {
| |
| 59 | cDebug->MarcarUltimaFuncao("OnFilterScriptInit()");
| |
| 60 | static vDebug_ReadStr[64]; | |
| 61 | ||
| 62 | cDebug->LerUltimaFuncao(vDebug_ReadStr); | |
| 63 | ||
| 64 | printf("%s", vDebug_ReadStr);
| |
| 65 | return TRUE; | |
| 66 | } |