SA-MP Forums Archive
DCMD command "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)
+--- Thread: DCMD command "Server unknown command" (/showthread.php?tid=322333)



DCMD command "Server unknown command" - Naxix - 01.03.2012

Hi, i have problem with a command, which keeps returning "Server: Unknown command" and i can't seem to find out why it does so.

pawn Код:
dcmd_setteam(playerid, params[])
    {
        new pid,team;
        if(sscanf(params,"ui",pid,team)) return SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: /setteam [playerid][team]");
        if(logged[pid] == 0) return SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: That player is not online.");
        if(team < 0 || team > 2) return SendClientMessage(playerid,COLOR_RED,"[SYSTEM]: Team has to be Civil (0), team1 (1) or team2 (2)");
        else{
            new str[128], name[MAX_PLAYER_NAME],nTeam[40];
            GetPlayerName(pid,name,sizeof(name));
            switch(team){
            case 0: nTeam = "Civils";
            case 1: nTeam = "Team1";
            case 2: nTeam = "Team2";
            }
                format(str,sizeof(str),"%s has joined %s!",name,nTeam);
                SendClientMessageToAll(COLOR_GREEN,str);
                PlayerInfo[pid][pTeam] = team;
                return 1;
            }
        }
I'm not sure if your allowed to use switches in commands, but i did try make it "if's", and it had the same problem, so i don't think that's whats wrong.

EDIT: Forgot to mention, if i put none or 1 parameters, it will write the "SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: /setteam [playerid][team]");" message, but if i write both parameters it says Server: Unknown command.

EDIT2: Fixed, changed param "u" to "i".


Re: DCMD command "Server unknown command" - [MG]Dimi - 01.03.2012

you have dcmd(setteam,7,cmdtext); under OnPlayerCommandText?