Server: Unknown Command - How to solve this?
#1

I've been searching around, and have seen a lot of other people having the same problem, but they actually solve them. I'm not that good at scripting yet, haven't been doing it for long, but know my ways around I guess
The thing is, that some commands just return this "Unknown Command" shit. I figured it had to be the returns or something, so I checked through all the commands, and added "return 1;" on the commands that didn't have them, but after I did that, more and more commands stopped working. After testing commands for a while, all the commands just stop working.

Considering that I'm new to scripting, I chose to make a GF edit, mostly because I'm interested to learn more, and figured GF would be a good start.

I'm going to convert all the commands to ZCMD as well, but would that solve this problem perhaps?

I'm just looking for tips how to solve my problem, I can post all the commands, but as all of you probably know, there's a shitload of them, and it would take A LOT of time going through them all, so if you want to, just tell me.

Thanks in advance for any help at all.
Reply
#2

If you are using strcmp for the commands then make sure you don't have any other command processor included (e.g. zcmd) as they will (might) block the commands in the OnPlayerCommand function.
Reply
#3

Could you send us the part of your code that says unkown command? Or is it all of the commands?

And btw. GF Edits are a good way to start out. I basically taught myself how to script.
Reply
#4

I think so too actually, I know everyone hates them, but they're kind of fun to edit. I taught myself aswell.
Well, it starts with a few commands, and then after I've typed in 4-5 commands, they all just stop working.

pawn Код:
if(strcmp(cmd, "/update", true) == 0)
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        SaveAccounts();
        SendClientMessage(playerid, COLOR_YELLOW, "All player accounts were successfully updated.");
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "* You must be a level 2 admin to do this command.");
    }
    return 1;
}
This is one of the commands that fuck up.

pawn Код:
public SaveAccounts()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SavePlayerSQL(i);
            if(PlayerInfo[i][pJob] > 0)
            {
                if(PlayerInfo[i][pContractTime] < 25)
                {
                    PlayerInfo[i][pContractTime] ++;
                }
            }
        }
    }
    return 1;
}
Figured I should add this, as it was called in the command /update.
Reply
#5

Hm. I'm personally not that experienced with strcmp. You could possibly try switching to Zcmd, I'm sure that'll fix your problem.
Reply
#6

I guess I'll start doing that then! If anyone else has any tips, I would really appreciate if they wrote it here.
Reply
#7

Check if you have "return 0" anywhere in OnPlayerCommandText outside the commands (except for the Return 0; at the very bottom which must be there).
Reply
#8

This is why you shouldn't learn with GF. You only get bad habits.
Reply
#9

Quote:
Originally Posted by CookieJar
Посмотреть сообщение
This is why you shouldn't learn with GF. You only get bad habits.
I agree with you there. If you would like to learn pawn I suggest you start by making your own Gamemode and not by editing other people's. Start by creating a stunt/deathmatch game mode. They are really fun and easy to make and yet you can learn a lot from it. Make tests, experiment with new stuff until you get it. That's how I started and I learned a lot in such a short time.
Reply
#10

Still, I want to try to fix this. It's really getting on my nerves. What can the problem be?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)