SA-MP Forums Archive
SERVER: Unknown Command but the Command works - 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: SERVER: Unknown Command but the Command works (/showthread.php?tid=241956)



SERVER: Unknown Command but the Command works - anantanni - 19.03.2011

See
so i'm scripting an rp server, and it has basic commands etc.
/b works fine.. i have features of it to day like if someone is on admin duty or tester duty
but on problem. When someone is not on testerduty or admin duty, its OK. but when someone is, it says SERVER: Unknown Command. BUT it still shows the message, i mean it shows what you type
anyway here is the pawn code
pawn Код:
if(strcmp(cmd, "/b", true) == 0)//local ooc
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            if(Mute[playerid] == 1)
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't speak, you have been silenced !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            GiveNameSpace(sendername);
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
                return 1;
            }
            if(AdminDuty[playerid] == 1)
            {
                format(string, sizeof(string), "(( [Admin Duty] %s says: %s ))", sendername, result);
                ProxDetector(20.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                return 0;
            }
            else if(TesterDuty[playerid] == 1)
            {
                format(string, sizeof(string), "(( [Tester Duty] %s says: %s ))", sendername, result);
                ProxDetector(20.0, playerid, string,0x990000FF,0x990000FF,0x990000FF,0x990000FF,0x990000FF);
                return 0;
            }
            if(PlayerInfo[playerid][pMaskUse] == 1)
            {
                format(string, sizeof(string), "(( Stranger_%d Says: %s ))", RandMask[playerid],result);
            }
            else
            {
                format(string, sizeof(string), "(( [%i] %s Says: %s ))", playerid, sendername, result);
            }
            if(PlayerInfo[playerid][pAdmin] == 0)
            {
                SendBMessage(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            }
            else
            {
                ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            }
        }
        return 1;
    }



Re: SERVER: Unknown Command but the Command works - anantanni - 19.03.2011

sorry but i need answer asap.. please answer server owners is waiting :P


Re: SERVER: Unknown Command but the Command works - austin070 - 19.03.2011

Try taking out all of the returns except the last one.


Re: SERVER: Unknown Command but the Command works - anantanni - 19.03.2011

Already tried. It makes you show all of them ie stranger, admin duty, normal, tester duty....


Re: SERVER: Unknown Command but the Command works - antonio112 - 19.03.2011

Delete the return 0; from your AdminDuty & TesterDuty:

pawn Код:
if(AdminDuty[playerid] == 1)
            {
                format(string, sizeof(string), "(( [Admin Duty] %s says: %s ))", sendername, result);
                ProxDetector(20.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
            }
            else if(TesterDuty[playerid] == 1)
            {
                format(string, sizeof(string), "(( [Tester Duty] %s says: %s ))", sendername, result);
                ProxDetector(20.0, playerid, string,0x990000FF,0x990000FF,0x990000FF,0x990000FF,0x990000FF);
            }



Re: SERVER: Unknown Command but the Command works - Roomeo - 19.03.2011

pawn Код:
if(strcmp(cmd, "/b", true) == 0)//local ooc
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            if(Mute[playerid] == 1)
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't speak, you have been silenced !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            GiveNameSpace(sendername);
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
                return 1;
            }
            if(AdminDuty[playerid] == 1)
            {
                format(string, sizeof(string), "(( [Admin Duty] %s says: %s ))", sendername, result);
                ProxDetector(20.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                return 1;
            }
            else if(TesterDuty[playerid] == 1)
            {
                format(string, sizeof(string), "(( [Tester Duty] %s says: %s ))", sendername, result);
                ProxDetector(20.0, playerid, string,0x990000FF,0x990000FF,0x990000FF,0x990000FF,0x990000FF);
                return 1;
            }
            if(PlayerInfo[playerid][pMaskUse] == 1)
            {
                format(string, sizeof(string), "(( Stranger_%d Says: %s ))", RandMask[playerid],result);
            }
            else
            {
                format(string, sizeof(string), "(( [%i] %s Says: %s ))", playerid, sendername, result);
            }
            if(PlayerInfo[playerid][pAdmin] == 0)
            {
                SendBMessage(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            }
            else
            {
                ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            }
        }
        return 1;
    }



Re: SERVER: Unknown Command but the Command works - anantanni - 19.03.2011

@all http://i55.tinypic.com/1y79qq.png


Re: SERVER: Unknown Command but the Command works - Roomeo - 19.03.2011

What's the Problem Now?


Re: SERVER: Unknown Command but the Command works - anantanni - 19.03.2011

Just see the image, when i go on tester duty and type /b it shows the testerduty phrase and the normal phrase TOO.


Re: SERVER: Unknown Command but the Command works - anantanni - 19.03.2011

Anyone.. please..