OnPlayerEditDynamicObject bug (rep+)
#1

When i press save, it does not save at the place that i want to.it goes back to the old place

Code:
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;
 	new Float:newX, Float:newY, Float:newZ,
 	Float:newRotX, Float:newRotY, Float:newRotZ;
	GetDynamicObjectPos(objectid, oldX, oldY, oldZ);
 	GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);

	if(response == EDIT_RESPONSE_CANCEL)
	{
		SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
		SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
	}

	if(response == EDIT_RESPONSE_FINAL)
	{
	        GetDynamicObjectPos(objectid, newX, newY, newZ);
		GetDynamicObjectRot(objectid, newRotX, newRotY, newRotZ);
		SetDynamicObjectPos(objectid, newX, newY, newZ);
		SetDynamicObjectRot(objectid, newRotX, newRotY, newRotZ);
	}
	return 1;
}
Reply
#2

You don't have to make variables, make it like this

Code:
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)
	{
		SetDynamicObjectPos(objectid, x, y, z);
		SetDynamicObjectRot(objectid, rz, ry, rz);
	}

	if(response == EDIT_RESPONSE_CANCEL)
	{
		SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
		SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
	}

	return 1;
}
and one more thing, are you mapping in game or using toys or what? because if you've restarted the server or something it wont be saved since you're not saving the object's position, it's like temporarily
Reply
#3

let me try
Reply
#4

OMG THANKS MAN YOU DESERVE A REP
Reply


Forum Jump:


Users browsing this thread: