[Ajuda] Erros ao Compilar
#1

estou com esses erros

pawn Code:
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4796) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4796) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4798) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4799) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4813) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4813) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4815) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4816) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4818) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4818) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4819) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4820) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4828) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4828) : warning 215: expression has no effect
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4836) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4836) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4838) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Fernando\Desktop\BPLV2.pwn(4839) : error 017: undefined symbol "tmp"
Zcmd
pawn Code:
CMD:convidar(playerid, params[])
    {
        tmp = strtok(params, idx);
        new PlayerB;
        if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /convidar [id]");
        PlayerB = strval(tmp);
        if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, BRANCO, "Este jogador nгo estб conectado");
        if(PlayerDados[playerid][PMilitar] >= 6)
        {
            PlayerDados[PlayerB][PMilitar] = 1;
            SendClientMessage(PlayerB, BRANCO, "Vocк entrou а Polнcia Militar");
            SetPlayerColor(PlayerB, Cor_PMilitar);
            return 1;
        }
        return 1;
    }

CMD:promover(playerid, params[])
{
        tmp = strtok(params, idx);
        new PlayerB, level;
        if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /promover [id] [cargo]");
        PlayerB = strval(tmp);
        if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, BRANCO, "Este jogador nгo estб conectado");
        tmp = strtok(params, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /promover [id] [cargo]");
        level = strval(tmp);
        if(level < 1 || level > 6) return SendClientMessage(playerid, BRANCO, "O level deve ser maior que 0 e menor que 7");
        new string[128], promovedor[MAX_PLAYER_NAME];
        GetPlayerName(playerid, promovedor, sizeof(promovedor));
        if(PlayerDados[playerid][PMilitar] >= 6)
        {
            if(PlayerDados[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, BRANCO, "Este jogador nгo й da sua org");
            PlayerDados[PlayerB][PMilitar] = level;
            format(string, sizeof(string), "Vocк foi promovido a level %d por %s", level, promovedor););
            SendClientMessage(PlayerB, BRANCO, string);
            return 1;
       }
        return 1;
}
CMD:demitir(playerid, params[])
{
        tmp = strtok(params, idx);
        new PlayerB, string[128], demitidor[MAX_PLAYER_NAME];
        if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /demitir [id]");
        PlayerB = strval(tmp);
        GetPlayerName(playerid, demitidor, sizeof(demitidor));
        if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, BRANCO, "Este jogador nгo estб conectado");
        if(PlayerDados[playerid][PMilitar] >= 6)
        {
            if(PlayerDados[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, BRANCO, "Este jogador nгo й da sua organizaзгo");
            PlayerDados[PlayerB][PMilitar] = 0;
            format(string, sizeof(string), "Vocк foi demitido por %s", demitidor);
            SendClientMessage(PlayerB, BRANCO, string);
            return 1;
        }
        return 1;
}
Reply
#2

Ser der erro, aumente o tmp[24];
pawn Code:
CMD:convidar(playerid, params[])
{
    new tmp[24], idx; tmp = strtok(params, idx);
    new PlayerB;
    if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /convidar [id]");
    PlayerB = strval(tmp);
    if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, BRANCO, "Este jogador nгo estб conectado");
    if(PlayerDados[playerid][PMilitar] >= 6)
    {
        PlayerDados[PlayerB][PMilitar] = 1;
        SendClientMessage(PlayerB, BRANCO, "Vocк entrou а Polнcia Militar");
        SetPlayerColor(PlayerB, Cor_PMilitar);
        return 1;
    }
    return 1;
}

CMD:promover(playerid, params[])
{
        new tmp[24], idx; tmp = strtok(params, idx);
        new PlayerB, level;
        if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /promover [id] [cargo]");
        PlayerB = strval(tmp);
        if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, BRANCO, "Este jogador nгo estб conectado");
        tmp = strtok(params, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /promover [id] [cargo]");
        level = strval(tmp);
        if(level < 1 || level > 6) return SendClientMessage(playerid, BRANCO, "O level deve ser maior que 0 e menor que 7");
        new string[128], promovedor[MAX_PLAYER_NAME];
        GetPlayerName(playerid, promovedor, sizeof(promovedor));
        if(PlayerDados[playerid][PMilitar] >= 6)
        {
            if(PlayerDados[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, BRANCO, "Este jogador nгo й da sua org");
            PlayerDados[PlayerB][PMilitar] = level;
            format(string, sizeof(string), "Vocк foi promovido a level %d por %s", level, promovedor););
            SendClientMessage(PlayerB, BRANCO, string);
            return 1;
       }
        return 1;
}
CMD:demitir(playerid, params[])
{
        new tmp[24], idx; tmp = strtok(params, idx);
        new PlayerB, string[128], demitidor[MAX_PLAYER_NAME];
        if(!strlen(tmp)) return SendClientMessage(playerid, BRANCO, "Uso correto: /demitir [id]");
        PlayerB = strval(tmp);
        GetPlayerName(playerid, demitidor, sizeof(demitidor));
        if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, BRANCO, "Este jogador nгo estб conectado");
        if(PlayerDados[playerid][PMilitar] >= 6)
        {
            if(PlayerDados[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, BRANCO, "Este jogador nгo й da sua organizaзгo");
            PlayerDados[PlayerB][PMilitar] = 0;
            format(string, sizeof(string), "Vocк foi demitido por %s", demitidor);
            SendClientMessage(PlayerB, BRANCO, string);
            return 1;
        }
        return 1;
}

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
#3

Vlw Paulor Funciono :P
Reply
#4

Pra que usar strtok se vocк pode usar sscanf, que й muito mais prбtico?
Reply
#5

Vini , strtok usa-se em Zcmd?
Reply
#6

Dб pra usar, mas nгo vale a pena...
Reply
#7

eu ja concigui :P vou sу usar sscanf Paulor q me Ajudo!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)