[Reqeust]Command to duplicate an object.
#7

Quote:
Originally Posted by Max_Coldheart
Посмотреть сообщение
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.
Sorry, I diddnt know'd double post's arent allowed.

Anyways.
the command is still showing errors.
Код:
(15352) : warning 219: local variable "idx" shadows a variable at a preceding level
but, when i test it ingame. It isnt duplicating the object.

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;
}
Reply


Messages In This Thread
[Reqeust]Command to duplicate an object. - by faff - 13.02.2013, 18:35
Re: [Reqeust]Command to duplicate an object. - by faff - 13.02.2013, 21:02
Re: [Reqeust]Command to duplicate an object. - by DaRk_RaiN - 13.02.2013, 21:28
Re: [Reqeust]Command to duplicate an object. - by faff - 14.02.2013, 12:34
Re: [Reqeust]Command to duplicate an object. - by faff - 14.02.2013, 16:54
Re: [Reqeust]Command to duplicate an object. - by Max_Coldheart - 14.02.2013, 17:01
Re: [Reqeust]Command to duplicate an object. - by faff - 14.02.2013, 17:11
Re: [Reqeust]Command to duplicate an object. - by Max_Coldheart - 15.02.2013, 11:56
Re: [Reqeust]Command to duplicate an object. - by Max_Coldheart - 15.02.2013, 12:28
Re: [Reqeust]Command to duplicate an object. - by faff - 15.02.2013, 14:23

Forum Jump:


Users browsing this thread: 3 Guest(s)