SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/06/2012, 09:59 PM   #1
Marricio
Gangsta
 
Join Date: Dec 2010
Posts: 718
Reputation: 96
Default EditDynamicObject & Array of object ID [Help]

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?
Marricio is offline   Reply With Quote
Old 16/08/2012, 09:07 AM   #2
kadaradam
Big Clucker
 
kadaradam's Avatar
 
Join Date: Feb 2011
Location: Hungary,Budapest
Posts: 157
Reputation: 65
Default Re: EditDynamicObject & Array of object ID [Help]

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));
kadaradam is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(dFile) error 047: array sizes do not match, or destination array is too small Jack_Leslie Scripting Help 0 06/09/2011 01:20 AM
(dFile) error 047: array sizes do not match, or destination array is too small Jack_Leslie Scripting Help 8 01/09/2011 05:32 AM
[SOLVED]error 047: array sizes do not match, or destination array is too small help! Help Archive 7 18/06/2011 08:09 PM
[Sloved]error 047: array sizes do not match, or destination array is too small CoaPsyFactor Help Archive 1 09/06/2011 08:27 PM
<Php> 'Cannot use object of type stdClass as array' DeathOnaStick Help Archive 2 20/09/2010 04:48 PM


All times are GMT. The time now is 05:18 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.