OnPlayerEditDynamicObject Issue
#1

When i use EditDynamicObject, nothing happens?

here is my create object code:
Код:
CMD:createobject(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
new type, objid, cost;
new string[256];
if(sscanf(params,"iii", type, objid, cost)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /CreateObject status id cost /n Type: 1 - normal, 3 - Derby, 4 - furniture store");
	for(new idx=1; idx<MAX_OBJECT; idx++)
	{
	    if(!ObjectInfo[idx][oType])
		{
		    new virtworld = GetPlayerVirtualWorld(playerid);
		    new Float:X, Float:Y, Float:Z;
		    GetPlayerPos(playerid, X, Y, Z);
		    ObjectInfo[idx][oStatus] = 0;
		    ObjectInfo[idx][oType] = type;
		    ObjectInfo[idx][oid] = objid;
		    format(ObjectInfo[idx][oOwner], 32, "The State");
		    ObjectInfo[idx][oX] = X;
		    ObjectInfo[idx][oY] = Y;
		    ObjectInfo[idx][oZ] = Z;
		    ObjectInfo[idx][orX] = 0;
		    ObjectInfo[idx][orY] = 0;
		    ObjectInfo[idx][orZ] = 0;
		    ObjectInfo[idx][oPickupid] = 0;
		    ObjectInfo[idx][oPickupAmmount] = cost;
		    ObjectInfo[idx][oVirtualWorld] = virtworld;
			ObjectInfo[idx][oidx] = CreateDynamicObject(ObjectInfo[idx][oid], ObjectInfo[idx][oX]+1, ObjectInfo[idx][oY]+1, ObjectInfo[idx][oZ]+1, 0.0,0.0,0.0, -1, -1, -1, 100.0, 0.0);
			EditDynamicObject(playerid, ObjectInfo[idx][oidx]);
			new string2[32];
			format(string2, sizeof(string2), "You have created object with id: %d.", idx);
			SendClientMessage(playerid, COLOR_BLUE, string2);
			format(string, sizeof(string), "Object ID\n%d", idx);
			SendAdminMessage(COLOR_DARKRED, 1, string);
			new query[300];
   			mysql_format(MySQLCon, query, sizeof(query), "INSERT INTO `objects` (`ID`, `Status`, `Type`, `ObjectId`, `VirtualWorld`) VALUES ('%d', '%d', '%d', '%d')", idx, ObjectInfo[idx][oStatus], ObjectInfo[idx][oType], ObjectInfo[idx][oid], ObjectInfo[idx][oVirtualWorld]);
			mysql_query(MySQLCon, query);
			idx = MAX_OBJECT;
			Log("logs/objects.log", string);
		}
	}
return 1;
}
Here is my OnPlayerEditDynamicObject:

Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
    if(response == EDIT_RESPONSE_FINAL)
	{
    	for(new idx=1; idx<MAX_OBJECT; idx++)
		{
	    	if(objectid == ObjectInfo[idx][oidx])
			{
		    	ObjectInfo[idx][oX] = x;
		    	ObjectInfo[idx][oY] = y;
		    	ObjectInfo[idx][oZ] = z;
		    	ObjectInfo[idx][orX] = rx;
		    	ObjectInfo[idx][orY] = ry;
		    	ObjectInfo[idx][orZ] = rz;
		    	SetDynamicObjectPos(ObjectInfo[idx][oidx], ObjectInfo[idx][oX], ObjectInfo[idx][oY], ObjectInfo[idx][oZ]);
		    	SetDynamicObjectRot(ObjectInfo[idx][oidx], ObjectInfo[idx][orX], ObjectInfo[idx][orY], ObjectInfo[idx][orZ]);
		    	break;
			}
		}
	}
}
Reply
#2

Someone please help me
Reply
#3

I don't see ObjectInfo[idx][oidx] being set anywhere. I don't know if the "x" is supposed to be there, or what so I can't say what to change for sure but yeah it's because ObjectInfo[idx][oidx] never gets set.
Reply
#4

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I don't see ObjectInfo[idx][oidx] being set anywhere. I don't know if the "x" is supposed to be there, or what so I can't say what to change for sure but yeah it's because ObjectInfo[idx][oidx] never gets set.
He obviously has it set as a global.
Reply
#5

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I don't see ObjectInfo[idx][oidx] being set anywhere. I don't know if the "x" is supposed to be there, or what so I can't say what to change for sure but yeah it's because ObjectInfo[idx][oidx] never gets set.
none of that is the problem, its the edit thing, idk what happened it seemed to start right after I updated streamer.
Reply
#6

Had that issue and fixed it by updating the streamer right after CreateDynamicObject and before EditDynamicObject

Код:
ObjectInfo[idx][oidx] = CreateDynamicObject(ObjectInfo[idx][oid], ObjectInfo[idx][oX]+1, ObjectInfo[idx][oY]+1, ObjectInfo[idx][oZ]+1, 0.0,0.0,0.0, -1, -1, -1, 100.0, 0.0);
Streamer_Update(playerid);
EditDynamicObject(playerid, ObjectInfo[idx][oidx]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)