[DUVIDA] Opзхes de Chat [DUVIDA]
#2

Final do GM:
pawn Code:
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;
}
Primeiras linhas da OnPlayerCommandText:
pawn Code:
new string[256], cmd[256], new idx;
cmd = strtok(cmdtext, idx); idx = 0;
Comando:
pawn Code:
if (strcmp(cmd, "/FnA", true) == 0)
    {
        cmd = strtok(cmdtext, idx);
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        while ((idx < length) && ((idx - offset) < (sizeof(string) - 1)))
        {
            string[idx - offset] = cmdtext[idx];
            idx++;
        }
        string[idx - offset] = EOS;
        if (!strlen(string)) return SendClientMessage(playerid, Azul, "Utilize: /FnA [Texto]");
        new pNome[24];
        GetPlayerName(playerid, pNome, 24);
        new string2[256];
        format(string2, 128, "[FnA] %s: %s", pNome, string);
        SendClientMessageToAll(Azul, string2);
        return 1;
    }
Reply


Messages In This Thread
[DUVIDA] Opзхes de Chat [RESOLVIDO] - by Dj_Paradox - 05.01.2011, 16:55
Re: [DUVIDA] Opзхes de Chat [DUVIDA] - by Black Sσldiєя - 05.01.2011, 17:07
Re: [DUVIDA] Opзхes de Chat [DUVIDA] - by [NWD]Jim._.Carrey - 05.01.2011, 17:11
Re: [DUVIDA] Opзхes de Chat [DUVIDA] - by Macintosh - 05.01.2011, 17:13
Re: [DUVIDA] Opзхes de Chat [DUVIDA] - by Dj_Paradox - 05.01.2011, 17:24
Respuesta: [DUVIDA] Opзхes de Chat [DUVIDA] - by zSuYaNw - 05.01.2011, 17:25

Forum Jump:


Users browsing this thread: 2 Guest(s)