22.02.2013, 14:04
Код:
new tempID[128]; 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; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[128], idx; cmd = strtok(cmdtext, idx); new pID[128]; pID = strtok(cmdtext, idx); if (strcmp(cmd,"/oocmode", true) == 0) { if(strlen(pID) == 0) return SendClientMessage(playerid, 0xE3E3E3FF, "USAGE: /oocmode [playerid]"); if( omode == 0 ) { new Text3D:label = Create3DTextLabel("DO NOT ROLEPLAY WITH THIS PERSON!\nTHIS PERSON IS IN OOC MODE!", COLOR_LIGHTGREEN, 30.0, 40.0, 50.0, 40.0, 0); Attach3DTextLabelToPlayer(label, strval(pID), 0.0, 0.0, 0.7); SendClientMessage(strval(pID), COLOR_LIGHTGREEN, "(Info): You are now in OOC mode, you may not roleplay with anybody!"); omode = 1; strcat(tempID, pID); // Here I put pID value in tempID, maybe I am doing it wrongly? } else if( omode == 1 ) SendClientMessage(playerid, COLOR_ERROR, "ERROR: There is currently a player using OOC mode, you may not use it now!"); else if( omode == 1 && tempID[] == pID[] ) { omode = 0; Delete3DTextLabel(Text3D:0); } return 1; } }
Код:
ERRORS: C:\Users\haim\Desktop\Script\gamemodes\Untitled.pwn(195) : error 033: array must be indexed (variable "tempID") C:\Users\haim\Desktop\Script\gamemodes\Untitled.pwn(195) : error 033: array must be indexed (variable "pID")