[Ajuda] Warning no meu gamemode
#1

Coloquei um sistema de Laser no meu gamemode, aquele de /laseron /laseroff /lasercor mais ai fico dando warnings...me ajudem a resolver ?
Код:
(14862) : warning 219: local variable "tmp" shadows a variable at a preceding level
(50793) : error 021: symbol already defined: "strtok"
Linhas
Код:
                new tmp[128];
{
Comandos com erro
Код:
        if (!strcmp("/lasercor", cmd, true)) {
                new tmp[128];
                tmp = strtok(cmdtext, idx);
                if (!strlen(tmp)) {
                        SendClientMessage(playerid, 0x00E800FF, "Usage: /lasercor [cor]");
                        return 1;
                }
                if (!strcmp(tmp, "vermelho", true)) SetPVarInt(playerid, "color", 18643);
                else if (!strcmp(tmp, "azul", true)) SetPVarInt(playerid, "color", 19080);
                else if (!strcmp(tmp, "rosa", true)) SetPVarInt(playerid, "color", 19081);
                else if (!strcmp(tmp, "laranja", true)) SetPVarInt(playerid, "color", 19082);
                else if (!strcmp(tmp, "verde", true)) SetPVarInt(playerid, "color", 19083);
                else if (!strcmp(tmp, "amarelo", true)) SetPVarInt(playerid, "color", 19084);
                else SendClientMessage(playerid, 0x00E800FF, "Cor nгo disponivel!");
                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
#2

deleta a strtok, seu gm jб tem ela. Deleta uma das duas que vocк tem.
Reply
#3

Ainda deu um erro esse
Код:
(14844) : warning 219: local variable "tmp" shadows a variable at a preceding level
Linha do erro
Код:
                new tmp[128];
comando do erro
Код:
        if (!strcmp("/lasercor", cmd, true)) {
                new tmp[128];
                tmp = strtok(cmdtext, idx);
                if (!strlen(tmp)) {
                        SendClientMessage(playerid, 0x00E800FF, "Usage: /lasercor [cor]");
                        return 1;
                }
                if (!strcmp(tmp, "vermelho", true)) SetPVarInt(playerid, "color", 18643);
                else if (!strcmp(tmp, "azul", true)) SetPVarInt(playerid, "color", 19080);
                else if (!strcmp(tmp, "rosa", true)) SetPVarInt(playerid, "color", 19081);
                else if (!strcmp(tmp, "laranja", true)) SetPVarInt(playerid, "color", 19082);
                else if (!strcmp(tmp, "verde", true)) SetPVarInt(playerid, "color", 19083);
                else if (!strcmp(tmp, "amarelo", true)) SetPVarInt(playerid, "color", 19084);
                else SendClientMessage(playerid, 0x00E800FF, "Cor nгo disponivel!");
                return 1;
        }
Reply
#4

pawn Код:
if (!strcmp("/lasercor", cmd, true)) {
                tmp = strtok(cmdtext, idx);
                if (!strlen(tmp)) {
                        SendClientMessage(playerid, 0x00E800FF, "Usage: /lasercor [cor]");
                        return 1;
                }
                if (!strcmp(tmp, "vermelho", true)) SetPVarInt(playerid, "color", 18643);
                else if (!strcmp(tmp, "azul", true)) SetPVarInt(playerid, "color", 19080);
                else if (!strcmp(tmp, "rosa", true)) SetPVarInt(playerid, "color", 19081);
                else if (!strcmp(tmp, "laranja", true)) SetPVarInt(playerid, "color", 19082);
                else if (!strcmp(tmp, "verde", true)) SetPVarInt(playerid, "color", 19083);
                else if (!strcmp(tmp, "amarelo", true)) SetPVarInt(playerid, "color", 19084);
                else SendClientMessage(playerid, 0x00E800FF, "Cor nгo disponivel!");
                return 1;
        }
Reply
#5

Obrigado, funcionou...+Rep pra vc...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)