SA-MP Forums Archive
Can't use command in FS - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can't use command in FS (/showthread.php?tid=374109)



Can't use command in FS - davve95 - 01.09.2012

Hi!

I made a command in SF and the command won't work it just says: Server unknown command..

Code:


pawn Код:
public OnFilterScriptInit()
{
    public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/test", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid,0);
        SendClientMessage(playerid,0xF00E69FF, "TEST");
        return 1;
    }
    return 0;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" ");
    print("----------------------------------\n");
}

#endif
Thanks!

Maybe I just forgot some easy thing! ^^...

Edit: And it works in a GM.


Re: Can't use command in FS - Dan. - 01.09.2012

You cant put that function under OnFilterScriptInit.. do it like this:
pawn Код:
public OnFilterScriptInit()
{
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" ");
    print("----------------------------------\n");
}

#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/test", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid,0);
        SendClientMessage(playerid,0xF00E69FF, "TEST");
        return 1;
    }
    return 0;
}
Weird that you have 2200+ posts and cant do this.


Re: Can't use command in FS - Admigo - 01.09.2012

Above^^


Re: Can't use command in FS - davve95 - 01.09.2012

Thanks!, I just remembered wrong then!..