dcmd help - 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 help (
/showthread.php?tid=114632)
dcmd help -
Lajko1 - 20.12.2009
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
Re: dcmd help -
Lajko1 - 20.12.2009
anyone ?
Re: dcmd help -
Marcel - 20.12.2009
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;
}
Re: dcmd help -
Lajko1 - 20.12.2009
sorry but still same problem,ty for try,what should be wrong than ?
Re: dcmd help -
Lajko1 - 20.12.2009
can anyone help , i post the full code ... and still no help here cmon guys its important for me
Re: dcmd help - Zeex - 20.12.2009
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
Re: dcmd help -
Lajko1 - 20.12.2009
so that mean i just define this ?
Код:
#define mycommand cmd // or something else
Re: dcmd help - Zeex - 20.12.2009
No, scroll down, it's a few posts below that one you read (#12

.
Re: dcmd help -
Marcel - 20.12.2009
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; }
|
Re: dcmd help -
Lajko1 - 20.12.2009
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