dcmd help
#1

guys i made register , /login sytem , i mean i read 1 tut how to made but when in game i write /register or /login it says ''SERVER:Unknown Command'' what should be wrong ? can u help me please ?

HERE IS THE FULL SCRIPT

http://pastebin.com/m7de0a26d

ty for any help
Reply
#2

anyone ?
Reply
#3

Change
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(login,5,cmdtext); // because login has 5 characters
    dcmd(register,8,cmdtext); // because register has 8 characters
    // /gc
    // /ar
    // /cuff
    // /taze
    return 1;
}
to:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(login,5,cmdtext); // because login has 5 characters
    dcmd(register,8,cmdtext); // because register has 8 characters
    // /gc
    // /ar
    // /cuff
    // /taze
    return 0;
}
Reply
#4

sorry but still same problem,ty for try,what should be wrong than ?
Reply
#5

can anyone help , i post the full code ... and still no help here cmon guys its important for me
Reply
#6

If you're already using zcmd in the script why do you make dcmds?
Anyway, OnPlayerCommandText doesn't work with zcmd (at earlier versions it does), but you can place your dcmds under OnPlayerCommandReceived. Here I've explained how to combine dcmd/strcmp with zcmd: http://forum.sa-mp.com/index.php?top...0143#msg820143
Reply
#7

so that mean i just define this ?

Код:
#define mycommand cmd // or something else
Reply
#8

No, scroll down, it's a few posts below that one you read (#12.
Reply
#9

Or look at this quote from that topic:
Quote:
Originally Posted by ZeeX
Yes, you can combine zcmd with usual commands or dcmd:

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/command1", true))
    {
        SendClientMessage(playerid, 0x00FFFFFF, "usual command");
        return 0;
    }
    SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown command");
    return 1;
}

COMMAND:command2(playerid)
{
    SendClientMessage(playerid, 0x00FF00FF, "zcmd command");
    return 1;
}
But you will have to switch "return 1" to "return 0" in every command to get them working. To avoid this, change the following line in the include (# 85):

pawn Код:
if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
to this one:

pawn Код:
if (zcmd_g_HasOPCS && CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
Then you can just copy all your commands from OnPlayerCommandText and paste them to OnPlayerCommandReceived:

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/command1", true))
    {
        SendClientMessage(playerid, 0x00FFFFFF, "command1");
        return 1;
    }
    ....
    ....

    SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown command");
    return 0;
}

Reply
#10

ye i am looking , reading but i dont understand,can u show how the my login , register command should look ? , i must change OnPlayerCommandText with OnPlayerCommandReceived(playerid, cmdtext[]) or how ? sry but i dont understand this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)