SA-MP Forums Archive
dcmd command not working, puts out "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: dcmd command not working, puts out "SERVER: Unknown Command" (/showthread.php?tid=170066)



dcmd command not working, puts out "SERVER: Unknown Command" - willsuckformoney - 21.08.2010

pawn Code:
dcmd_setdrugs(playerid,params[]) {
    new str[128];
    if(IsPlayerAdmin(playerid)) {
        new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /givedrugs [playerid] [amount]");
        new player1 = strval(tmp), amount = strval(tmp2);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            format(str,sizeof(str),"You have given %s %d amount of drugs", player1, amount);
            SendClientMessage(playerid,green,str);
            if(player1 != playerid) {
                format(str,sizeof(str),"Admin %s has Set your Drugs to '%d'", playerid, amount);
                SendClientMessage(player1,green,str);
            }
            ResetPlayerDrugs(player1);
            GivePlayerDrugs(player1, amount);
        } else SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}

//commandtext
dcmd(setdrugs,8,cmdtext);
help please?


Re: dcmd command not working, puts out "SERVER: Unknown Command" - Mike_Peterson - 21.08.2010

have u defined dcmd on the top?
this:
Code:
 #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
i think so... i dno sorry.


Re: dcmd command not working, puts out "SERVER: Unknown Command" - willsuckformoney - 21.08.2010

Didn't work, just found out that none of commands in the script work D:


Re: dcmd command not working, puts out "SERVER: Unknown Command" - Mike_Peterson - 21.08.2010

:O, all using dcmd? well make sure u defined it and i thought i kinda had this problem.. i had a command called /rb that succesfully worked but all commands under it: /rrb /rrball didnt work it was a bracket( } ) then
absolutely none 0% of all those commands work? or does one do?
upload ur script please.


Re: dcmd command not working, puts out "SERVER: Unknown Command" - willsuckformoney - 21.08.2010

nevar here, check your pms in like 30 seconds


Re: dcmd command not working, puts out "SERVER: Unknown Command" - willsuckformoney - 22.08.2010

Bumpy Bumpy


Re: dcmd command not working, puts out "SERVER: Unknown Command" - dax123 - 22.08.2010

Quote:
Originally Posted by willsuckformoney
View Post
Bumpy Bumpy
dcmd seems fine...
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1


can you show us up your OnPlayerCommandText() ?
i couldn't find any incorrect native functions used or logical errors but you need to recheck it
and are you using another filterscripts? or gamemode?


Re: dcmd command not working, puts out "SERVER: Unknown Command" - Bcklup - 22.08.2010

Is it on your Game Mode or Filterscripts? prolly a "return 1" bug, You should always return 0 in the end of "OnPlayerCommandText"


Re: dcmd command not working, puts out "SERVER: Unknown Command" - DRIFT_HUNTER - 22.08.2010

If you use zcmd then on player command text is not called


Re: dcmd command not working, puts out "SERVER: Unknown Command" - Bcklup - 22.08.2010

So was it the returns?