Сама команда
CMD:object(playerid,params[])
{
if(PlayerLogged[playerid] == 0) return true;
if(PlayerInfo[playerid][pAdmin] < 1|| AdminLogged[playerid] == false ) return true;
ShowPlayerDialog(playerid,89, DIALOG_STYLE_LIST, "Создание / Изменение объекта","Создать объект\nВыбрать объект","Выбрать","Отмена");
return true;
}
Кейсы
case 89:
{
if(response)
{
if(listitem == 0) return ShowPlayerDialog(playerid, 90, DIALOG_STYLE_INPUT,"Создание объекта","Введите ID объекта","Создать","Отмена");
if(listitem == 1) return SelectObject(playerid);
}
}
case 90:
{
if(response)
{
if(!response) return true;
if(!strval(inputtext)) return ShowPlayerDialog(playerid, 90, DIALOG_STYLE_INPUT,"Создание объекта","Введите ID объекта","Создать","Отмена");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new object = CreateObject(strval(inputtext), X+1, Y+1, Z+2, 0.0,0.0,0.0);
SetPVarInt(playerid, "SelectedObject", object);
EditObject(playerid, object);
return true;
}
}
case 91:
{
if(response) return EditObject(playerid, GetPVarInt(playerid, "SelectedObject"));
else
{
DestroyObject(GetPVarInt(playerid, "SelectedObject"));
CancelEdit(playerid);
}
DeletePVar(playerid, "SelectedObject");
}
Это в public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
format(nsa, sizeof(nsa),"ID_Object: %d",objectid);
SendClientMessage(playerid,-1,nsa);
SetPVarInt(playerid, "SelectedObject", objectid);
ShowPlayerDialog(playerid, 91, DIALOG_STYLE_MSGBOX, "Объект выбран","Выберите действие!","Изменить","Удалить");
return true;
}
А это в public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
if(!IsValidObject(objectid)) return 0;
MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
new Float:oldX, Float:oldY, Float:oldZ,
Float:oldRotX, Float:oldRotY, Float:oldRotZ;
GetObjectPos(objectid, oldX, oldY, oldZ);
GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
if(!playerobject)
{
if(!IsValidObject(objectid)) return 0;
MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
}
if(response == EDIT_RESPONSE_FINAL)
{
SetObjectPos(objectid, fX, fY, fZ);
SetObjectRot(objectid, fRotX, fRotY, fRotZ);
}
if(response == EDIT_RESPONSE_CANCEL)
{
if(!playerobject)
{
SetObjectPos(objectid, oldX, oldY, oldZ);
SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
}
else
{
SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
}
}