can somebody help me?
if(strcmp(cmd, "/color", true) == 0 || strcmp(cmd, "/colour", true) == 0)
{
new color1, color2, tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /carcolor [color1] [color2]");
color1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /carcolor [color1] [color2]");
color2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
return 1;
}
c:/----(315) : error 017: undefined symbol "cmd" c:/----(318) : error 017: undefined symbol "strtok" c:/----(318) : error 033: array must be indexed (variable "tmp") c:/----(319) : warning 217: loose indentation c:/----(320) : warning 217: loose indentation c:/----(321) : error 017: undefined symbol "strtok" c:/----(321) : error 033: array must be indexed (variable "tmp") c:/----(325) : warning 217: loose indentation
|
Originally Posted by player007
Install strtok.
https://sampwiki.blast.hk/wiki/Strtok |
|
Originally Posted by security
Quote:
|
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;
}
new cmd[256];
new tmp[256];
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;
}