SA-MP Forums Archive
[HELP]Server: Unknown Command! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Server: Unknown Command! (/showthread.php?tid=227938)



[HELP]Server: Unknown Command! - Black_Sun1 - 18.02.2011

Hello, i have a BIG problem with my script! Every time when i enter a command, no matter which command it says SERVER: Unknown Command!
No commands are working
I set the return to 1 at the end of OnPlayerCommandText....
What now?

Thanks.


Re: [HELP]Server: Unknown Command! - Mean - 18.02.2011

Wtf, why have you set the return to 1? It MUST be 0.
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    cmds_here{}
    return 0; // OnPlayerCommandText MUST return 0.
}



Re: [HELP]Server: Unknown Command! - xRyder - 18.02.2011

Show us one of your commands.
'Could be what Mean said and maybe you returned your command as 'false'.


Re: [HELP]Server: Unknown Command! - Black_Sun1 - 18.02.2011

every command has to return something?


Re: [HELP]Server: Unknown Command! - xRyder - 18.02.2011

Has to return as true.


Re: [HELP]Server: Unknown Command! - Black_Sun1 - 18.02.2011

hmm, i set every single command to return 1 at the end, but still nothing


Re: [HELP]Server: Unknown Command! - xRyder - 18.02.2011

Quote:
Originally Posted by xRyder
Посмотреть сообщение
Show us one of your commands.
The message you have entered is too short. Please lengthen your message to at least 4 characters.


Re: [HELP]Server: Unknown Command! - Black_Sun1 - 18.02.2011

pawn Код:
if(strcmp(cmd, "/usedrugs", true) == 0) // Drug system
    {
        if(IsPlayerConnected(playerid))
        {
            if(UsingDrugs[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_NICERED,"You have to wait 5 seconds!");
                return 1;
            }
            else
            {
                if(PlayerInfo[playerid][pDrugs] >= 1)
                {
                    new Float:health
                    GetPlayerHealth(playerid, health)
                    if(health >= 95.0)
                    {
                        SetPlayerHealth(playerid, 100.0);
                    }
                    if(health == 100.0)
                    {
                        SendClientMessage(playerid,COLOR_NICERED,"Your health is already full!");
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid,COLOR_YELLOW,"You used 2 grams of drugs!");
                        SetPlayerHealth(playerid, health + 5.0);
                        PlayerInfo[playerid][pDrugs] -= 2;
                        UsingDrugs[playerid] = 1;
                        SetTimerEx("DrugEffectGone", 5000, false, "i", playerid);
                    }
                }
                else
                {
                    SendClientMessage(playerid,COLOR_NICERED,"You have no more drugs!");
                }
            }
        }
        return 1;
    }



Re: [HELP]Server: Unknown Command! - Markx - 18.02.2011

It MUST return 1; or return true, else you will get: Server: Unknown command.


Re: [HELP]Server: Unknown Command! - Serbish - 19.02.2011

Delete.