[Ajuda] problema no comando
#1

pawn Код:
if(strcmp(cmd, "/ah", true) == 0 || strcmp(cmd, "/helperadmin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[100];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: (/ah ou /helperadmin [helpers/admins chat]");
                return true;
            }
            format(string, sizeof(string), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                SendHelperMessage(0xFFF8F8AA, string);
            }
            format(string, sizeof(string), "*%d Helper %s: %s", PlayerInfo[playerid][pHelper], sendername, result);
            if (PlayerInfo[playerid][pHelper] >= 1)
            {
                SendHelperMessage(0x63C3F6AA, string);
            }
            printf("Helper %s: %s", sendername, result);
        }
        return true;
    }
Galera tipo esse comando, ta aparecendo 2 vzs quando tu digita. eu nao sei porque, tentei botar abroadcast no debaix, pq tem 2 senhelpermessage, so q nao da, da um erro escroto la. ta aprecendo 2 vzes a frase no /ah vc digita e aparece 2vzs, queria saber oq ta errado
Reply
#2

up....
Reply
#3

Para que й que estб aн esse IsPlayerConnected? Se ele executa o comando й meio уbvio que estб conectado nгo?

Teste assim: (nгo testei)

pawn Код:
if(strcmp(cmd, "/ah", true) == 0 || strcmp(cmd, "/helperadmin", true) == 0)
{
    new length = strlen(cmdtext);
    new offset = idx;
    new result[100];

    GetPlayerName(playerid, sendername, sizeof(sendername));
    while ((idx < length) && (cmdtext[idx] <= ' ')) idx++;
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
        result[idx - offset] = cmdtext[idx];
        idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
        SendClientMessage(playerid, COLOR_GRAD2, "USE: (/ah ou /helperadmin [helpers/admins chat]");
        return true;
    }
    format(string, sizeof(string), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
    if (PlayerInfo[playerid][pAdmin] >= 1) return SendHelperMessage(0xFFF8F8AA, string);
    format(string, sizeof(string), "*%d Helper %s: %s", PlayerInfo[playerid][pHelper], sendername, result);
    if (PlayerInfo[playerid][pHelper] >= 1) return SendHelperMessage(0x63C3F6AA, string);
    printf("Helper %s: %s", sendername, result);
   
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)