#define cmd(%1,%2,%3)\
forward @%1(%2,%3); \
public @%1(%2,%3)
forward OnPlayerReceivedCommand(iPlayer,cmdtext[],sucess);
public OnPlayerReceivedCommand(iPlayer,cmdtext[],sucess)
{
return true;
}
public
OnPlayerCommandText(iPlayer,cmdtext[])
{
if(strfind(cmdtext, " ", true) == -1)
{
cmdtext[0] = '@';
return CallLocalFunction("OnPlayerReceivedCommand","isd",iPlayer,cmdtext,CallLocalFunction(cmdtext,"is",playerid," "));
}
new iLoop = 0,iSpaces = 0,iStr[32];
while(iSpaces != 1) if(cmdtext[++iLoop] == ' ') ++iSpaces;
++iLoop,format(iStr,32,cmdtext[iLoop]),cmdtext[iLoop - 1] = '\0';
printf("Cmd: %s | Param: %s",cmdtext,iStr);
return CallLocalFunction("OnPlayerReceivedCommand","isd",iPlayer,cmdtext,CallLocalFunction(cmdtext,"is",playerid,iStr));
}
//In Final Command
cmd(ban,iPlayer,params[])
{
if (!IsPlayerAdmin(iPlayer))
return SendClientMessage(iPlayer, VERMELHO, "[ERROR] Not Admin");
new id,message[64];
if (sscanf(params, "us[64]", id,message))
return SendClientMessage(iPlayer,AMARELO, "Use: /ban [id/nick] [reason]");
if (!IsPlayerConnected(id))
return SendClientMessage(iPlayer,VERMELHO, "[ERRO] Player is Offline");
if (id == iPlayer)
return SendClientMessage(iPlayer,VERMELHO, "[ERRO] Not ban your");
BanEx(id,message);
return true;
}
#include "../Includes1/a_samp.inc"
#define icmd(%1,%2,%3)\
forward @%1(%2,%3); \
public @%1(%2,%3)
public OnFilterScriptInit()
{
#define MAX_TEST (990000)
// ICMD TEST
new dcmdtest = GetTickCount();
for(new a; a < MAX_TEST; ++a)
OnPlayeriCmdCommandText(0,"/icmd mans");
printf("# ICMD in %d",GetTickCount() - dcmdtest);
//ZCMD TEST
new zcmdtest = GetTickCount();
for(new a; a < MAX_TEST; ++a)
OnPlayerCommandText(0, "/zcmd test");
printf("# ZCMD in %d",GetTickCount() - zcmdtest);
return true;
}
//Include ICMD
forward OnPlayerReceivedCommandICMD(iPlayer,cmdtext[],sucess);
public OnPlayerReceivedCommandICMD(iPlayer,cmdtext[],sucess)
{
return true;
}
forward OnPlayeriCmdCommandText(iPlayer,cmdtext[]);
public OnPlayeriCmdCommandText(iPlayer,cmdtext[])
{
if(strfind(cmdtext, " ", true) == -1)
{
cmdtext[0] = '@';
return CallLocalFunction("OnPlayerReceivedCommandICMD","isd",iPlayer,cmdtext,CallLocalFunction(cmdtext,"is",iPlayer," "));
}
new iLoop = 0,iSpaces = 0,iStr[32];
while(iSpaces != 1) if(cmdtext[++iLoop] == ' ') ++iSpaces;
++iLoop,format(iStr,32,cmdtext[iLoop]),cmdtext[iLoop - 1] = '\0';
return CallLocalFunction("OnPlayerReceivedCommandICMD","isd",iPlayer,cmdtext,CallLocalFunction(cmdtext,"is",iPlayer,iStr));
}
//INCLUDE ZCMD
#define MAX_FUNC_NAME (32)
#define zCOMMAND:%1(%2) \
forward zcmd_%1(%2); \
public zcmd_%1(%2)
#define zCMD:%1(%2) \
zCOMMAND:%1(%2)
#define zcommand(%1,%2,%3) \
zCOMMAND:%1(%2, %3)
#define zcmd(%1,%2,%3) \
zCOMMAND:%1(%2, %3)
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
forward OnPlayerCommandReceived(iPlayer, cmdtext[]);
forward OnPlayerCommandPerformed(iPlayer, cmdtext[], success);
static
bool:zcmd_g_HasOPCS = false,
bool:zcmd_g_HasOPCE = false;
forward zcmd_OnFilterScriptInit();
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;
}
public OnPlayerCommandText(iPlayer, cmdtext[])
{
if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", iPlayer, cmdtext))
{
return 1;
}
new
pos,
funcname[MAX_FUNC_NAME];
while (cmdtext[++pos] > ' ')
{
funcname[pos-1] = tolower(cmdtext[pos]);
}
format(funcname, sizeof(funcname), "zcmd_%s", funcname);
while (cmdtext[pos] == ' ') pos++;
if (!cmdtext[pos])
{
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", iPlayer, cmdtext, CallLocalFunction(funcname, "is", iPlayer, "\1"));
}
return CallLocalFunction(funcname, "is", iPlayer, "\1");
}
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", iPlayer, cmdtext, CallLocalFunction(funcname, "is", iPlayer, cmdtext[pos]));
}
return CallLocalFunction(funcname, "is", iPlayer, cmdtext[pos]);
}
//COMMANDS
zcmd(zcmd,iPlayer,params[])
{
return true;
}
icmd(zcmd,iPlayer,params[])
{
return true;
}
[12:01:38] # ICMD in 214 [12:01:39] # ZCMD in 221
Oh ... I don't get it why you want the have the fastest system.
Anyway. Add a command in your script with your iCmds Include /ban ... use ingame /BaN. It won't work ( case sensitive ). |
format(funcname, sizeof(funcname), "zcmd_%s", funcname);
strins(funcname, "zcmd_", 0);
I really do like the fact that people like to have a competition with Zeex and ******, zeex with his command processor and ****** with his ini system, yet you guys manage to almost defeat them.
Maybe iCmds is better than ZCMD. Here we don't need to say, God knows, instead we say, ****** kows. Sorry for acting like a bitch lately. Good job |