CreateObject problem.
#1

I have made an command which creates object and than saves it. Here is the problem.

The cmd:
Код:
CMD:makeobject(playerid, params[])
{
	new obj, str[128];
	if(!IsPlayerAdmin(playerid)) return SCM(playerid, -1, "{FF0000}You need to be an rcon admin.");
	if(sscanf(params, "i", obj)) return SCM(playerid, -1, "{00FFFF}>> USAGE: {FFFFFF}/makeobject [objectid]");
	format(str, sizeof(str), "{80FF00}You are editing object %d.", obj);
	SCM(playerid, -1, str);
	GetPlayerPos(playerid, x,y,z);
	obc = CreateObject(obj, x, y, z, 0, 0, 0);
	EditObject(playerid, obc);
	editing[playerid] = 1;
	return 1;
}
The saving:
Код:
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
	if(editing[playerid] == 1)
	{
	editing[playerid] = 0;
	CreateObject(objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
    format(LogStr, sizeof(LogStr), "CreateObject(%d,1,%f,%f,%f,%f,%f,%f);\r\n", playerobject, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
	Object(LogStr);
	}
}
I always InGame type "1215" ID of object (bollardlight), but in scriptfiles it's not that ID. This is what I get.
Код:
CreateObject(0,1,1567.438842,1016.241271,10.679662,0.000000,0.000000,0.000000);
Reply
#2

Код:
CreateObject(objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
Код:
format(LogStr, sizeof(LogStr), "CreateObject(%d,1,%f,%f,%f,%f,%f,%f);\r\n", playerobject, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
You got the objectid and you saved the playerobject.
Reply
#3

Oh, yes, but that was because first I saved the objectid, and the same thing happend..
Reply
#4

Код:
stock Log(text[])
{
if(!fexist("Objects_log.txt")){fopen("Objects_log.txt", io_write);}
new h,m,s;
gettime(h,m,s);
new entry[256];
format(entry, sizeof(entry), "[%d:%d:%d] %s\r\n",h,m,s,text);
new File:hFile;
hFile=fopen("Objects_log.txt", io_append);
fwrite(hFile,entry);
fclose(hFile);
}
Reply
#5

Same problem appears. The id of object is different.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)