[HELP]objects dont save - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]objects dont save (
/showthread.php?tid=611887)
[HELP]objects dont save -
majesticz03 - 11.07.2016
When i create object and edit it after serverrestart the object go back to his first spawn position
this is my saveobjects
It doesnt update the cordinations
Код:
stock SaveObjects()
{
new idx = 1, File:file;
new string[256];
while(idx < MAX_OBJ)
{
format(string, sizeof(string), " CreateDynamicObject(%d,%f,%f,%f,%f,%f,%f);\r\n",
ObjInfo[idx][oModel],
ObjInfo[idx][oX],
ObjInfo[idx][oY],
ObjInfo[idx][oZ],
ObjInfo[idx][oRX],
ObjInfo[idx][oRY],
ObjInfo[idx][oRZ]);
if(idx == 1)
{
file = fopen("objects.cfg", io_write);
}
else
{
file = fopen("objects.cfg", io_append);
}
fwrite(file, string);
fclose(file);
idx++;
}
print("Objects saved successfully.");
return 1;
}
cmd:editobj
Код:
CMD:editobj(playerid, params[])
{
new string[128], idx;
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pMapper] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!mDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Mapper Duty.");
if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /editobj [objectid]");
if(!ObjInfo[idx][oModel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid object id.");
oEdit[playerid] = 1;
oEditID[playerid] = idx;
GetDynamicObjectPos(ObjInfo[idx][obj], oPos[playerid][0], oPos[playerid][1], oPos[playerid][2]);
GetDynamicObjectRot(ObjInfo[idx][obj], oRot[playerid][0], oRot[playerid][1], oRot[playerid][2]);
EditDynamicObject(playerid, ObjInfo[idx][obj]);
format(string, sizeof(string), " You are now editing object ID %d's position.", idx);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "MapperWarn: %s is editting object ID %d's position.)", GetPlayerNameEx(playerid), idx);
SendMapperMessage(COLOR_GREEN, 1, string);
return 1;
}
Код:
CMD:saveobjects(playerid, params[])
{
new string[128];
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pMapper] < 5 && PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!mDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Mapper Duty.");
SendClientMessage(playerid, COLOR_RED, "Objects have been saved!");
SaveObjects();
format(string, sizeof(string), "AdmWarn: %s has saved all objects!", GetPlayerNameEx(playerid));
SendAdminMessage(COLOR_DARKRED, 1, string);
SendMapperMessage(COLOR_DARKRED, 1, string);
return 1;
}
please help
Re: [HELP]objects dont save -
majesticz03 - 12.07.2016
Any one?