new car, Madec[MAX_VEHICLES];
if(strcmp(cmd, "/cardescription", true) == 0) { new string[256], tmp[256], Text3D:vehicle3Dtext[MAX_VEHICLES]; if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Ceresto: /cardescription [CarID] [Text]"); return 1; } car = strval(tmp); if (IsPlayerAdmin(playerid)) { new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[256]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "Ceresto: /cardescription [CarID] [Text]"); return 1; } if(Madec[car] == 0) { format(string, sizeof(string), "Ceresto: Car (ID: %d) description set!.", car); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "Ceresto: Result: (%s).", result); SendClientMessage(playerid, COLOR_YELLOW, string); vehicle3Dtext[car] = Create3DTextLabel(result, COLOR_LIGHTBLUE, 0.0, 0.0, 0.0, 50.0, 0, 1 ); Attach3DTextLabelToVehicle(vehicle3Dtext[car], car, 0.0, 0.0, 0.0); Madec[car] = 1; return 1; } else if(Madec[car] == 1) { format(string, sizeof(string), "Ceresto: Car (ID: %d) description changed.", car); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), ""Ceresto: Result: (%s).", result); SendClientMessage(playerid, COLOR_YELLOW, string); Update3DTextLabelText(vehicle3Dtext[car], COLOR_LIGHTBLUE, result); Madec[car] = 1; return 1; } return 1; } } return 1; }
Madec[car] = 1;
Why are people still using strtok, and wtf is with 256 cell size? You don't need more than 128.
The second pawn Код:
What the problem is, I can't say. I did my best to look for any "errors", but couldn't find anything, sorry. |