SA-MP Forums Archive
Objects disappear! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Objects disappear! (/showthread.php?tid=644334)



Objects disappear! - AlexMSK - 06.11.2017

Hello everyone okay so i tried making a furniture system, everything works fine, i can buy the object, edit it but when i click save the object disappear? And im trying to find the issue but i cant find it.

PHP код:
                if(response == EDIT_RESPONSE_FINAL)
                {
                    new 
houseid House_Inside(playerid);
                    if(
houseid >= && HasFPrems(playeridhouseid))
                    {
                        if(
p_Info[playerid][pCash] < furnitureObj[p_Info[playerid][pSelect]][fCost])
                        {
                            return 
SendClientMessage(playeridCOLOR_GREY"You couldn't afford to purchase this item.");
                        }
                        new
                            
string[16];
                        
GivePlayerCash(playerid, -furnitureObj[p_Info[playerid][pSelect]][fCost]);
                        
mysql_format(connectqueryBuffersizeof(queryBuffer), "INSERT INTO furniture VALUES(null, %i, %i, '%e', %i, '%f', '%f', '%f', '%f', '%f', '%f', %i, %i, 0, 0)"h_Info[houseid][hSQLId], furnitureObj[p_Info[playerid][pSelect]][fModel], furnitureObj[p_Info[playerid][pSelect]][fName], furnitureObj[p_Info[playerid][pSelect]][fCost], xyzrxryrzh_Info[houseid][hIntIW], h_Info[houseid][hIntVW]);
                        
mysql_tquery(connectqueryBuffer);
                        
mysql_tquery(connect"SELECT * FROM furniture WHERE id = LAST_INSERT_ID()""OnMysqlFinish""ii"LOAD_FURNITUREh_Info[houseid][hLabels]);
                        
format(stringsizeof(string), "~r~-$%i"furnitureObj[p_Info[playerid][pSelect]][fCost]);
                        
GameTextForPlayer(playeridstring50001);
                    }
                }
        case 
LOAD_FURNITURE:
        {
            for(new 
0rowsa++)
            {
                new 
objectid CreateDynamicObject(cache_get_field_content_int(i"modelid"), cache_get_field_content_float(i"pos_x"), cache_get_field_content_float(i"pos_y"), cache_get_field_content_float(i"pos_z"), cache_get_field_content_float(i"rot_x"), cache_get_field_content_float(i"rot_y"), cache_get_field_content_float(i"rot_z"), cache_get_field_content_int(i"world"), cache_get_field_content_int(i"interior"));
                
Streamer_SetExtraInt(objectidE_OBJECT_TYPEE_OBJECT_FURNITURE);
                
Streamer_SetExtraInt(objectidE_OBJECT_INDEX_IDcache_get_field_content_int(i"id"));
                
Streamer_SetExtraInt(objectidE_OBJECT_EXTRA_IDcache_get_field_content_int(i"houseid"));
                if(
extraid)
                {
                    new
                        
string[48];
                    
cache_get_field_content(i"name"string);
                    
format(stringsizeof(string), "[%i] - %s"objectidstring);
                    
Streamer_SetExtraInt(objectidE_OBJECT_3DTEXT_ID_:CreateDynamic3DTextLabel(stringCOLOR_GREYcache_get_field_content_float(i"pos_x"), cache_get_field_content_float(i"pos_y"), cache_get_field_content_float(i"pos_z"), 10.0, .worldid cache_get_field_content_int(i"world"), .interiorid cache_get_field_content_int(i"interior")));
                }
            }
        } 



Re: Objects disappear! - pollo97 - 06.11.2017

Try this:
Код:
  if(response == EDIT_RESPONSE_FINAL) 
                { 
                    new houseid = House_Inside(playerid); 

                    if(houseid >= 0 && HasFPrems(playerid, houseid)) 
                    { 
                        if(p_Info[playerid][pCash] < furnitureObj[p_Info[playerid][pSelect]][fCost]) 
                        { 
                            return SendClientMessage(playerid, COLOR_GREY, "You couldn't afford to purchase this item."); 
                        } 

                        new 
                            string[16]; 

                        GivePlayerCash(playerid, -furnitureObj[p_Info[playerid][pSelect]][fCost]); 

                        mysql_format(connect, queryBuffer, sizeof(queryBuffer), "INSERT INTO furniture VALUES(null, %i, %i, '%e', %i, '%f', '%f', '%f', '%f', '%f', '%f', %i, %i, 0, 0)", h_Info[houseid][hSQLId], furnitureObj[p_Info[playerid][pSelect]][fModel], furnitureObj[p_Info[playerid][pSelect]][fName], furnitureObj[p_Info[playerid][pSelect]][fCost], x, y, z, rx, ry, rz, h_Info[houseid][hIntIW], h_Info[houseid][hIntVW]); 
                        mysql_tquery(connect, queryBuffer); 
                        mysql_tquery(connect, "SELECT * FROM furniture WHERE id = LAST_INSERT_ID()", "OnMysqlFinish", "ii", LOAD_FURNITURE, h_Info[houseid][hLabels]); 

                        format(string, sizeof(string), "~r~-$%i", furnitureObj[p_Info[playerid][pSelect]][fCost]); 
                        GameTextForPlayer(playerid, string, 5000, 1); 
                        SetDynamicObjectPos(objectid,x,y,z);
                        SetDynamicObjectRot(objectid,rx,ry,rz);

                    } 
                }
This because the ingame editor doesn't save automatically the new position.