Sziasztok, egy bútorrendszerhez próbáltam mozgatást írni(Alapból nem volt), jól át is lehet mozgatni, viszont nem mentődik. Tudna valaki segíteni? Előre is köszönöm, és elnézést, hogy a Segítségkérés fórum, belőlem él mostanában XD Itt a mentés és mozgatás rész:
////
stock AddObjectFromFile(DFileName[])
{
if(!fexist(DFileName)) return 0;
new File:ObjectFile, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, oTotal, Line[128];
ObjectFile = fopen(DFileName, io_read);
while(fread(ObjectFile, Line))
{
if(Line[0] == \'/\' || isnull(Line)) continue;
unformat(Line, \"ffffffiii\", OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT, oModel);
CreateDynamicObject(oModel, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, -1, 200.0);
oTotal++;
}
fclose(ObjectFile);
return oTotal;
}
stock AddObjectToFile(DFileName[], Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT)
{
new File:ObjectFile, Line[128];
format(Line, sizeof(Line), \"%f %f %f %f %f %f %i %i %i\\r\\n\", OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT, oModel);
ObjectFile = fopen(DFileName, io_append);
fwrite(ObjectFile, Line);
fclose(ObjectFile);
return 1;
}
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(objectid, oldX, oldY, oldZ);
GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT;
if(!playerobject) // If this is a global object, move it for other players
{
if(!IsValidObject(objectid)) return;
MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
}
if(response == EDIT_RESPONSE_FINAL)
{
new string[254];
OVW = GetPlayerVirtualWorld(playerid);
OINT = GetPlayerInterior(playerid);
GetObjectPos(objectid, OX, OY, OZ);
GetObjectRot(objectid, ORX, ORY, ORZ);
AddObjectToFile(OBJECT_FILE_NAME, OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT);
SendClientMessage(playerid, COLOR_BLUE, \"Object mentve\");
format(string, sizeof(string), \" %i %f, %f, %f, %f, %f, %f,\", oModel, OX, OY, OZ, ORX, ORY, ORZ);
SendClientMessage(playerid, 0xD8D8D8FF, string);
format(string, sizeof(string), \"Object világ: %i interior: %i\", OVW, OINT);
SendClientMessage(playerid, 0xD8D8D8FF, string);
CreateDynamicObject(oModel, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, -1, 200.0);
DestroyObject(Object);
}
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(objectid, oldX, oldY, oldZ);
SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
}
else
{
SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
}
}
}
/*
CMD:furniture(playerid, params[])
{
ShowPlayerDialog(playerid, 509, DIALOG_STYLE_LIST, \"Furniture\", \"Chairs\\nBeds\\nTables\\nTvs\\nCabinets\\nFuns tuff\\n\", \"Ok\", \"Cancel\");
return 1;
}
*/
COMMAND:butor(playerid, params[])
{
new objectid;
if(!sscanf(params, \"i\", objectid))
{
if(objectid >= 1 && objectid <= 11000)
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = objectid;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(oModel, OX, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
SendClientMessage(playerid, 0xD8D8D8FF, \"Object lerakva\");
EditObject(playerid, Object);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, \" 1 és 11000 közötti objecteket rakhatsz csak le.\");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, \"/butor ID\");
}
COMMAND:butormozgat(playerid, params[])
{
SelectObject(playerid);
return 1;
}
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);
}
SendClientMessage(playerid, 0xFFFFFFFF, \"Kiválasztottad\");
return 1;
}