EditDynamicObject #help
#1

CMD:eo(playerid,params[])
{
if(IsPlayerAdmin(playerid) || mappinginfo[playerid][mlicense] == 1)
{
new i, string[MAX_PLAYERS];
if(sscanf(params,"i",i)) return SendClientMessage(playerid,X11_YELLOW,"stynx correct usage /eo [objectid]");
if(cmodelid[playerid][i] <= 0 || i >= maxobject) return SendClientMessage(playerid,X11_YELLOW,"error ! invalid objectid");
new x = cobject[playerid][i];
//new Floatx,Float:yy,Float:zz;
//GetDynamicObjectPos(x,xx,yy,zz);
Streamer_Update(playerid);
EditDynamicObject(playerid, x);
format(string, sizeof(string), "+ you have choose objectid %d to edit", i);
SendClientMessage(playerid, -1, string);
if(textdiaoffja[playerid] == false)
createobjecttext(playerid,cmodelid[playerid][i],i,pnama(playerid),cposx[playerid][i],cposy[playerid][i],cposz[playerid][i],crotx[playerid][i],croty[playerid][i],crotz[playerid][i]);
}
return 1;
}

public OnPlayerEditDynamicObject(playerid, objectid, response, Float, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
if(response == EDIT_RESPONSE_FINAL)
{
for(new i = 1; i < maxobject; i++)
{
new g = cobject[playerid][i];
cposx[playerid][g] = x;
cposy[playerid][g] = y;
cposz[playerid][g] = z;
crotx[playerid][g] = rx;
croty[playerid][g] = ry;
crotz[playerid][g] = rz;
MoveDynamicObject(g,x,y,z,5,rx,ry,rz);
//SetDynamicObjectPos(g,x,y,z);
//SetDynamicObjectRot(g,rx,ry,rz);
SendClientMessage(playerid, -1, "You have been edit objectid...");
}
}
else if(response == EDIT_RESPONSE_UPDATE)
{
for(new i = 1; i < maxobject; i++)
{
new g = cobject[playerid][i];
cposx[playerid][g] = x;
cposy[playerid][g] = y;
cposz[playerid][g] = z;
crotx[playerid][g] = rx;
croty[playerid][g] = ry;
crotz[playerid][g] = rz;
SetDynamicObjectPos(g,x,y,z);
SetDynamicObjectRot(g,rx,ry,rz);
SendClientMessage(playerid, -1, "You have been edit objectid...");
}
}
else if(response == EDIT_RESPONSE_CANCEL)
{
SendClientMessage(playerid, -1, "blablabla XD");
}
return 1;
}

why its not work .. help pls
Reply
#2

Please provide the error code you get aswell! The things that appear after you press F5 and try to compile the code.

Edit.: I don't think there is an "EDIT_RESPONSE_UPDATE" response to EditDynamicObject.
Reply
#3

There is no error in the script ... the problem is OnPlayerEditDynamicObject
Reply
#4

I still need more to be able to progress, what happens? Can you get to the point where you can edit the object? And then what? Can you click save? Then what happens? And by the way remove the EDIT_RESPONSE_UPDATE part and change MoveDynamicObject to SetDynamicObjectPos.

And tell me step to step what you try to do and what happens.

Edit.: There are still things I don't quite understand about your script, here's a template of how an EditDynamicObject should look like:

pawn Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
    new Float:oldX, Float:oldY, Float:oldZ,
    Float:oldRotX, Float:oldRotY, Float:oldRotZ;

    GetDynamicObjectPos(objectid, oldX, oldY, oldZ);
    GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);

    if(response == EDIT_RESPONSE_FINAL)
    {
        SetDynamicObjectPos(objectid, x, y, z);
        SetDynamicObjectRot(objectid, rz, ry, rz);
    }

    if(response == EDIT_RESPONSE_CANCEL)
    {
        SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
        SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
    }

    return 1;
}
Reply
#5

still same problem,,,if I move the object use editobject ,,then I save the object ... object was still in the place that I create ...
Reply
#6

Why is the loop there? (for(new i = 1; i < maxobject; i++))

cposx[playerid][objectid] = x;

You could change it to this and try again.

Hope you use SetDynamicObjectPos instead of Moving it!
Reply
#7

Gonna fix something
Reply
#8

Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
   	new Float:oldX, Float:oldY, Float:oldZ,
 	Float:oldRotX, Float:oldRotY, Float:oldRotZ;

	GetDynamicObjectPos(objectid, oldX, oldY, oldZ);
 	GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);

	if(response == EDIT_RESPONSE_FINAL)
	{
	    cposx[playerid][objectid] = x;
		cposy[playerid][objectid] = y;
		cposz[playerid][objectid] = z;
		crotx[playerid][objectid] = rx;
		croty[playerid][objectid] = ry;
		crotz[playerid][objectid] = rz;
		SetDynamicObjectPos(objectid, x, y, z);
		SetDynamicObjectRot(objectid, rz, ry, rz);
	}

	if(response == EDIT_RESPONSE_CANCEL)
	{
		SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
		SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
	}

	return 1;
}
Same problem
Reply
#9

First create new variable
Код:
new EditingMap[MAX_PLAYERS];
new MapAction[MAX_PLAYERS];
And add OnPlayerConnect
Код:
EditingMap[playerid] = EDITING_MAP_NONE;
MapAction[playerid] = 0;
And Define
Код:
#define EDITING_MAP_NONE          0
#define EDITING_MAP_ENABLED       1
And replace the command with

Код:
CMD:eo(playerid,params[])
{
	if(IsPlayerAdmin(playerid) || mappinginfo[playerid][mlicense] == 1)
	{
		new i, string[MAX_PLAYERS];
		if(sscanf(params,"i",i)) return SendClientMessage(playerid,X11_YELLOW,"stynx correct usage /eo [objectid]");
		if(cmodelid[playerid][i] <= 0 || i >= maxobject) return SendClientMessage(playerid,X11_YELLOW,"error ! invalid objectid");
		new x = cobject[playerid][i];
		Streamer_Update(playerid);
		EditDynamicObject(playerid, x);
                MapAction[playerid] = x;
		EditingMap[playerid] = EDITING_MAP_ENABLED;
		format(string, sizeof(string), "+ you have choose objectid %d to edit", i);
		SendClientMessage(playerid, -1, string);
		if(textdiaoffja[playerid] == false)
		createobjecttext(playerid,cmodelid[playerid][i],i,pnama(playerid),cposx[playerid][i],cposy[playerid][i],cposz[playerid][i],crotx[playerid][i],croty[playerid][i],crotz[playerid][i]);
	}
        return 1;
}
And OnPlayerEditDynamicObject

Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
	if(response == EDIT_RESPONSE_UPDATE) return 1;
	new Float:oldX, Float:oldY, Float:oldZ,
 		Float:oldRotX, Float:oldRotY, Float:oldRotZ;

	GetDynamicObjectPos(objectid, oldX, oldY, oldZ);
	GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);

	if(response == EDIT_RESPONSE_FINAL)
	{
		if(EditingMap[playerid] == EDITING_MAP_ENABLED)
		{
			new g = cobject[MapAction[playerid]][i];
			cposx[MapAction[playerid]][g] = x;
			cposy[MapAction[playerid]][g] = y;
			cposz[MapAction[playerid]][g] = z;
			crotx[MapAction[playerid]][g] = rx;
			croty[MapAction[playerid]][g] = ry;
			crotz[MapAction[playerid]][g] = rz;
			SetDynamicObjectPos(objectid, x, y, z);
			SetDynamicObjectRot(objectid, rx, ry, rz);
			SendClientMessage(playerid, -1, "You have edited the objectid...");
		}
	}
	if(response == EDIT_RESPONSE_CANCEL)
	{
		SetDynamicObjectPos(objectid, oldX, oldY, oldZ);
		SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
	}
	return 1;
}
and if possible show us cposx,cposy,cposz enum
Reply
#10

same problem ...
Reply
#11

So mine is working? or still?
Reply
#12

still same problem,,,Is this
Reply
#13

These are 3 different commands, he is asking if the first one (/eo) is working O_o
Reply
#14

its work but still,,,if I move the object use editobject ,,then I save the object ... object was still in the place that I create ..
Reply
#15

anyone help pls ??.............
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)