Quote:
Originally Posted by s1cr0n
Is it possible to use zcmd in combination with standard onplayercommandtext and dcmd ?
I'm asking this because I don't have time to convert my whole script to zcmd now, and until then may I use them combined ?
|
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; }
|