18.10.2012, 20:50
Coloquei um sistema de Laser no meu gamemode, aquele de /laseron /laseroff /lasercor mais ai fico dando warnings...me ajudem a resolver ?
Linhas
Comandos com erro
Код:
(14862) : warning 219: local variable "tmp" shadows a variable at a preceding level (50793) : error 021: symbol already defined: "strtok"
Код:
new tmp[128]; {
Код:
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; }