[AJUDA] Erro cmd
#1

Seguinte :

Achei esse cmd na net /meuclima [id] Para mudar o clima do player para qual ele quizer, e deu os seguintes erros :

pawn Код:
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1512) : error 017: undefined symbol "cmd"
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1515) : error 017: undefined symbol "strtok"
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1515) : error 033: array must be indexed (variable "tmp")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Comando :

pawn Код:
if (!strcmp(cmd, "/meuclima", true)) //Comando
        {
        new tmp[256]; //New Tmp
        tmp = strtok(cmdtext, idx); //Strtok
        if(!strlen(tmp)) return SendClientMessage(playerid, COR_TAXI, "Use /meuclima [ID]"); //Mensagem caso erre.
        new weather = strval(tmp); //Funзгo do Weather
        SetPlayerWeather(playerid, weather); //Funзгo do Weather
        SendClientMessage(playerid, COR_TAXI,"Vocк mudou seu clima !"); //Mensagem
        return 1;
}
Reply
#2

troque
pawn Код:
if (!strcmp(cmd, "/meuclima", true))
por
pawn Код:
if (!strcmp(cmdtext, "/meuclima", true))
E add isso no final do GM

pawn Код:
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

Use o comando desta forma :


pawn Код:
if(strfind(cmdtext, "/meuclima", true) == 0)
    {
        if(cmdtext[9] == 0 || cmdtext[9] == 32)
        {
            if(cmdtext[9] != 32 || (cmdtext[10] == 0 && cmdtext[9] == 32)) return SendClientMessage(playerid, 0xFFFFFFAA, "Use /meuclima [ID]");
            SetPlayerWeather(playerid, strval(cmdtext[10]));
            SendClientMessage(playerid, 0xFFFFFFAA,"Vocк mudou seu clima !");
            return 1;
        }
    }


Espero ter ajudado .
Reply
#4

aeew vlw, +rep pros dois, agora mais um problema '-' com meu cmd /pintar

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0)
{
new tmp[256];
new cor1, cor2;
new veiculo;
tmp = strtok(cmdtext, idx);

if(!strlen(tmp))
{
SendClientMessage(playerid, COR_TAXI,"|| •INFO•: USE: /pintar [cor 1] [cor 2]");
return 1;
}
cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR_TAXI,"|| •INFO•: USE: /pintar [cor 1] [cor 2]");
return 1;
}
cor2 = strval(tmp);
veiculo = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid,veiculo))
{
ChangeVehicleColor(veiculo,cor1,cor2);
SendClientMessage(playerid, COR_TAXI, "|| •INFO•: Veiculo pintador por $100!");
} else {
SendClientMessage(playerid, COR_TAXI, "|| •INFO•: Vocк nao esta em um veiculo!");
}
return 1;
}
Erros :

pawn Код:
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1507) : error 017: undefined symbol "cmd"
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1512) : error 017: undefined symbol "strtok"
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1512) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1520) : error 017: undefined symbol "strtok"
C:\Documents and Settings\FAMILIA_\Desktop\DPSOriginal1\gamemodes\testing.pwn(1520) : error 033: array must be indexed (variable "tmp")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
ajudae favor =D
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)