PDA

View Full Version : OnPlayerEditDynamicObject


dh240473
14/10/2015, 03:14 AM
Hi Guys I Got A Dynamic Mapping Script I Have Some Problem When Editing A Object When I Press Save Then It's Will Be Same Like Before Can You Help Me? Here Is The Script

CMD:eo(playerid, params[])
{
new id,string[MAX_PLAYERS];
if(IsPlayerAdmin(playerid) || ml[playerid][mlicense] == 1)
{
if(sscanf(params,"d",id)) return SendClientMessage(playerid,-1,"USAGE: /editobject [ObjectId]");
if(cmodelid[playerid][id] <= 0 || id >= maxobject) return SendClientMessage(playerid,-1,"ERROR: Invalid ObjectID");
EditDynamicObject(playerid, cobject[playerid][id]);
format(string, sizeof(string), "You Have Choose ObjectID %d To Edit", id);
SendClientMessage(playerid, -1, string);
}
return 1;
}


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;
}