public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
new o = Objects[playerid][objectid];
new Float:oX, Float:oY, Float:oZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ, Float:rX, Float:rY, Float:rZ;
GetObjectPos(o, oX, oY, oZ);
GetObjectRot(o, oldRotX, oldRotY, oldRotZ);
if(ObjectCreator[Objects[playerid][objectid]] == playerid)
{
if(!playerobject) // If this is a global object, move it for other players
{
if(!IsValidObject(objectid)) return;
GetObjectPos(o, X, Y, Z);
SetObjectPos(o, X, Y, Z);
}
if(response == EDIT_RESPONSE_FINAL)
{
// The player clicked on the save icon
// Do anything here to save the updated object position (and rotation)
GetObjectPos(o, X, Y, Z);
SetObjectPos(o, X, Y, Z);
SetObjectRot(o, rX, rY, rZ);
}
if(response == EDIT_RESPONSE_CANCEL)
{
//The player cancelled, so put the object back to it's old position
if(!playerobject) //Object is not a playerobject
{
SetObjectPos(o, oX, oY, oZ);
SetObjectRot(o, oldRotX, oldRotY, oldRotZ);
}
else
{
SetPlayerObjectPos(playerid, o, oX, oY, oZ);
SetPlayerObjectRot(playerid, o, oldRotX, oldRotY, oldRotZ);
}
}
}
}
public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
if(type == SELECT_OBJECT_GLOBAL_OBJECT)
{
EditObject(playerid, objectid);
}
else
{
EditPlayerObject(playerid, objectid);
}
return 1;
}
dcmd_select(playerid, params[])
{
#pragma unused params
new objectid;
if(ObjectCreator[Objects[playerid][objectid]] == playerid)
{
SelectObject(playerid);
}
else
{
SendClientMessage(playerid, COLOUR_SYSTEM, "This isnt your object!");
return 0;
}
return 1;
}
This callback does not handle returns. |
I haven't used these functions yet myself, but I believe that you must confirm the new object's position by using SetObjectPos in OnPlayerEditObject.
|
I am talking for the cmd not for the callback..
But anyway what Vince said might be right.. |
Oh haha, didnt catch that thanks.. But its not the problem
Still havnt tested it yet |
I haven't used these functions yet myself, but I believe that you must confirm the new object's position by using SetObjectPos in OnPlayerEditObject.
|