14.02.2013, 17:11
Quote:
Stop the freaking double posting and bumping every few hours, its really annoying and you're breaking the rules.
You already have a variable named idx, change it to idx2 for example and it'll work. And you'll make it easier for everyone if you also tell us which one of the lines is the line that's causing all those warnings and errors. |
Anyways.
the command is still showing errors.
Код:
(15352) : warning 219: local variable "idx" shadows a variable at a preceding level
this is what i have now.
Код:
CMD:duplicateobj(playerid, params[]) { new string[128], idx, object; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(PlayerInfo[playerid][pMapper] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /duplicate [objectid]"); if(!ObjInfo[idx][oModel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid object id."); for(new idx=1; idx<MAX_OBJ; idx++) { if(!ObjInfo[idx][oModel]) { GetDynamicObjectPos(ObjInfo[idx][oObj], ObjInfo[idx][oCX], ObjInfo[idx][oCY], ObjInfo[idx][oCZ]); GetDynamicObjectRot(ObjInfo[idx][oObj], ObjInfo[idx][oCRX], ObjInfo[idx][oCRY], ObjInfo[idx][oCRZ]); ObjInfo[idx][oModel] = object; ObjInfo[idx][oCX] = ObjInfo[idx][oCX]; ObjInfo[idx][oCY] = ObjInfo[idx][oCY]; ObjInfo[idx][oCRX] = ObjInfo[idx][oCRX]; ObjInfo[idx][oCRY] = ObjInfo[idx][oCRY]; ObjInfo[idx][oCRZ] = ObjInfo[idx][oCRZ]; GetDynamicObjectPos(ObjInfo[idx][oObj], ObjInfo[idx][oOX], ObjInfo[idx][oOY], ObjInfo[idx][oOZ]); GetDynamicObjectRot(ObjInfo[idx][oObj], ObjInfo[idx][oORX], ObjInfo[idx][oORY], ObjInfo[idx][oORZ]); ObjInfo[idx][oOX] = ObjInfo[idx][oOX]; ObjInfo[idx][oOY] = ObjInfo[idx][oOY]; ObjInfo[idx][oORX] = ObjInfo[idx][oORX]; ObjInfo[idx][oORY] = ObjInfo[idx][oORY]; ObjInfo[idx][oORZ] = ObjInfo[idx][oORZ]; // Creating format(string, sizeof(string), "Object ID: %d", idx); ObjInfo[idx][oObj] = CreateDynamicObject(ObjInfo[idx][oModel], ObjInfo[idx][oCX], ObjInfo[idx][oCY], ObjInfo[idx][oCZ], ObjInfo[idx][oCRX], ObjInfo[idx][oCRY], ObjInfo[idx][oCRZ]); ObjInfo[idx][oText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjInfo[idx][oCX], ObjInfo[idx][oCY], ObjInfo[idx][oCZ], 10); format(string, sizeof(string), "MapperWarn: %s duplicated object ID %d", RPN(playerid), idx); SendMapperMessage(COLOR_GREEN, 1, string); idx = MAX_OBJ; } } return 1; }