[Ajuda] Comando
#9

pawn Код:
#include <sscanf2>
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[50 char], params[100 char];
    new msg[128];
    unformat(cmdtext, "s[50]S( )[100]",cmd,params);
   
    if(strcmp(cmd, "/chat", true) == 0)
    {
        new text[80];
        if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "USO: /chat [mensagem]");
        format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), text);
        SendClientMessageToAll(-1, msg);
        return 1;
    }
    return 0;
}
pawn Код:
stock Name(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
}
acho que vc quer isso .-.

ou isso:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[50 char], params[100 char];
    new msg[128];
    unformat(cmdtext, "s[50]S( )[100]",cmd,params);
   
    if(strcmp(cmd, "/chat", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] != 0) return SendClientMessage(playerid, -1, "Vocк nгo pode usar o chat!");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdmin] == 0)
            {
                new text[80];
                if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "USO: /chat [mensagem]");
                format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), text);
                SendClientMessage(i, -1, msg);
            }
        }
        return 1;
    }
    return 0;
}
pawn Код:
stock Name(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
}
Reply


Messages In This Thread
[Ajuda] Comando - by Gabriel Gonzaga - 13.12.2011, 15:19
Re: [Ajuda] Comando - by isli27 - 13.12.2011, 15:29
Re: [Ajuda] Comando - by Gabriel Gonzaga - 13.12.2011, 15:30
Re: [Ajuda] Comando - by isli27 - 13.12.2011, 15:31
Re: [Ajuda] Comando - by Gabriel Gonzaga - 13.12.2011, 15:34
Re: [Ajuda] Comando - by isli27 - 13.12.2011, 15:36
Re: [Ajuda] Comando - by Lуs - 13.12.2011, 15:39
Re: [Ajuda] Comando - by isli27 - 13.12.2011, 15:42
Re: [Ajuda] Comando - by Cristhian - 13.12.2011, 15:43
Re: [Ajuda] Comando - by Gabriel Gonzaga - 13.12.2011, 15:49

Forum Jump:


Users browsing this thread: 1 Guest(s)