Unknown command
#1

Hello,I have this problem for a while now,and my friend has it too. (Fresh server)
So,I made some simple commands on gamemode,but when i type it,server says: Unknown command.
This happends to every script.
I tried a to use zcmd,dcmd but same.

here is a sample:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/toltes", cmdtext, true, 10) == 0)
    {
        new string[MAX_PLAYER_NAME];
        GetPlayerName(playerid,string, sizeof(string));
        format(string,128, "%s йletet/armourt tцltцtt!",string);
        SendClientMessageToAll(COLOUR_VILAGOSKEK,string);
        SendClientMessage(playerid, COLOUR_VILAGOSKEK, "йletet/armourt tцltцtt!");
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        return 1;
    }
    if (strcmp("/rlogin", cmdtext, true, 10) == 0)
    {
        new string[MAX_PLAYER_NAME];
        GetPlayerName(playerid,string, sizeof(string));
        format(string,128, "%s belйpett az RCONba!",string);
        SendClientMessageToAll(COLOUR_VILAGOSKEK,string);
        SendClientMessage(playerid, COLOUR_VILAGOSKEK, "Belйptйl az RCONba!");
        SendRconCommand("rcon login kecskesajt");
        return 1;
    }
    if (strcmp("/w", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid,FEGYVER_DIALOG,DIALOG_STYLE_LIST,"Fegyver vбlasztбs","1. csomag\n2. csomag","Kivбlaszt","Mйgsem");
    }
    return 0;
}
As you can see,there is no problem with the script,still its an unknown command. Anyone got ideas?
Reply
#2

I am not pro, just a newbie.

Try removing the return 0 after the cmd
Reply
#3

- The lenghts are wrong.
- string was declared with size of 24 and in the format you used 128.
- SendRconCommand does not work with login.
- Change your RCON password because you posted it in public.

When you tried with ZCMD, do all the commands of that mode were in ZCMD? If more than 1 command processor (not that strcmp is one, but anyways..) are used, then some of the commands won't work.

Quote:
Originally Posted by MaxTheMapper
Посмотреть сообщение
I am not pro, just a newbie.

Try removing the return 0 after the cmd
It must return 0.
Reply
#4

Ok thx konstantinous for telling me this

Learned somthing from u
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
- The lenghts are wrong.
- string was declared with size of 24 and in the format you used 128.
- SendRconCommand does not work with login.
- Change your RCON password because you posted it in public.

When you tried with ZCMD, do all the commands of that mode were in ZCMD? If more than 1 command processor (not that strcmp is one, but anyways..) are used, then some of the commands won't work.



It must return 0.
This is a test server running on my local IP,so rcon wont be a problem.

All commands were in ZCMD.
The problem is,my server just wont do the commands.
A simple command
For an example:
pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/hp", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100);
        return 1;
    }
    return 0;
}
I play on a real server,and the commands work there.
So,can this be because I miss an inlude or plugin?
Reply
#6

Open pawno.exe, click on 'New' tab and remove everything. Paste this:
pawn Код:
#include < a_samp >
#include < zcmd >

main( ) { }

CMD:hp( playerid, params[ ] )
{
    SetPlayerHealth( playerid, 100 );
    SendClientMessage( playerid, -1, "Your health has been restored!" );
    return 1;
}
Save it with a name into gamemodes folder and replace the name in server.cfg

Run the server and go in-game. Do /hp, does it still show "SERVER: Unknown command." message?
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Open pawno.exe, click on 'New' tab and remove everything. Paste this:
pawn Код:
#include < a_samp >
#include < zcmd >

main( ) { }

CMD:hp( playerid, params[ ] )
{
    SetPlayerHealth( playerid, 100 );
    SendClientMessage( playerid, -1, "Your health has been restored!" );
    return 1;
}
Save it with a name into gamemodes folder and replace the name in server.cfg

Run the server and go in-game. Do /hp, does it still show "SERVER: Unknown command." message?
It works perfect now.,So should I write my scripts in zcmd?
Reply
#8

ZCMD or y_commands. Both are great.

Get rid of using strcmp to compare commands as soon as possible!
Reply
#9

Alright,thanks for the help!
Reply
#10

ZCMD and YCMD have the exact same syntax if I will be writing a small FS I'd likely use ZCMD otherwise it would be YCMD the reason being is larger projects at least when I make them are built in modular includes. That type of design approach means I'll likely be using y_hooks and possibly y_inline/y_dialogs so to keep consistent y_commands would be the chosen command processor.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)