08.04.2010, 03:07
Whats wrong with this?
08.04.2010, 04:32
Open up pawno and click New. Select-all and delete everything.
Copy this:
Click Save, and go to /.../pawno/Include/ and click on the drop down menu and select All Files and name this zcmd.inc. Click Yes.
Go into your script and delete OnPlayerCommandText. Some reason OnPlayerCommandText doesn't work with zcmd in it in 0.3.
Copy this:
pawn Код:
/**********************************
* *
* @Author: ZeeX *
* @Version: 0.3.1 *
* @Released: 31/10/2009 *
* *
**********************************/
#if defined _zcmd_included
#endinput
#endif
#define _zcmd_included
#define MAX_FUNC_NAME (32)
#define COMMAND:%1(%2) \
forward cmd_%1(%2); \
public cmd_%1(%2)
#define CMD:%1(%2) \
COMMAND:%1(%2)
#define command(%1,%2,%3) \
COMMAND:%1(%2, %3)
#define cmd(%1,%2,%3) \
COMMAND:%1(%2, %3)
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
forward OnPlayerCommandReceived(playerid, cmdtext[]);
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
static
bool:zcmd_g_HasOPCS = false,
bool:zcmd_g_HasOPCE = false;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
return CallLocalFunction("zcmd_OnFilterScriptInit", "");
}
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#else
#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit zcmd_OnFilterScriptInit
forward zcmd_OnFilterScriptInit();
#else /*not a filterscript*/
public OnGameModeInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
if (funcidx("zcmd_OnGameModeInit") != -1)
{
return CallLocalFunction("zcmd_OnGameModeInit", "");
}
return 1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit zcmd_OnGameModeInit
forward zcmd_OnGameModeInit();
#endif /*if defined FILTERSCRIPT*/
public OnPlayerCommandText(playerid, cmdtext[])
{
if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
{
return 1;
}
new
pos,
funcname[MAX_FUNC_NAME];
while (cmdtext[++pos] > ' ')
{
funcname[pos-1] = tolower(cmdtext[pos]);
}
format(funcname, sizeof(funcname), "cmd_%s", funcname);
while (cmdtext[pos] == ' ') pos++;
if (!cmdtext[pos])
{
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, "\1"));
}
return CallLocalFunction(funcname, "is", playerid, "\1");
}
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, cmdtext[pos]));
}
return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
}
#if defined _ALS_OnPlayerCommandText
#undef OnPlayerCommandText
#else
#define _ALS_OnPlayerCommandText
#endif
#define OnPlayerCommandText zcmd_OnPlayerCommandText
forward zcmd_OnPlayerCommandText(playerid, cmdtext[]);
Go into your script and delete OnPlayerCommandText. Some reason OnPlayerCommandText doesn't work with zcmd in it in 0.3.
08.04.2010, 05:15
Should you possibly define it as a filterscript? If you're using it as a filterscript.. Remember to add it in the server.cfg
08.04.2010, 11:55
Quote:
Originally Posted by Jay420
Should you possibly define it as a filterscript? If you're using it as a filterscript.. Remember to add it in the server.cfg
|
08.04.2010, 12:13
I find I get problems like that whenever I use zcmd and put my commands as CMD:mycmd, but it works as zcmd(mycmd, playerid, params[]) for some reason.
EDIT: You also can't use OnPlayerCommandText with zcmd.
EDIT: You also can't use OnPlayerCommandText with zcmd.
08.04.2010, 16:14
I did not use onplayercommandtext with Zcmd.
It's on top of it (right before it) It was working fine before, now it's not.. I'm not sure why.
It's on top of it (right before it) It was working fine before, now it's not.. I'm not sure why.
08.04.2010, 16:17
You can't use the OnPlayerCommandText function if you included the zcmd include file. So change the OnPlayerCommandText to "OnPlayerCommandRecieved( playerid, cmdtext, success )" .
08.04.2010, 18:39
Yeah, we mean you cant use the actual callback itself. Even then OnPlayerCommandReceived doesn't work properly for me, so I just converted all my commands to zcmd.
As I said, try using them with the format
As I said, try using them with the format
pawn Код:
zcmd(mycmd, playerid, params[])
{
//code
return 1;
}
08.04.2010, 20:13
I'm not sure how to convert my code into Zcmd, so i followed what the other guy said to change my Onplayercommandtext.
Now, Everytime i type a command lets say /cuff, it works but it also says "Unknown command"
http://pastebin.com/Wmxeiw9L
Now, Everytime i type a command lets say /cuff, it works but it also says "Unknown command"
http://pastebin.com/Wmxeiw9L
08.04.2010, 20:39
Quote:
Originally Posted by ruckfules99
I'm not sure how to convert my code into Zcmd
|
pawn Код:
zcmd(mycmd, playerid, params[])
{
//code
return 1;
}
« Next Oldest | Next Newest »
Users browsing this thread: 2 Guest(s)