EditDynamicObject Calls both OnPlayerEdits!
#7

Name doesn't matter, you don't understand.

GetDynamicObjectPos(objectid, OX, OY, OZ); is not working while editing object, it is returning old position.

Fixed 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);
	new OVW, OINT;

	if(response == EDIT_RESPONSE_FINAL)
	{
	    new string[254];
		OVW = GetPlayerVirtualWorld(playerid);
		OINT = GetPlayerInterior(playerid);

		SendClientMessage(playerid, COLOR_BLUE, "Object Saved, Please add more if you wish");
		format(string, sizeof(string), "Object model %i spawned at %f, %f, %f, with rotation %f, %f, %f,", objinfo[ocnt][omdl], x, y, z, rx, ry, rz);
		SendClientMessage(playerid, 0xD8D8D8FF, string);
		format(string, sizeof(string), "Object world %i interior id %i", OVW, OINT);
		SendClientMessage(playerid, 0xD8D8D8FF, string);
		DestroyDynamicObject(objectid);
		objinfo[ocnt][oid]=CreateDynamicObject(objinfo[ocnt][omdl],x,y,z,rx,ry,rz,OVW,OINT);
		Streamer_Update(playerid,-1);
		new chcstr[200];
		format(chcstr,sizeof(chcstr),"Furnitures/%d.ini",ocnt);
		if(!dini_Exists(chcstr))
		{
            createobject(objinfo[ocnt][omdl],x,y,z,rx,ry,rz,OVW,OINT);
		}
		else
		{
		    saveobject(objinfo[ocnt][oid],objinfo[ocnt][omdl],x,y,z,rx,ry,rz,OVW,OINT);
		}
	}

	if(response == EDIT_RESPONSE_CANCEL)
	{
		SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
		SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
	}
}
Reply


Messages In This Thread
EditDynamicObject Calls both OnPlayerEdits! - by grymtn - 23.09.2017, 19:56
Re: EditDynamicObject Calls both OnPlayerEdits! - by grymtn - 24.09.2017, 09:50
Re: EditDynamicObject Calls both OnPlayerEdits! - by raydx - 24.09.2017, 09:54
Re: EditDynamicObject Calls both OnPlayerEdits! - by grymtn - 24.09.2017, 09:59
Re: EditDynamicObject Calls both OnPlayerEdits! - by raydx - 24.09.2017, 10:10
Re: EditDynamicObject Calls both OnPlayerEdits! - by grymtn - 24.09.2017, 10:14
Re: EditDynamicObject Calls both OnPlayerEdits! - by raydx - 24.09.2017, 10:21
Re: EditDynamicObject Calls both OnPlayerEdits! - by grymtn - 24.09.2017, 10:59

Forum Jump:


Users browsing this thread: 1 Guest(s)