SA-MP Forums Archive
Command Problem... server returns only "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: Command Problem... server returns only "unknown command" (/showthread.php?tid=481985)



Command Problem... server returns only "unknown command" - Anak - 18.12.2013

Hello, In my GM i have many commands.. all work perfect but when today when i scripted /infect command .. when INGAME i use it ... server only returns... SERVER ERROR: UNKOWN COMMAND.... while if in my server i type wrong command .. i get custom error message...

so problem is that .. my command is not working...
here are codes..
Processor: DCMD

pawn Код:
dcmd_infect(playerid, params[])
{
    #pragma unused params
    new nPlayer = GetClosestPlayer(playerid);
    if(blockedrape == 1) return SCM(playerid, COLOR_RED, "/Rape is blocked by admin");
    //if(RestrictCMD == 1) return  SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command reason:[DISABLED]");
    if(spawned[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command While Dead.");
    if(IsPlayerInAnyVehicle(playerid)) return  SendClientMessage(playerid,COLOR_RED,"You Cannot Use This Command While In A Vehicle.");
    if(spawned[nPlayer] == 0) return SendClientMessage(playerid, COLOR_RED, "You Cannot Rape A Dead Body.");
    //if(OnDuty[nPlayer] == 1) return SendClientMessage(playerid, COLOR_RED, "You cannot use this command on an admin on duty");
    //if(IsInChallenge[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You cannot rape in a challenge. You can take drugs and use /ad.");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"Error: You cannot use this command in a vehicle.");
    //if(IsSpecing[nPlayer] == 1) return SendClientMessage(playerid, COLOR_RED, "Nobody close enough to rape.");
    //if(duel[nPlayer] == 1) return SendClientMessage(playerid, COLOR_RED, "you cannot rape in duel area");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    if(rape[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"Error: Please wait before raping again.");

    if(IsPlayerInRangeOfPoint(nPlayer,6.0,x,y,z))
    {
        if(aduty[nPlayer] == 1) return SCM(playerid, COLOR_RED,"You can't use this command on onduty admin.");
        //if(pInfo[nPlayer][Adminlevel] > 1) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
        if(IsPlayerInAnyVehicle(nPlayer)) return SendClientMessage(playerid,COLOR_RED,"Error: The nearest player is in a vehicle.");
        rape[playerid] =1;
        RapeRecent1[playerid] = SetTimerEx("RapeRecent",10*1000,0,"i",playerid);

        switch(random(10))
        {
            case 0, 5, 6, 7, 8, 9:
            {
                GameTextForPlayer(playerid,"Raping Failed",4500,3);
                new string[128];
                format(string,sizeof(string),"%s Has attempted to rape you.",PlayerName(playerid));
                SendClientMessage(nPlayer,COLOR_RED,string);
                //SetPVarInt(playerid, "CanRape", 0);
                //RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",40000,0,"i",playerid);
            }
            case 1:
            {
                new string[128], str[128];
                new Float:myhealth, Float:he;
                GetPlayerHealth(nPlayer,myhealth);
                SetPlayerHealth(nPlayer,myhealth-float(random(40)));
                GetPlayerHealth(nPlayer, he);
                format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
                if(he <= 0.0) SendClientMessageToAll(COLOR_RED, str);
                new Float:x1, Float:y1, Float:z1;
                GetPlayerPos(nPlayer,x1,y1,z1);
                SetPlayerPos(nPlayer,x1,y1,z1+1);
                format(string,sizeof(string),"%s Has raped you.",PlayerName(playerid));
                SendClientMessage(nPlayer,0x00FFFFC8,string);
                format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
                SendClientMessage(playerid,0x00FFFFC8,string);
                format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
                GameTextForPlayer(playerid,string,5000,3);
                format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
                GameTextForPlayer(nPlayer,string,5000,3);
                SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
                //SetPVarInt(playerid, "CanRape", 0);
                ///RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",1000*40,0,"i",playerid);
            }
            case 2:
            {
                new string[128], str[128];
                new Float:myhealth, Float:he;
                GetPlayerHealth(nPlayer,myhealth);
                SetPlayerHealth(nPlayer,myhealth-float(random(30)));
                GetPlayerHealth(nPlayer, he);
                format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
                if(he <= 0.0) SendClientMessageToAll(COLOR_MAROON, str);
                new Float:x1, Float:y1, Float:z1;
                GetPlayerPos(nPlayer,x1,y1,z1);
                SetPlayerPos(nPlayer,x1,y1,z1+1);
                format(string,sizeof(string),"%s has raped you.",PlayerName(playerid));
                SendClientMessage(nPlayer,0x00FFFFC8,string);
                format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
                SendClientMessage(playerid,0x00FFFFC8,string);
                format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
                GameTextForPlayer(playerid,string,5000,3);
                format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
                GameTextForPlayer(nPlayer,string,5000,3);
                SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
                //SetPVarInt(playerid, "CanRape", 0);
                //RapeAgain[playerid] = SetTimerEx("ActivePlayerRape",1000*40,0,"i",playerid);
            }
            case 3, 4:
            {
                new string[128], str[128];
                new Float:myhealth, Float:he;
                GetPlayerHealth(nPlayer,myhealth);
                SetPlayerHealth(nPlayer,myhealth-float(random(20)));
                GetPlayerHealth(nPlayer, he);
                format(str, sizeof str, "%s has been raped to death by %s.", PlayerName(nPlayer), PlayerName(playerid));
                if(he <= 0.0) SendClientMessageToAll(COLOR_MAROON, str);
                new Float:x1, Float:y1, Float:z1;
                GetPlayerPos(nPlayer,x1,y1,z1);
                SetPlayerPos(nPlayer,x1,y1,z1+1);
                format(string,sizeof(string),"%s has raped you.",PlayerName(playerid));
                SendClientMessage(nPlayer,0x00FFFFC8,string);
                format(string,sizeof(string),"You have raped %s.",PlayerName(nPlayer));
                SendClientMessage(playerid,0x00FFFFC8,string);
                format(string,sizeof(string),"~w~Raped %s",PlayerName(nPlayer));
                GameTextForPlayer(playerid,string,5000,3);
                format(string,sizeof(string),"%s has raped you",PlayerName(playerid));
                GameTextForPlayer(nPlayer,string,5000,3);
                SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
            }
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"Nobody close enough to rape.");
    }
    return 1;
}
Fast help is need cuz i have to put xmax update on my server... thanks...


Re: Command Problem... server returns only "unknown command" - Wizzy951 - 18.12.2013

As dcmd is based on strcmp, which is outdated it might be the reason. Try to convert your command to zcmd ?


Re: Command Problem... server returns only "unknown command" - Anak - 18.12.2013

i'm using similar thing in all my commands but problem is only in this...


Re: Command Problem... server returns only "unknown command" - Dragonsaurus - 18.12.2013

pawn Код:
dcmd(infect, 6, cmdtext);
Is the second parameter 6? Any other length value returns the default unknown command message AFAIK.


Re: Command Problem... server returns only "unknown command" - Anak - 19.12.2013

pawn Код:
dcmd(infect, 6, cmdtext);
I use this OnPlayerCommandText .... any one please solve this issue ... :/