AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [INC] debug (https://forums.alliedmods.net/showthread.php?t=297725)

Craxor 05-22-2017 04:46

[INC] debug
 
1 Attachment(s)
Description With this inc file you have a functions to print debug messages, using a debug message you can extract data from server or you can solve problems, depends on your needs.

Credits

PRoSToTeM@
BlackRose
PartialClonning
ConnorMcLeod
Addonszzz
Emp'


Code example for testing...
PHP Code:

#include <amxmodx>
#include <debug>

public plugin_init()
{
    
debug_log(5"Plugin Init called" );

    
register_clcmd"test""ptest" );
}

public 
ptest(id)
{
    
debug_log(5"ptest(id) Called!" );

    if( 
is_user_alive(id) )
    {
        
debug_log(5"is_user_alive succesfully filtred!" );
        
// your code here.
    
}


Documentation Is inside of the file but if you have any question you can reply on this thread.

shehzad1234 05-22-2017 11:18

Re: debug.inc
 
Gj. :D

Craxor 05-22-2017 14:13

Re: debug.inc
 
Quote:

Originally Posted by shehzad1234 (Post 2522284)
Gj. :D

Thank you.

------

Code updated.

Craxor 05-23-2017 12:41

Re: debug.inc
 
Updateddddddddddddd!

PRoSToTeM@ 05-23-2017 13:54

Re: debug.inc
 
What is the purpose of caps in function names?

Craxor 05-23-2017 14:18

Re: debug.inc
 
What kind of Caps :?

OciXCrom 05-23-2017 14:45

Re: debug.inc
 
this is not caps
THIS IS CAPS

https://img.webnots.com/2014/03/Caps-Lock.png

EFFx 05-23-2017 14:54

Re: debug.inc
 
Maybe his choices or style. I don't see any issue with CAPS functions.

Also,

PHP Code:

stock bool:IS_DEBUG_ENABLED)
{
    if( 
)
    {
        return 
true;
    }
    return 
false;


What that stock is used for?

Craxor 05-23-2017 14:56

Re: debug.inc
 
aaa, yyes funny, is just a style as EFFX said.

Edit: about effx question, you can make a macro inside of plugin to check if debug is enabled, example:
PHP Code:

#define DEBUG 1 

And then use the function to check for debug before call debug_init or any debug stock:
PHP Code:

if( IS_DEBUG_ENABLEDDEBUG ) )
{
    
DEBUG_INIT();



PRoSToTeM@ 05-23-2017 16:52

Re: debug.inc
 
Code:
/* Don't use it ... it is for the DEBUG_LOG stock */ stock get_dbg_info( Format[], szString[], maxchars=0 )
Maybe make it static then?
And this too:
Code:
new const DBG_INFO[] = "[Map: %s, Time: %i:%i] %s";
You also should make it stock or move it inside get_dbg_info.


All times are GMT -4. The time now is 10:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.