Warning no meu gamemode -
Vinicius_TroLL - 18.10.2012
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
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;
}
Re: Warning no meu gamemode -
leandro123456 - 18.10.2012
deleta a strtok, seu gm jб tem ela. Deleta uma das duas que vocк tem.
Re: Warning no meu gamemode -
Vinicius_TroLL - 18.10.2012
Ainda deu um erro esse
Код:
(14844) : warning 219: local variable "tmp" shadows a variable at a preceding level
Linha do erro
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;
}
Re: Warning no meu gamemode -
leandro123456 - 18.10.2012
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;
}
Re: Warning no meu gamemode -
Vinicius_TroLL - 18.10.2012
Obrigado, funcionou...+Rep pra vc...