EditDynamicObject & Array of object ID [Help]
#1

Hi guys, I have an array of valid object ids for my furniture system:

pawn Code:
new KitchenModels[][] =
{
    // ======================== //
    {"Kitchen Set", 14720, 1000},
    {"White Kitchen Cabinet 1", 2133, 200},
    {"White Kitchen Cabinet 2", 2134, 200},
    {"Large White Kitchen Cabinet", 2338, 300},
    {"Corner White Kitchen Cabinet", 2341, 300},
    {"Green Kitchen Cabinet 1", 2334, 200},
    {"Green Kitchen Cabinet 2", 2335, 200},
    {"Large Green Kitchen Cabinet", 2158, 300},
    {"Luxury Cooker", 2135, 400},
    {"Luxury Sink", 2136, 400}
};
The first field (0) is the object name, (1) is the object model, and (2) is the cost of that furniture.

Now, I have a dialog that simply generates a list with all these objects using strcat, this dialog being:
pawn Code:
case DIALOG_KITCHENOBJ:
        {
            if(response)
            {
                if(GetServerMoney(playerid) < KitchenModels[listitem][2])
                {
                    format(szString, 128, "This object costs ~g~$%d.", KitchenModels[listitem][2]);
                    ShowErrorMessage(playerid, szString);
                    return 1;
                }
               
                new obj, Float:x1, Float:x2, Float:x3;
                GetPlayerPos(playerid, x1, x2, x3);
                obj = CreateDynamicObject(KitchenModels[listitem][1], x1, x2, x3, 0, 0, 0, GetPlayerVirtualWorld(playerid) );

                EditDynamicObject(playerid, obj);
                SetPVarInt(playerid, "EditingFurni", obj);
               
                printf("*_________*");
                printf("*Obj: %d", KitchenModels[listitem][1]);
                printf("*_________*");
                SendClientMessage(playerid, COLOR_YELLOW, "You are now editing a furniture, click the floppy disk to save, or /cancelfurni to cancel.");
            }
        }
But it doesn't work at all, since when I debugged, Obj says 117 if I choose "Luxury Sink" (last listitem), and if I choose the first one (Kitchen Set) it will print 105. Also, the object edit mode doesn't enable at all, how can I solve this?
Reply
#2

This problem was also my problem.But i found the a solution,before you edit an object update the pos,where you created.
pawn Code:
Streamer_UpdateEx(playerid, x1, x2, x3, GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)