DRCMD:teszt(playerid, params[]) { SendClientMessage(playerid, 0xFFFFFF, "Ez egy teszt szцveges ьzenet!"); return 1; }
DRCMD:givemoney(playerid, params[]) { new money, player; if(sscanf(params, "dd", player, money)) return SendClientMessage(playerid, 0xFFFFFF, "USAGE: /givemoney [playerid] [money]"); else if(money <= 0) return SendClientMessage(playerid, 0xFFFFFF, "ERROR: The money ammount is incorrect!"); else if(!IsPlayerConnected(player)) return SendClientMessage(playerid, 0xFFFFFF, "The player isn't online!"); else { format(string, sizeof(string), "You successfully gove %d$ to the following player: %dID", money, player); SendClientMessage(playerid, 0xFFFFFF, string); format(string, sizeof(string), "You get %d$!", money); SendClientMessage(player, 0xFFFFFF, string); } return 1; }
DRCMD:gm(playerid, params[]) { return drcmd_givemoney(playerid, params[]); }
DRCMD:command(playerid, params[]) DRCMD_command(playerid, params[]) drcmd(command, playerid, params[]) CMD:command(playerid, params[]) COMMAND:command(playerid, params[])
if(isnull(params))
#include <a_samp> #define DRCMD:%1(%2,%3) \ forward drcmd_%1(%2,%3); \ public drcmd_%1(%2,%3) #define DRCMD_%1(%2,%3) \ DRCMD:%1(%2,%3) #define drcmd(%1,%2,%3) \ DRCMD:%1(%2,%3) #define CMD:%1(%2,%3) \ DRCMD:%1(%2,%3) #define COMMAND:%1(%2,%3) \ DRCMD:%1(%2,%3) /*public OnFilterScriptInit() { new returned; returned = OnPlayerCommandText(0, "/tesztparancs"); // Itt hнvod meg a parancs feldolgozуt printf("returned: %d", returned); return 1; }*/ main() { } public OnGameModeInit() { #define MAX_TEST (990000) for(new d; d < 10; ++d) print(" "); new dcmdtest = GetTickCount(); for(new a; a < MAX_TEST; ++a) OnPlayerDraCommandText(0, "/drcmd teszt"); printf("# DRCMD in %d",GetTickCount() - dcmdtest); new zcmdtest = GetTickCount(); for(new a; a < MAX_TEST; ++a) OnPlayerCommandText(0, "/drcmd teszt"); printf("# ZCMD in %d",GetTickCount() - zcmdtest); return true; } forward OnPlayerDraCommandText(playerid, cmdtext[]); public OnPlayerDraCommandText(playerid, cmdtext[]) { new function[32], szokozmeddig = -1; while(++szokozmeddig < strlen(cmdtext)) if((cmdtext[szokozmeddig] == ' ')) break; strmid(function, cmdtext, 1, szokozmeddig); format(function, sizeof(function), "drcmd_%s", function); while(cmdtext[szokozmeddig] == ' ') szokozmeddig++; if(funcidx(function) != -1) { if(szokozmeddig == strlen(cmdtext)) { return CallLocalFunction(function, "is", playerid, "\1"); } return CallLocalFunction(function, "is", playerid, cmdtext[szokozmeddig]); } return 0; } static bool:zcmd_g_HasOPCS = false, bool:zcmd_g_HasOPCE = false; #define MAX_FUNC_NAME (32) 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]); }
What do you mean under bench marks? (Sorry i'm a little bad in english language )
|
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 _drcmd_included #endinput #endif #define _drcmd_included #define DRCMD:%1(%2,%3) \ forward drcmd_%1(%2,%3); \ public drcmd_%1(%2,%3) #define DRCMD_%1(%2,%3) \ DRCMD:%1(%2,%3) #define drcmd(%1,%2,%3) \ DRCMD:%1(%2,%3) #define CMD:%1(%2,%3) \ DRCMD:%1(%2,%3) #define COMMAND:%1(%2,%3) \ DRCMD:%1(%2,%3) #if !defined isnull #define isnull(%1) \ ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) #endif #if defined FILTERSCRIPT public OnFilterScriptInit() #else public OnGameModeInit() #endif { #if defined FILTERSCRIPT if(funcidx("OnFilterScriptInit") != -1) return CallLocalFunction("OnFilterScriptInit", ""); #else if(funcidx("OnGameModeInit") != -1) return CallLocalFunction("OnGameModeInit", ""); #endif return 1; } #if defined FILTERSCRIPT #if defined _ALS_OnFilterScriptInit #undef OnFilterScriptInit #else #define _ALS_OnFilterScriptInit #endif #define OnFilterScriptInit drcmd_OnFilterScriptInit forward drcmd_OnFilterScriptInit(); #else #if defined _ALS_OnGameModeInit #undef OnGameModeInit #else #define _ALS_OnGameModeInit #endif #define OnGameModeInit drcmd_OnGameModeInit forward drcmd_OnGameModeInit(); #endif public OnPlayerCommandText(playerid, cmdtext[]) { new function[32], szokozmeddig = -1; while(++szokozmeddig < strlen(cmdtext)) if((cmdtext[szokozmeddig] == ' ')) break; strmid(function, cmdtext, 1, szokozmeddig); format(function, sizeof(function), "drcmd_%s", function); while(cmdtext[szokozmeddig] == ' ') szokozmeddig++; if(funcidx(function) != -1) { if(szokozmeddig == strlen(cmdtext)) { return CallLocalFunction(function, "is", playerid, "\1"); } return CallLocalFunction(function, "is", playerid, cmdtext[szokozmeddig]); } return 0; } #if defined _ALS_OnPlayerCommandText #undef OnPlayerCommandText #else #define _ALS_OnPlayerCommandText #endif #define OnPlayerCommandText drcmd_OnPlayerCommandText forward drcmd_OnPlayerCommandText(playerid, cmdtext[]);
All my works is created by me^^. And it's very interesting. I published it on Hungarian Forum, and nobody said that is ZCMD Edit. I don't know you guys what you think it is ZCMD edit. Then you need to buy a new glasses.
|
#if defined _drcmd_included #endinput #endif #define _drcmd_included #define DRCMD:%1(%2,%3) \ forward drcmd_%1(%2,%3); \ public drcmd_%1(%2,%3) #define DRCMD_%1(%2,%3) \ DRCMD:%1(%2,%3) #define drcmd(%1,%2,%3) \ DRCMD:%1(%2,%3) #define CMD:%1(%2,%3) \ DRCMD:%1(%2,%3) #define COMMAND:%1(%2,%3) \ DRCMD:%1(%2,%3) #if !defined isnull #define isnull(%1) \ ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) #endif #if defined FILTERSCRIPT public OnFilterScriptInit() #else public OnGameModeInit() #endif { #if defined FILTERSCRIPT if(funcidx("OnFilterScriptInit") != -1) return CallLocalFunction("OnFilterScriptInit", ""); #else if(funcidx("OnGameModeInit") != -1) return CallLocalFunction("OnGameModeInit", ""); #endif return 1; } #if defined FILTERSCRIPT #if defined _ALS_OnFilterScriptInit #undef OnFilterScriptInit #else #define _ALS_OnFilterScriptInit #endif #define OnFilterScriptInit drcmd_OnFilterScriptInit forward drcmd_OnFilterScriptInit(); #else #if defined _ALS_OnGameModeInit #undef OnGameModeInit #else #define _ALS_OnGameModeInit #endif #define OnGameModeInit drcmd_OnGameModeInit forward drcmd_OnGameModeInit(); #endif public OnPlayerCommandText(playerid, cmdtext[]) { new function[32], szokozmeddig = -1; while(++szokozmeddig < strlen(cmdtext)) if((cmdtext[szokozmeddig] == ' ')) break; strmid(function, cmdtext, 1, szokozmeddig); format(function, sizeof(function), "drcmd_%s", function); while(cmdtext[szokozmeddig] == ' ') szokozmeddig++; if(funcidx(function) != -1) { if(szokozmeddig == strlen(cmdtext)) { return CallLocalFunction(function, "is", playerid, "\1"); } return CallLocalFunction(function, "is", playerid, cmdtext[szokozmeddig]); } return 0; } #if defined _ALS_OnPlayerCommandText #undef OnPlayerCommandText #else #define _ALS_OnPlayerCommandText #endif #define OnPlayerCommandText drcmd_OnPlayerCommandText forward drcmd_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]);
}
#if defined _drcmd_included #endinput #endif #define _drcmd_included #define DRCMD:%1(%2,%3) \ forward drcmd_%1(%2,%3); \ public drcmd_%1(%2,%3) #define DRCMD_%1(%2,%3) \ DRCMD:%1(%2,%3) #define drcmd(%1,%2,%3) \ DRCMD:%1(%2,%3) #define CMD:%1(%2,%3) \ DRCMD:%1(%2,%3) #define COMMAND:%1(%2,%3) \ DRCMD:%1(%2,%3) #if !defined isnull #define isnull(%1) \ ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) #endif #if defined FILTERSCRIPT public OnFilterScriptInit() #else public OnGameModeInit() #endif { #if defined FILTERSCRIPT if(funcidx("OnFilterScriptInit") != -1) return CallLocalFunction("OnFilterScriptInit", ""); #else if(funcidx("OnGameModeInit") != -1) return CallLocalFunction("OnGameModeInit", ""); #endif return 1; } #if defined FILTERSCRIPT #if defined _ALS_OnFilterScriptInit #undef OnFilterScriptInit #else #define _ALS_OnFilterScriptInit #endif #define OnFilterScriptInit drcmd_OnFilterScriptInit forward drcmd_OnFilterScriptInit(); #else #if defined _ALS_OnGameModeInit #undef OnGameModeInit #else #define _ALS_OnGameModeInit #endif #define OnGameModeInit drcmd_OnGameModeInit forward drcmd_OnGameModeInit(); #endif public OnPlayerCommandText(playerid, cmdtext[]) { new function[32], szokozmeddig = -1; while(++szokozmeddig < strlen(cmdtext)) if((cmdtext[szokozmeddig] == ' ')) break; strmid(function, cmdtext, 1, szokozmeddig); format(function, sizeof(function), "drcmd_%s", function); while(cmdtext[szokozmeddig] == ' ') szokozmeddig++; if(funcidx(function) != -1) { if(szokozmeddig == strlen(cmdtext)) { return CallLocalFunction(function, "is", playerid, "\1"); } return CallLocalFunction(function, "is", playerid, cmdtext[szokozmeddig]); } return 0; } #if defined _ALS_OnPlayerCommandText #undef OnPlayerCommandText #else #define _ALS_OnPlayerCommandText #endif #define OnPlayerCommandText drcmd_OnPlayerCommandText forward drcmd_OnPlayerCommandText(playerid, cmdtext[]);
/********************************** * * * @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[]);