Gates not saving in edited position
#1

Hellow.
I was creating a dynamic gate system but now the problem is when i edit a gate after created it wont save at edited location.When i respawn it , it moved to the old position , to the one that was created.


Editdynamicobject.
Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
	new Float:oldX, Float:oldY, Float:oldZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ;
	GetDynamicObjectPos(objectid, oldX, oldY, oldZ);
	GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
	if(response == EDIT_RESPONSE_FINAL)
	{
		new houseid = PlayerTemp[playerid][tmphouse];
		if(houseid != -1)
		{
			FurnitureLoop(f)
			{
				if(FurnitureInfo[houseid][f][furActive] != true) continue;
				if(FurnitureInfo[houseid][f][furObject] == objectid)
				{
					DestroyDynamicObject(FurnitureInfo[houseid][f][furObject]);
					FurnitureInfo[houseid][f][furX] = x;
					FurnitureInfo[houseid][f][furY] = y;
					FurnitureInfo[houseid][f][furZ] = z;
					FurnitureInfo[houseid][f][furrX] = rx;
					FurnitureInfo[houseid][f][furrY] = ry;
					FurnitureInfo[houseid][f][furrZ] = rz;
					ReloadFurniture(houseid, true, f);
					return 1;
				}
			}
		}
	 }
 if(gateedit[playerid] == 1)
                {
			new atmid = GetClosestGate(playerid);
		if(GetPlayerDistanceToPointEx(playerid, GateInfo[atmid][gateX], GateInfo[atmid][gateY], GateInfo[atmid][gateZ]) < 8)
			{
				if(GateInfo[atmid][gateObject] == objectid)
                 {
                 SetDynamicObjectPos(objectid, x, y, z);
		         SetDynamicObjectRot(objectid, rx, ry, rz);
    GateInfo[atmid][gateX] = x;
    GateInfo[atmid][gateY] = y;
    GateInfo[atmid][gateZ] = z;
    
					return 1;
				}
			}
	}
	if(response == EDIT_RESPONSE_CANCEL)
	{
		SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
		SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
	}
	return 1;
}
Saving Gates
Код:
stock SaveGate(atmid)
{
	new iQuery[500], iFormat[212];
 strcat(iQuery, "UPDATE `GateInfo` SET ");
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`X` = '%f', ", GateInfo[atmid][gateX]);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Y` = '%f', ", GateInfo[atmid][gateY]);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Z` = '%f', ", GateInfo[atmid][gateZ]);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`rotX` = '%f', ", GateInfo[atmid][gaterotX]);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`rotY` = '%f', ", GateInfo[atmid][gaterotY]);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`rotZ` = '%f', ", GateInfo[atmid][gaterotZ]);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Interior` = %d, ", GateInfo[atmid][gateInterior]);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`VirtualWorld` = %d WHERE `ID` = %d", GateInfo[atmid][gateVirtualWorld], atmid);
	strcat(iQuery, iFormat);
	mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Model` = %d, ", GateInfo[atmid][gateModel]);
	strcat(iQuery, iFormat);
	mysql_tquery(MySQLPipeline, iQuery);
	return 1;
}
Reply


Messages In This Thread
Gates not saving in edited position - by ThatFag - 21.10.2016, 13:15
Re: Gates not saving in edited position - by Yaa - 21.10.2016, 13:18
Re: Gates not saving in edited position - by ThatFag - 21.10.2016, 13:20
Re: Gates not saving in edited position - by Jayse - 21.10.2016, 13:22
Re: Gates not saving in edited position - by ThatFag - 21.10.2016, 13:24
Re: Gates not saving in edited position - by ThatFag - 21.10.2016, 18:46
Re: Gates not saving in edited position - by X337 - 21.10.2016, 19:31
Re: Gates not saving in edited position - by ThatFag - 22.10.2016, 09:28
Re: Gates not saving in edited position - by ThatFag - 22.10.2016, 09:49

Forum Jump:


Users browsing this thread: 2 Guest(s)