[Plugin] Pawn.CMD

@IstuntmanI, @BR3TT, I need a full .log-file.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
@IstuntmanI, @BR3TT, I need a full .log-file.
Sent a PM, hope it helps in any way.
Reply

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
When I load the filterscript from server.cfg, no gamemode command is working, only commands from that filterscript.

I return 1 in both callbacks in both gamemode and filterscripts.
Show me your code in both gamemode and filterscripts.
Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
Also, this is what crashdetect prints when I load again that filterscript, after it was unloaded:

Код:
[debug] Run time error 19: "File or function is not found"
[debug] PC_Init
I checked today, all fine.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Show me your code in both gamemode and filterscripts.
I produced a small test case:
- server.cfg:
Quote:

gamemode0 gm 1
filterscripts fs
plugins PawnCMD

(I renamed the .dll)

- gm.pwn:
pawn Код:
#include <a_samp>
#include <pawncmd> // the include too

main( )
{

}

public OnPlayerCommandReceived( playerid, cmd[ ], params[ ], flags )
{
    printf( "GM - OnPlayerCommandReceived( %d, '%s', '%s', %d )", playerid, cmd, params, flags );
    return 1;
}

public OnPlayerCommandPerformed( playerid, cmd[ ], params[ ], result, flags )
{
    printf( "GM - OnPlayerCommandPerformed( %d, '%s', '%s', %d, %d )", playerid, cmd, params, result, flags );
    return 1;
}

CMD:gm( playerid, params[ ] )
{
    SendClientMessage( playerid, -1, "GM - Hello, it's me..." );
    return 1;
}
- fs.pwn:
pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#include <pawncmd>

public OnPlayerCommandReceived( playerid, cmd[ ], params[ ], flags )
{
    printf( "FS - OnPlayerCommandReceived( %d, '%s', '%s', %d )", playerid, cmd, params, flags );
    return 1;
}

public OnPlayerCommandPerformed( playerid, cmd[ ], params[ ], result, flags )
{
    printf( "FS - OnPlayerCommandPerformed( %d, '%s', '%s', %d, %d )", playerid, cmd, params, result, flags );
    return 1;
}

CMD:fs( playerid, params[ ] )
{
    SendClientMessage( playerid, -1, "FS - Hello, it's me..." );
    return 1;
}
- server_log.txt
Quote:

Server Plugins
--------------
Loading plugin: PawnCMD
Pawn.CMD plugin v3.1 by urShadow loaded
Loaded.
Loaded 1 plugins.

[..]

/test (failed, of course, just tested):
FS - OnPlayerCommandReceived( 0, 'test', '', 0 )
FS - OnPlayerCommandPerformed( 0, 'test', '', -1, 0 )


/gm (failed and executes the FS callbacks):
FS - OnPlayerCommandReceived( 0, 'gm', '', 0 )
FS - OnPlayerCommandPerformed( 0, 'gm', '', -1, 0 )


/fs (everything went ok):
FS - OnPlayerCommandReceived( 0, 'fs', '', 0 )
FS - OnPlayerCommandPerformed( 0, 'fs', '', 1, 0 )

(EDIT: I see that with this test case after "reloadfs fs" I don't get any error from crashdetect, if I load it too)
Reply

You need to edit your "OnPlayerCommandPerformed".
PHP код:
public OnPlayerCommandPerformed(playeridcmd[], params[], resultflags

    if(
result == -1// if the command not found in this script
    
{        
        return 
0// go to the next script
    

    return 
1// all right, break the cycle, do not go to the next script

Reply

Not sure what I did wrong, but my commands are using different commands.
For instance, If I type /kill it does /logscreen
And If I type /serverstats it does /sethp

I have no clue why it's doing it.
My commands were working fine until I went wrong somewhere.
I can private message you my gamemode if need be.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
You need to edit your "OnPlayerCommandPerformed".
PHP код:
public OnPlayerCommandPerformed(playeridcmd[], params[], resultflags

    if(
result == -1// if the command not found in this script
    
{        
        return 
0// go to the next script
    

    return 
1// all right, break the cycle, do not go to the next script

You were right, thanks. I also thought that it may be from the returns, but I didn't have idea how to put those returns to be fine.

When a FS is loaded from server.cfg, first the callbacks from that FS are called, then the ones from GM, which is fine, BUT: when I use "loadfs fs" (didn't load it with server.cfg) the first callbacks called are the ones from GM (so I receive an invalid command error first), then the ones from FS. The callbacks order should be the same when I "loadfs" or "reloadfs".

Also, you should make a wiki in which you explain every functions/callbacks returns, callbacks calls and parameters. I had to test few functions because they weren't documented.
Reply

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
When a FS is loaded from server.cfg, first the callbacks from that FS are called, then the ones from GM, which is fine, BUT: when I use "loadfs fs" (didn't load it with server.cfg) the first callbacks called are the ones from GM (so I receive an invalid command error first), then the ones from FS. The callbacks order should be the same when I "loadfs" or "reloadfs".
They are called in the order their callbacks were added. That's how all functions are called, even native ones. When starting the server, the FS callbacks from server.cfg are added then the game mode's. Thus they will be called in that order consecutively.

The same applies to changemode and gmx.

This is how it has always been. That's why you must return 0 in OnPlayerCommandText for non existent commands and in other callbacks that can be used in multiple scripts.
Reply

Quote:
Originally Posted by Crayder
Посмотреть сообщение
They are called in the order their callbacks were added. That's how all functions are called, even native ones. When starting the server, the FS callbacks from server.cfg are added then the game mode's. Thus they will be called in that order consecutively.

The same applies to changemode and gmx.

This is how it has always been. That's why you must return 0 in OnPlayerCommandText for non existent commands and in other callbacks that can be used in multiple scripts.
I didn't think about this. I completely forgot about it.

About the wiki, I hope you will start creating it, if you don't have enough time you may create a few examples and we could follow your example and document other things as well (I would like to help with it, when I have time).

I can't believe how much my OnPlayerCommandReceived/Performed callbacks execution times were improved by this plugin, and also the code got much more simplified (I can add aliases and flags with custom permissions really fast and efficient). This is great and also offers way more possibilities than pawn proccesors. Thanks for this awesome release ! I wish I could rep you again, haha.
Reply

When I type /serverstats it calls /sethp
And when I type /dropgun it calls /kill
And /kill calls /skill

They are all in different parts of the script, at different distances between commands.
However, what would cause this to happen?

I have way to many commands to list them all, so I'm looking for some general causes for this particular situation.

I am not using any alias either.
No commands are redirected to anther command. (I.E /sethealth and /sethp)
I deleted all alias in my script to see if that was the culprit with no result.

PHP код:
CMD:kill(playeridparams[])
{
    
SetPlayerHealth(playerid0);
    return 
1;

PHP код:
CMD:logscreen(playeridparams[])
{
    switch(
P_Info[playerid][LogScreen])
    {
        case 
0:
        {
            
P_Info[playerid][LogScreen] = 1;
            
SendClientMessage(playerid, -1" >> Login screen enabled ");
        }
        case 
1:
        {
            
P_Info[playerid][LogScreen] = 0;
            
SendClientMessage(playerid, -1" >> Login screen disabled ");
        }
        default:
        {
            
P_Info[playerid][LogScreen] = 0;
            
SendClientMessage(playerid, -1" >> Login screen disabled ");
        }
    }
    return 
1;

PHP код:
CMD:serverstats(playeridparams[])
{
    new 
string[128];
    
SCM(playeridCOL_WHITE"|__________________________[SERVER STATS]__________________________|");
    
format(stringsizeof(string), "Streamer Loaded: Objects: ({3399FF}%d{FFFFFF}) | Pickups: ({3399FF}%d{FFFFFF}) | 3D Text Labels: ({3399FF}%d{FFFFFF})",
    
CountDynamicObjects(),CountDynamicPickups(), CountDynamic3DTextLabels());
       
SCM(playeridCOL_WHITEstring);
    
format(stringsizeof(string), "Player Stats: Logins: ({3399FF}%d{FFFFFF}) | Registered: ({3399FF}%d{FFFFFF}) | Connections: ({3399FF}%d{FFFFFF})",\
    
TotalLoginTotalRegisterTotalConnect);
    
SCM(playeridCOL_WHITEstring);
    
format(stringsizeof(string), "Server Stats: Autobans: ({3399FF}%d{FFFFFF}) | Vehicles: ({3399FF}%d{FFFFFF}) "TotalAutoBanVehiclesLoaded);
    
SCM(playeridCOL_WHITEstring);
    
SCM(playeridCOL_WHITE"|__________________________________________________________________|");
    return 
1;

Findings:
When I add this; No commands work at all:
PHP код:
public OnPlayerCommandPerformed(playeridcmd[], params[], resultflags)
{
    if(
result == -1)
    {
        print(
"Something");
        return 
0;
    }
    print(
"Something two");
    return 
1;
}
public 
OnPlayerCommandReceivedplayeridcmd[ ], params[ ], flags )
{
    print(
"Something four");
    return 
0;

However, when removed Commands work, but call the wrong command.
I.E
/dropgun calls /kick Command.
Reply

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
When a FS is loaded from server.cfg, first the callbacks from that FS are called, then the ones from GM, which is fine, BUT: when I use "loadfs fs" (didn't load it with server.cfg) the first callbacks called are the ones from GM (so I receive an invalid command error first), then the ones from FS. The callbacks order should be the same when I "loadfs" or "reloadfs".
Ok, i will solve this problem.
Reply

Pawn.CMD was updated to version 3.1.2

- Fixed bug in scripts queue.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Ok, i will solve this problem.
Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Pawn.CMD was updated to version 3.1.2

- Fixed bug in scripts queue.
Like I said though, it wasn't really a problem. The only way I'd change it myself would be to force gamemodes to be checked first (which I think is what you did with is_gamemode).
Reply

What about adding the ability to make commands work only for a certain "group"? Everything within the command for sure, without adding the default "checks"..
Reply

Quote:
Originally Posted by JustMe.77
Посмотреть сообщение
What about adding the ability to make commands work only for a certain "group"? Everything within the command for sure, without adding the default "checks"..
Flags...
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Flags...
Didn't see, sorry xD
Reply

Quote:
Originally Posted by Sebo.
Посмотреть сообщение
I must update to your plugin?
No, you must update your regular expression. (string)
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
No, you must update your regular expression. (string)
Thanks! It helped!
Reply

Код:
[17:14:44] [debug] Server crashed while executing gm.amx
[17:14:44] [debug] AMX backtrace:
[17:14:44] [debug] #0 native mysql_connect () from mysql.so
[17:14:44] [debug] #1 000bdae4 in public SSCANF_OnGameModeInit () from gm.amx
[17:14:44] [debug] #2 000026e4 in public Itter_OnGameModeInit () from gm.amx
[17:14:44] [debug] #3 native CallLocalFunction () from samp03svr
[17:14:44] [debug] #4 000019b4 in public ScriptInit_OnGameModeInit () from gm.amx
[17:14:44] [debug] #5 000011c0 in public PZone_OnGameModeInit () from gm.amx
[17:14:44] [debug] #6 native CallLocalFunction () from samp03svr
[17:14:44] [debug] #7 00000c7c in public OnGameModeInit () from gm.amx
[17:14:44] [debug] Native backtrace:
[17:14:44] [debug] #0 f65abe8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[17:14:44] [debug] #1 f65a4bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[17:14:44] [debug] #2 f65a5dbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[17:14:44] [debug] #3 f65a6226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[17:14:44] [debug] #4 f65abadc in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #5 f7720410 in ?? ()
[17:14:44] [debug] #6 f7720430 in ?? ()
[17:14:44] [debug] #7 f747ea81 in gsignal () from /lib32/libc.so.6
[17:14:44] [debug] #8 f7481eb2 in abort () from /lib32/libc.so.6
[17:14:44] [debug] #9 f76bb8af in _ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #10 f76b97e5 in ?? () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #11 f76b9822 in ?? () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #12 f76b9961 in ?? () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #13 f725792f in _ZN5boost15throw_exceptionINS_21thread_resource_errorEEEvRKT_ () from plugins/mysql.so
[17:14:44] [debug] #14 f725daf1 in _ZN5boost6threadC1INS_3_bi6bind_tIvNS_4_mfi3mf0Iv16CMySQLConnectionEENS2_5list1INS2_5valueIPS6_EEEEEEEEOT_ () from plugins/mysql.so
[17:14:44] [debug] #15 f72595fc in _ZN16CMySQLConnectionC1ERSsS0_S0_S0_jbb () from plugins/mysql.so
[17:14:44] [debug] #16 f7259750 in _ZN16CMySQLConnection6CreateERSsS0_S0_S0_jbb () from plugins/mysql.so
[17:14:44] [debug] #17 f72600e6 in _ZN12CMySQLHandle6CreateESsSsSsSsjjb () from plugins/mysql.so
[17:14:44] [debug] #18 f7274171 in _ZN6Native13mysql_connectEP6tagAMXPi () from plugins/mysql.so
[17:14:44] [debug] #19 080950e4 in ?? () from samp03svr
[17:14:44] [debug] #20 f65a794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[17:14:44] [debug] #21 f65aa8f8 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #22 f65ae916 in amx_Exec () from plugins/crashdetect.so
[17:14:44] [debug] #23 f65a6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[17:14:44] [debug] #24 f65aa659 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #25 f65172ea in ?? () from plugins/streamer.so
[17:14:44] [debug] #26 080dfd62 in ?? () from samp03svr
[17:14:44] [debug] #27 080950e4 in ?? () from samp03svr
[17:14:44] [debug] #28 f65a794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[17:14:44] [debug] #29 f65aa8f8 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #30 f65ae916 in amx_Exec () from plugins/crashdetect.so
[17:14:44] [debug] #31 f65a6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[17:14:44] [debug] #32 f65aa659 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #33 f65172ea in ?? () from plugins/streamer.so
[17:14:44] [debug] #34 080dfd62 in ?? () from samp03svr
[17:14:44] [debug] #35 080950e4 in ?? () from samp03svr
[17:14:44] [debug] #36 f65a794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[17:14:44] [debug] #37 f65aa8f8 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #38 f65ae916 in amx_Exec () from plugins/crashdetect.so
[17:14:44] [debug] #39 f65a6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[17:14:44] [debug] #40 f65aa659 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #41 f65172ea in ?? () from plugins/streamer.so
[17:14:44] [debug] #42 080a503b in ?? () from samp03svr
[17:14:44] [debug] #43 080ab922 in ?? () from samp03svr
[17:14:44] [debug] #44 080aa0fd in ?? () from samp03svr
[17:14:44] [debug] #45 f746ac16 in __libc_start_main () from /lib32/libc.so.6
[17:14:44] [debug] #46 0804b4e1 in ?? () from samp03svr
just replacing.
Reply

Quote:
Originally Posted by Donboo
Посмотреть сообщение
Код:
[17:14:44] [debug] Server crashed while executing gm.amx
[17:14:44] [debug] AMX backtrace:
[17:14:44] [debug] #0 native mysql_connect () from mysql.so
[17:14:44] [debug] #1 000bdae4 in public SSCANF_OnGameModeInit () from gm.amx
[17:14:44] [debug] #2 000026e4 in public Itter_OnGameModeInit () from gm.amx
[17:14:44] [debug] #3 native CallLocalFunction () from samp03svr
[17:14:44] [debug] #4 000019b4 in public ScriptInit_OnGameModeInit () from gm.amx
[17:14:44] [debug] #5 000011c0 in public PZone_OnGameModeInit () from gm.amx
[17:14:44] [debug] #6 native CallLocalFunction () from samp03svr
[17:14:44] [debug] #7 00000c7c in public OnGameModeInit () from gm.amx
[17:14:44] [debug] Native backtrace:
[17:14:44] [debug] #0 f65abe8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[17:14:44] [debug] #1 f65a4bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[17:14:44] [debug] #2 f65a5dbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[17:14:44] [debug] #3 f65a6226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[17:14:44] [debug] #4 f65abadc in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #5 f7720410 in ?? ()
[17:14:44] [debug] #6 f7720430 in ?? ()
[17:14:44] [debug] #7 f747ea81 in gsignal () from /lib32/libc.so.6
[17:14:44] [debug] #8 f7481eb2 in abort () from /lib32/libc.so.6
[17:14:44] [debug] #9 f76bb8af in _ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #10 f76b97e5 in ?? () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #11 f76b9822 in ?? () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #12 f76b9961 in ?? () from /usr/lib32/libstdc++.so.6
[17:14:44] [debug] #13 f725792f in _ZN5boost15throw_exceptionINS_21thread_resource_errorEEEvRKT_ () from plugins/mysql.so
[17:14:44] [debug] #14 f725daf1 in _ZN5boost6threadC1INS_3_bi6bind_tIvNS_4_mfi3mf0Iv16CMySQLConnectionEENS2_5list1INS2_5valueIPS6_EEEEEEEEOT_ () from plugins/mysql.so
[17:14:44] [debug] #15 f72595fc in _ZN16CMySQLConnectionC1ERSsS0_S0_S0_jbb () from plugins/mysql.so
[17:14:44] [debug] #16 f7259750 in _ZN16CMySQLConnection6CreateERSsS0_S0_S0_jbb () from plugins/mysql.so
[17:14:44] [debug] #17 f72600e6 in _ZN12CMySQLHandle6CreateESsSsSsSsjjb () from plugins/mysql.so
[17:14:44] [debug] #18 f7274171 in _ZN6Native13mysql_connectEP6tagAMXPi () from plugins/mysql.so
[17:14:44] [debug] #19 080950e4 in ?? () from samp03svr
[17:14:44] [debug] #20 f65a794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[17:14:44] [debug] #21 f65aa8f8 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #22 f65ae916 in amx_Exec () from plugins/crashdetect.so
[17:14:44] [debug] #23 f65a6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[17:14:44] [debug] #24 f65aa659 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #25 f65172ea in ?? () from plugins/streamer.so
[17:14:44] [debug] #26 080dfd62 in ?? () from samp03svr
[17:14:44] [debug] #27 080950e4 in ?? () from samp03svr
[17:14:44] [debug] #28 f65a794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[17:14:44] [debug] #29 f65aa8f8 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #30 f65ae916 in amx_Exec () from plugins/crashdetect.so
[17:14:44] [debug] #31 f65a6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[17:14:44] [debug] #32 f65aa659 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #33 f65172ea in ?? () from plugins/streamer.so
[17:14:44] [debug] #34 080dfd62 in ?? () from samp03svr
[17:14:44] [debug] #35 080950e4 in ?? () from samp03svr
[17:14:44] [debug] #36 f65a794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[17:14:44] [debug] #37 f65aa8f8 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #38 f65ae916 in amx_Exec () from plugins/crashdetect.so
[17:14:44] [debug] #39 f65a6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[17:14:44] [debug] #40 f65aa659 in ?? () from plugins/crashdetect.so
[17:14:44] [debug] #41 f65172ea in ?? () from plugins/streamer.so
[17:14:44] [debug] #42 080a503b in ?? () from samp03svr
[17:14:44] [debug] #43 080ab922 in ?? () from samp03svr
[17:14:44] [debug] #44 080aa0fd in ?? () from samp03svr
[17:14:44] [debug] #45 f746ac16 in __libc_start_main () from /lib32/libc.so.6
[17:14:44] [debug] #46 0804b4e1 in ?? () from samp03svr
just replacing.
Show me full .log file, string "plugins" (server.cfg) and your code.
Reply


Forum Jump:


Users browsing this thread: 21 Guest(s)