24.09.2017, 10:21
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:
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); } }