Posts: 204
Threads: 28
Joined: Apr 2016
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.
Posts: 428
Threads: 4
Joined: Feb 2017
Reputation:
0
Show the codes when you are saving it
Posts: 231
Threads: 61
Joined: Oct 2013
Reputation:
0
try reloading the object on save.
Posts: 204
Threads: 28
Joined: Apr 2016
Quote:
Originally Posted by Puff
try reloading the object on save.
|
I do reload the object
PHP код:
mysql_format(connect, queryBuffer, sizeof(queryBuffer), "INSERT INTO objects VALUES(null, %d, %d, '%e', %d, '%f', '%f', '%f', '%f', '%f', '%f', %d, %d, 0, 0)", objectid, objectsArray[PlayerInfo[playerid][pSelected]][oModel], objectsArray[PlayerInfo[playerid][pSelected]][oName], objectsArray[PlayerInfo[playerid][pSelected]][oPrice], x, y, z, rx, ry, rz, PlayerInfo[playerid][pWorld]);
mysql_tquery(connect, queryBuffer, "", "");
mysql_tquery(connect, "SELECT * FROM objects WHERE id = LAST_INSERT_ID()", "OnQueryFinish", "ii", THREAD_LOAD_OBJECTS, PlayerInfo[playerid][pWorld]);
Reloadobjects(objectid);
PHP код:
Reloadobject(objectid)
{
if(IsValidDynamicObject(objectid) && Streamer_GetExtraInt(objectid, E_OBJECT_TYPE) == E_OBJECT_MAPPING)
{
new
id = Streamer_GetExtraInt(objectid, E_OBJECT_INDEX_ID);
DeleteMappingObject(objectid);
mysql_format(connect, queryBuffer, sizeof(queryBuffer), "SELECT * FROM objects WHERE id = %i", id);
mysql_tquery(connect, queryBuffer, "OnQueryFinish", "ii", THREAD_LOAD_OBJECTS);
}
}
Posts: 204
Threads: 28
Joined: Apr 2016
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(connect, queryBuffer, sizeof(queryBuffer), "INSERT INTO objects VALUES(null, %d, %d, '%e', %d, '%f', '%f', '%f', '%f', '%f', '%f', %d, %d, 0, 0)", objectid, objectsArray[PlayerInfo[playerid][pSelected]][oModel], objectsArray[PlayerInfo[playerid][pSelected]][oName], objectsArray[PlayerInfo[playerid][pSelected]][oPrice], x, y, z, rx, ry, rz, PlayerInfo[playerid][pWorld]);
mysql_tquery(connect, queryBuffer, "", "");
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(playerid, COLOR_WHITE, "You can use /door to control your door and /lock to unlock or lock it.");
}
}
}
else if(response == EDIT_RESPONSE_CANCEL)
{
ShowDialogToPlayer(playerid, DIALOG_BUIDOBJECT2);
}
}
}
under OnPlayerEditDynamicObject
Posts: 204
Threads: 28
Joined: Apr 2016
Is kinda weird dude because when i restart the server the objects are there saved in the same position you save..