RCON input via console - Only works when a filterscript is loaded
#1

So I've stumbled upon a problem I've never seen before.

What I'm trying to do is make some sort of command by RCON input, using OnRconCommand (Pretty obvious). This is my code, just to check if anything is actually happening.
PS: This is in my game mode.
pawn Код:
public OnRconCommand(cmd[])
{
    printf("GM");
    return 1;
}
When I type a random sentence, nothing happens!

Then I made a filter script, to check if something happens over there:
pawn Код:
public OnRconCommand(cmd[])
{
    printf("FS");
    return 1;
}
If I type a random sentence, it indeed outputs 'FS'. That leaves me wondering why it works in a filter script, but not in my game mode!

After screwing around a bit, I change this in the filter script:
pawn Код:
public OnRconCommand(cmd[])
{
    printf("FS);
    return 0; //Changed 'return 1' to 'return 0'
}
When I type a random sentence having this filter script loaded, and still having the other code in my game mode, it outputs both 'FS' and 'GM'! Why does it work now, but not before?

This is the log:
Код:
hi
loadfs testscript (Using 'return 1')
    Filterscript 'testscript.amx' loaded.
hi
FS
loadfs testscript (Using 'return 0')
    Filterscript 'testscript.amx' unloaded.
    Filterscript 'testscript.amx' loaded.
hi
FS
GM
Has anyone got any idea what could be causing this?

PS: I think this is pretty re-creatable, I easily managed to re-create it using bare.pwn.
Reply
#2

OnRconCommand
""Important Note: You will need to include this callback in a loaded filterscript for it to work in the gamemode!"

I also came across this problem around a year ago, and took some time before I saw that the callback needs to be in a loaded filterscript to work.
Reply
#3

Kinda overkill to need to load a filter script just to use one callback, but it'll have to do I guess. Would be nice to have this fixed though.
Reply
#4

Indeed it's a pity to have a filterscript loaded because of the simple thing that OnRconCommand won't work without. Back when I had problems with it, I only used a filterscript to get around this issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)