SA-MP Forums Archive
[Include] cLmd - Processador de Comandos v1.0 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: [Include] cLmd - Processador de Comandos v1.0 (/showthread.php?tid=400311)



cLmd - Processador de Comandos v1.0 - CoderLife - 17.12.2012

editado


Re: cLmd - Processador de Comandos v1.0 - dPlaYer_ - 17.12.2012

#EDIT NB _|_


Re: cLmd - Processador de Comandos v1.0 - AmericanStyle'™ - 17.12.2012

Praticamente igual:

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[]);
Sу foi alterada pouca coisa...
Muitas variбveis com o mesmo nome...
3/10.


Re: cLmd - Processador de Comandos v1.0 - Dolby - 17.12.2012

Parabйns, conseguiu fazer uma copia do Cуdigo + Tуpico perfeita: https://sampforum.blast.hk/showthread.php?tid=385391



Re: cLmd - Processador de Comandos v1.0 - histire - 17.12.2012

O que passa na cabeзa de uns cara desses?



Re: cLmd - Processador de Comandos v1.0 - RebeloX - 17.12.2012

Eu quando li o tуpico bem vi que algo estava errado, vi que que era uma copia do zcmd, porйm podia ter feito uma melhoria e nгo levei a mal, no mнnimo colocaria os crйditos do zeex, mas agora vi que era uma cуpia total de outro script, mesmo assim acabei perdendo tempo a fazer umas benchmark, anyway vou postar elas.

Код:
Bench for bcmd: executes, by average, 167.00 times/ms.
Bench for clcmd: executes, by average, 147.43 times/ms.
Й uma diferenзa de 20 vezes, o que й significativo, eu iria dizer que era um bom script, porйm, estragou tudo!


Re: cLmd - Processador de Comandos v1.0 - FeelLikeASir_ - 17.12.2012

Parabйnssssss caraa!!!!!!!!!!! continue aзimmm! ++++++rep !


Re: cLmd - Processador de Comandos v1.0 - JapaN* - 17.12.2012

1° Post e fais isso


Re: cLmd - Processador de Comandos v1.0 - Rodney Francalim - 20.12.2012

Quote:
Originally Posted by Japa3D
Посмотреть сообщение
1° Post e fais isso
Centйsimo quinquagйsimo sйtimo post e faz isso