08.09.2013, 12:24
Bom pessoal й o seguinte meu gm ele ta em STRCMP, so que eu queria deixa ele tbm em zcmd sera qui tem como eu fazer ? me ajudem pf
/**********************************
* *
* @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*/
forward __OnPlayerCommandText__(playerid, cmdtext[]);
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]);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!!!strcmp(cmdtext, "/oi"))
{
SendClientMessage(playerid, -1, "teste");
return 1;
}
return __OnPlayerCommandText__(playerid, cmdtext);
}
CMD:xau(playerid)
{
SendClientMessage(playerid, -1, "teste 2");
return 1;
}
if (strcmp(cmdtext, "/comando") == 0) //Exemplo de comando normal
{
return 1;
}
Exemplo de cуdigo no GM:
pawn Код:
Os comandos no GM, tu pode fazer normalmente, sу que os comandos que tu for fazer com STRCMP, tu tem de retornar algum valor... Exemplo pawn Код:
|
C:\Documents and Settings\Conviidado.AKINAS-E30DEFCE\Meus documentos\Minhas imagens\imprimir\pawno\GFB.pwn(8032) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Conviidado.AKINAS-E30DEFCE\Meus documentos\Minhas imagens\imprimir\pawno\GFB.pwn(8032) : error 017: undefined symbol "cmd_xau"
C:\Documents and Settings\Conviidado.AKINAS-E30DEFCE\Meus documentos\Minhas imagens\imprimir\pawno\GFB.pwn(8032) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Conviidado.AKINAS-E30DEFCE\Meus documentos\Minhas imagens\imprimir\pawno\GFB.pwn(8032) : fatal error 107: too many error messages on one line
error 021: symbol already defined: "OnCommandText"
C:\Documents and Settings\Conviidado.AKINAS-E30DEFCE\Meus documentos\Minhas imagens\imprimir\pawno\GFB.pwn(11478) : error 017: undefined symbol "__OnPlayerCommandText__"