11.05.2013, 12:49
I've been trying to use the EditObject() and MoveObject() functions when a player edits and object so that in-game object editing is possible. It works fine, but only for the player who edited the object. For other players the object is still in the first position.
I have search around the forums for a possible answer but each time they all seem to do the same thing. It works for the player but not other players. What I have below should in fact work according to the wiki and other threads. Any help is appreciated.
I have search around the forums for a possible answer but each time they all seem to do the same thing. It works for the player but not other players. What I have below should in fact work according to the wiki and other threads. Any help is appreciated.
Код:
PlayerObject = CreateObject(967, x, y, z, 0.0, 0.0, 0.0); EditObject(playerid, PlayerObject); public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { new Float:oldX, Float:oldY, Float:oldZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ; GetObjectPos(PlayerObject, oldX, oldY, oldZ); if(response == EDIT_RESPONSE_FINAL) //If they press the save button, it should move the object. { //MoveObject(PlayerObject, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ); //I tried both moving and destroying+re-creating the object DestroyObject(PlayerObject); CreateObject(PlayerObject, fX, fY, fZ, fRotX, fRotY, fRotZ); } if(response == EDIT_RESPONSE_UPDATE) //Once the player unclicks an edit button it should move the object { MoveObject(PlayerObject, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ); } if(response == EDIT_RESPONSE_CANCEL) //Canceling the edit, this doesn't move the object back to the original position either. { SetObjectPos(PlayerObject, oldX, oldY, oldZ); SetObjectRot(PlayerObject, oldRotX, oldRotY, oldRotZ); } }