[AJUDA] Ajuda com o "warning 213: tag mismatch"
#5

Quote:
Originally Posted by Kon_BR
Посмотреть сообщение
ae velho, deu certo mбs o comando funfou pra mim '-' ... Algum de vocкs poderia explicar pra mim, ou me passar um link de como faz pra deixar com que o comando quando digitado, precise digitar o id da pessoa, tipo : "/paraoceu [id do player]"
Tentei copiar algumas funзхes do comando de /pm, mas nгo deu certo... ._.'
pra isso vc precisa de no minimo saber strtok

exemplo:
pawn Код:
// na sua public onplayercommand
//crie as vars:

new cmd[256],idx,tmp[256];
    cmd = strtok(cmdtext,idx);
   
    // assim:
public OnPlayerCommandText(playerid, cmdtext[])
{

    new cmd[256],idx,tmp[256];
    cmd = strtok(cmdtext,idx);
   
// depois coloque aqui seu comando
    if(strcmp(cmd, "/teste", true) == 0) //note que aqui nгo usa cmdtext, e sim cmd
    {
        if(!IsPlayerAdmin(playerid) return SendClientMessage(playerid, -1,"vc nao pode usar este comando"); // aki verifica se ele й adm rcon, e se nao for retorna q ele nao pode usar;
        new id[128]; // cria a var id
        id = strtok(cmdtext, idx); // define que id deve chamar strtok
        if(!strlen(id)) return SendClientMessage(playerid, CINZA, "ow vc ta usando errado, certo: /teste id"); // aki verifica se ele nao digitou nada em id.
        new convertid = strval(id); //aki converte a string id, em interger
        SendClientMessage(convertid,-1,"alguem mandou lhe uma msg"); // aqui manda uma msg pro id digitado em /teste id
        new pegaonome[25]; //aqui cria uma string pra pegar o nome do cara
        GetPlayerName(convertid,pegaonome,sizeof(pegaonome)); // aqui pega o nome do dito cujo e joga na string acima
        format(tmp,sizeof(tmp),"vc mando uma mensagem pro: %s",pegaonome); // aqui formata a string tmp, q agente crio la em cima, com uma msg + o nome do kra;
        SendClientMessage(playerid,-1,tmp); // aqui manda a msg pra quem digito o cmd...
        return 1; // retorna 1 si correu tudo bem
       
    } // aki termina o cmd

    return SendClientMessage(playerid, -1, "comando invalido"); // isso й da public onplayercommandtext;
}



// no final do gm, como agente vai usar strtokl

//devemos add isso:

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Messages In This Thread
[AJUDA] Ajuda com o "warning 213: tag mismatch" - by Kon_BR - 22.03.2012, 00:44
Re: [AJUDA/WARNING] Ajuda com o "warning 213: tag mismatch" - by ViniBorn - 22.03.2012, 00:53
Re: [AJUDA/WARNING] Ajuda com o "warning 213: tag mismatch" - by steeldark - 22.03.2012, 00:57
Re: [AJUDA/WARNING] Ajuda com o "warning 213: tag mismatch" - by Kon_BR - 22.03.2012, 00:58
Re: [AJUDA/WARNING] Ajuda com o "warning 213: tag mismatch" - by steeldark - 22.03.2012, 01:17
Re: [AJUDA/WARNING] Ajuda com o "warning 213: tag mismatch" - by Kon_BR - 22.03.2012, 01:30

Forum Jump:


Users browsing this thread: 1 Guest(s)