[Include] d!CMD ~ Process Command!
#1

Introduзгo
O d!CMD й um processador de comando, pequeno e simples.

Include
d!CMD.inc

pawn Код:
/*
 * --- d!CMD ---
 * Por Danilo Galvгo
 * [iPs]TeaM - Equipe GT
 * http://www.ipsbr.net - http://www.equipegt.com
 *
*/


stock iscmd(string[])
{
    new id, position = -1;

    while(string[++position])
        id ^= (string[position] - string[1]);

    return id;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmdpos = -1, id, params[128];

    while(cmdtext[++cmdpos] > ' ')
        id ^= cmdtext[cmdpos] - cmdtext[1];

    format(params, sizeof(params), "%s", cmdtext[cmdpos+1]);

    #if defined Ips_OnPlayerCommandText
        return Ips_OnPlayerCommandText(playerid, id, params);
    #else
        return 0;
    #endif
}
#if defined _ALS_OnPlayerCommandText
    #undef OnPlayerCommandText
#else
    #define _ALS_OnPlayerCommandText
#endif
#define OnPlayerCommandText Ips_OnPlayerCommandText

#if defined Ips_OnPlayerCommandText
    forward Ips_OnPlayerCommandText(playerid, commandid, params[]);
#endif
Modo de Uso

O uso й como na iCMD:
"Agora a callback OnPlayerCommandText foi modificada, e o uso dela serб o seguinte:
pawn Код:
public OnPlayerCommandText(playerid, commandid, params[])
Commandid? Params?
Simples, commandid representa o ID do comando. E params[] representa os parвmetros do comando — caso o jogador tenha digitado algum, й claro."

Uso:
pawn Код:
public OnPlayerCommandText(playerid, commandid, params[])
{
    if(commandid == iscmd("/tapa"))
    {
       //funзхes
    }
    return false; // COMANDO NГO EXISTENTE.
}
Autoria
* DanDRT - Include;
* IpsBruno - Hook Method;
* [IPS]Team.

Depois conserto as cores do post tenho que sair.
Reply


Messages In This Thread
d!CMD ~ Process Command! - by DanDRT - 10.12.2013, 15:49
Re: d!CMD ~ Process Command! - by 22 - 10.12.2013, 15:56
Re: d!CMD ~ Process Command! - by Kuddy - 10.12.2013, 16:04
Re: d!CMD ~ Process Command! - by mau.tito - 10.12.2013, 16:57
Re: d!CMD ~ Process Command! - by DannielCooper - 10.12.2013, 17:11
Re: d!CMD ~ Process Command! - by PT - 10.12.2013, 21:15
Re: d!CMD ~ Process Command! - by Juniiro3 - 10.12.2013, 21:23
Respuesta: Re: d!CMD ~ Process Command! - by DanDRT - 10.12.2013, 21:24
Re: Respuesta: Re: d!CMD ~ Process Command! - by Juniiro3 - 10.12.2013, 21:31
Respuesta: Re: Respuesta: Re: d!CMD ~ Process Command! - by DanDRT - 10.12.2013, 21:32

Forum Jump:


Users browsing this thread: 1 Guest(s)