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. |
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 |
gamemode0 gm 1 filterscripts fs plugins PawnCMD |
#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;
}
#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 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 ) |
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
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 need to edit your "OnPlayerCommandPerformed".
PHP код:
|
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. |
CMD:kill(playerid, params[])
{
SetPlayerHealth(playerid, 0);
return 1;
}
CMD:logscreen(playerid, params[])
{
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;
}
CMD:serverstats(playerid, params[])
{
new string[128];
SCM(playerid, COL_WHITE, "|__________________________[SERVER STATS]__________________________|");
format(string, sizeof(string), "Streamer Loaded: Objects: ({3399FF}%d{FFFFFF}) | Pickups: ({3399FF}%d{FFFFFF}) | 3D Text Labels: ({3399FF}%d{FFFFFF})",
CountDynamicObjects(),CountDynamicPickups(), CountDynamic3DTextLabels());
SCM(playerid, COL_WHITE, string);
format(string, sizeof(string), "Player Stats: Logins: ({3399FF}%d{FFFFFF}) | Registered: ({3399FF}%d{FFFFFF}) | Connections: ({3399FF}%d{FFFFFF})",\
TotalLogin, TotalRegister, TotalConnect);
SCM(playerid, COL_WHITE, string);
format(string, sizeof(string), "Server Stats: Autobans: ({3399FF}%d{FFFFFF}) | Vehicles: ({3399FF}%d{FFFFFF}) ", TotalAutoBan, VehiclesLoaded);
SCM(playerid, COL_WHITE, string);
SCM(playerid, COL_WHITE, "|__________________________________________________________________|");
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if(result == -1)
{
print("Something");
return 0;
}
print("Something two");
return 1;
}
public OnPlayerCommandReceived( playerid, cmd[ ], params[ ], flags )
{
print("Something four");
return 0;
}
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".
|
Pawn.CMD was updated to version 3.1.2
- Fixed bug in scripts queue. |
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"..
|
[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
Код:
[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 |