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=644545)



Objects disappear! - AlexMSK - 10.11.2017

Hello, i've done a in game mapping system but theres a problem, a mapper can edit the object and save it but when he clicks save the object disappear but it exists in the mysql, also if i restart the server i will see the object right where the mapper placed it. Just it doesnt show up when you click save, somehow it disappear.


Re: Objects disappear! - Zeth - 10.11.2017

Show the codes when you are saving it


Re: Objects disappear! - Puff - 10.11.2017

try reloading the object on save.


Re: Objects disappear! - AlexMSK - 10.11.2017

Quote:
Originally Posted by Puff
Посмотреть сообщение
try reloading the object on save.
I do reload the object

PHP код:
                       mysql_format(connectqueryBuffersizeof(queryBuffer), "INSERT INTO objects VALUES(null, %d, %d, '%e', %d, '%f', '%f', '%f', '%f', '%f', '%f', %d, %d, 0, 0)"objectidobjectsArray[PlayerInfo[playerid][pSelected]][oModel], objectsArray[PlayerInfo[playerid][pSelected]][oName], objectsArray[PlayerInfo[playerid][pSelected]][oPrice], xyzrxryrzPlayerInfo[playerid][pWorld]);
                        
mysql_tquery(connectqueryBuffer"""");
                        
mysql_tquery(connect"SELECT * FROM objects WHERE id = LAST_INSERT_ID()""OnQueryFinish""ii"THREAD_LOAD_OBJECTSPlayerInfo[playerid][pWorld]);
 
                        
Reloadobjects(objectid); 
PHP код:
Reloadobject(objectid)
{
    if(
IsValidDynamicObject(objectid) && Streamer_GetExtraInt(objectidE_OBJECT_TYPE) == E_OBJECT_MAPPING)
    {
        new
            
id Streamer_GetExtraInt(objectidE_OBJECT_INDEX_ID);
        
DeleteMappingObject(objectid);
        
mysql_format(connectqueryBuffersizeof(queryBuffer), "SELECT * FROM objects WHERE id = %i"id);
        
mysql_tquery(connectqueryBuffer"OnQueryFinish""ii"THREAD_LOAD_OBJECTS);
    }




Re: Objects disappear! - Puff - 10.11.2017

Show me where this is defined:

PHP код:
Reloadobjects(objectid); 



Re: Objects disappear! - AlexMSK - 10.11.2017

PHP код:
    switch(PlayerInfo[playerid][pEditType])
    {
        case 
EDIT_OBJECT_PREVIEW:
        {
            if(
response != EDIT_RESPONSE_UPDATE)
            {
                
DestroyDynamicObject(PlayerInfo[playerid][pEditObject]);
                
PlayerInfo[playerid][pEditObject] = INVALID_OBJECT_ID;
                
PlayerInfo[playerid][pEditType] = 0;
                if(
response == EDIT_RESPONSE_FINAL)
                {
                
                    new
                        
string[16];
                    
mysql_format(connectqueryBuffersizeof(queryBuffer), "INSERT INTO objects VALUES(null, %d, %d, '%e', %d, '%f', '%f', '%f', '%f', '%f', '%f', %d, %d, 0, 0)"objectidobjectsArray[PlayerInfo[playerid][pSelected]][oModel], objectsArray[PlayerInfo[playerid][pSelected]][oName], objectsArray[PlayerInfo[playerid][pSelected]][oPrice], xyzrxryrzPlayerInfo[playerid][pWorld]);
                    
mysql_tquery(connectqueryBuffer"""");
                    
mysql_tquery(connect"SELECT * FROM objects WHERE id = LAST_INSERT_ID()""OnQueryFinish""ii"THREAD_LOAD_OBJECTS);
//hereee
                    
Reloadobjects(objectid);
                    if(!
strcmp(objectsArray[PlayerInfo[playerid][pSelected]][oCategory], "Doors & Gates"))
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"You can use /door to control your door and /lock to unlock or lock it.");
                    }
                }
                }
                else if(
response == EDIT_RESPONSE_CANCEL)
                {
                    
ShowDialogToPlayer(playeridDIALOG_BUIDOBJECT2);
                }
            }
        } 
under OnPlayerEditDynamicObject


Re: Objects disappear! - AlexMSK - 10.11.2017

Is kinda weird dude because when i restart the server the objects are there saved in the same position you save..