19.01.2015, 10:33
(
Последний раз редактировалось XXCrazyMan707XX; 22.01.2015 в 12:55.
)
Hey, so I made a MySQL database driven object system a few months back, but after I have added a dynamic object plugin, the objects have not been saving correctly.
Sometimes if you get lucky the object will save, but that is hardly ever the case. I have tried to pin point the error by print()'ing in every function and if statement, but it never seems to get to this part below.
It does not show the dialog asking for the object description or the SendClientMessage just above ShowPlayerDialog. It doesn't even print #6, so it must be something to do with the if(response == 1)?
No errors are outputted in the server_log.txt either.
If anything else is needed to solve this, please let me know.
Thanks,
CM707
Sometimes if you get lucky the object will save, but that is hardly ever the case. I have tried to pin point the error by print()'ing in every function and if statement, but it never seems to get to this part below.
pawn Код:
forward OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
print("#Custom OnPlayerEditDynamicObject was called.");
new objquery[300], pname[MAX_PLAYER_NAME], resp[MAX_PLAYERS];//[200];
format(resp, sizeof(resp), "%i", response);
SendClientMessage(playerid, -1, resp);
if(!IsValidDynamicObject(objectid))
{
print("/object invalid");
return SendClientMessage(playerid, -1, "You've selected an invalid object.");
}
if(response == 0)
{
print("#5 The player has cancelled the object insertation.");
PlayerInformation[playerid][Obj] = objectid;
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX,"Delete Selected Object", "Would you like to delete this object from the server?\n\nYou can un-do this in the admin control panel if needed.", "YES", "NO");
}
else if(response == 1)
{
MoveDynamicObject(objectid, x, y, z, 10.0, rx, ry, rz);
IGObj[objectid][OBJX] = x;
IGObj[objectid][OBJY] = y;
IGObj[objectid][OBJZ] = z;
IGObj[objectid][OBJRX] = rx;
IGObj[objectid][OBJRY] = ry;
IGObj[objectid][OBJRZ] = rz;
GetPlayerName(playerid, pname, sizeof(pname));
print("#6 The player has clicked on the save icon in the object editor.");
if(IGObj[objectid][ID] == 0)
{
mysql_format(gMySQLConnect, objquery, sizeof(objquery), "INSERT INTO `Objects` (ObjectID, fX, fY, fZ, rX, rY, rZ) VALUES (%d, %f, %f, %f, %f, %f, %f)", IGObj[objectid][ObjID], x, y, z, rx, ry, rz);
mysql_function_query(gMySQLConnect, objquery, true, "createObject", "d", objectid);
PlayerInformation[playerid][NewOBJ] = 0;
SendClientMessage(playerid, -1, "dialog should be shown asking for a description");
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "Object Description", "Enter the object description below.\n\nFor example: 'Map Name + Purpose' = 'Blueberry Fence'", "Save", "Cancel");
}
else
{
mysql_format(gMySQLConnect, objquery, sizeof(objquery), "UPDATE `Objects` SET ObjectID = %d, fX = %f, fY = %f, fZ = %f, rX = %f, rY = %f, rZ = %f, utime = %i, uname = %s WHERE ID = %d", IGObj[objectid][ObjID], x, y, z, rx, ry, rz, gettime(), pname, IGObj[objectid][ID]);
mysql_function_query(gMySQLConnect, objquery, true, "EndThread", "");
print("#7 The object position will be updated.");
}
}
return 1;
}
No errors are outputted in the server_log.txt either.
If anything else is needed to solve this, please let me know.
Thanks,
CM707