What's wrong with my object mover?
#1

Here is the codes of my mod.
The problem is, when I use /move2 and then I type the id the object is disappear
Код:
enum
{
    DIALOG_x,
    DIALOG_y,
    DIALOG_z,
    DIALOG_model,
    DIALOG_delete,
    DIALOG_x2,
    DIALOG_y2,
    DIALOG_z2,
    DIALOG_move
}

new long:model;
new Float: Angle[3];
new Float: Pos[ 4 ];
new Float: Angle2[3];
new Float: Pos2[ 4 ];
new speed = 100;
new qkac[MAX_OBJECTS];
new o;


COMMAND:xm(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_x2, DIALOG_STYLE_INPUT, "X", "Type it:", "Submit", "Cancel");
	return 1;
}
COMMAND:ym(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_y2, DIALOG_STYLE_INPUT, "Y", "Type it:", "Submit", "Cancel");
	return 1;
}
COMMAND:zm(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_z2, DIALOG_STYLE_INPUT, "Z", "Type it:", "Submit", "Cancel");
	return 1;
}




COMMAND:move2(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_delete, DIALOG_STYLE_INPUT, "Move", "Type it:", "Submit", "Cancel");
	return 1;
}



if(dialogid == DIALOG_move)
    {
		if(response == 1)
		{
		//Angle[ 0 ]=inputtext[20];
		qkac[o]=strval(inputtext);
		qkac[o] = MoveDynamicObject(model, Pos[0]+Pos2[0], Pos[1]+Pos2[1], Pos[2]+Pos2[2], speed, 000.0,000.0,000.0);
		}
		else
		{
			SendClientMessage(playerid, 0xEB000FFF, ":(");
		}
		return 1;
	}
Reply
#2

Global variable speed to 0.5.. And you doubled the topic. =,=
Reply
#3

you are using DIALOG_delete in your move2 command i am assuming that this dialog deletes the object? try changing it to DIALOG_move
Reply
#4

Sorry.... I changed it, but still got the problem.
Reply
#5

which did you change? both?
Reply
#6

OH! You right!!! I've correct it. both. Now, nothing happen when i use it :/
Reply
#7

Show us how it looks now.
Reply
#8

Код:
enum
{
    DIALOG_x,
    DIALOG_y,
    DIALOG_z,
	DIALOG_model,
	DIALOG_delete,
	DIALOG_x2,
    DIALOG_y2,
    DIALOG_z2,
    DIALOG_move
}

new long:model;
new Float: Angle[3];
new Float: Pos[ 4 ];
new Float: Angle2[3];
new Float: Pos2[ 4 ];
new speed = 0.5;
new qkac[MAX_OBJECTS];
new o;
new x;



COMMAND:xm(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_x2, DIALOG_STYLE_INPUT, "X", "Type it:", "Submit", "Cancel");
	return 1;
}
COMMAND:ym(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_y2, DIALOG_STYLE_INPUT, "Y", "Type it:", "Submit", "Cancel");
	return 1;
}
COMMAND:zm(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_z2, DIALOG_STYLE_INPUT, "Z", "Type it:", "Submit", "Cancel");
	return 1;
}
//=====================================================
COMMAND:model(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_model, DIALOG_STYLE_INPUT, "Model", "Type it:", "Submit", "Cancel");
	return 1;
}
COMMAND:deleteq(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_delete, DIALOG_STYLE_INPUT, "Delete", "Type it:", "Submit", "Cancel");
	return 1;
}
COMMAND:move2(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_move, DIALOG_STYLE_INPUT, "Move", "Type it:", "Submit", "Cancel");
	return 1;
}

if(dialogid == DIALOG_model)
   	    {
		if(response == 1)
		{
		//Angle[ 0 ]=inputtext[20];
		model=strval(inputtext);
		}
		else
		{
			SendClientMessage(playerid, 0xEB000FFF, ":(");
		}
		return 1;
	}
	if(dialogid == DIALOG_delete)
   	    {
		if(response == 1)
		{
		//Angle[ 0 ]=inputtext[20];
		new valtozo;
		valtozo=strval(inputtext);
		DestroyDynamicObject(valtozo);
		}
		else
		{
			SendClientMessage(playerid, 0xEB000FFF, ":(");
		}
		return 1;
		//==========
	if(dialogid == DIALOG_x2)
    {
		if(response == 1)
		{
		//Angle[ 0 ]=inputtext[20];
		Pos2[ 0 ]=strval(inputtext);
		}
		else
		{
			SendClientMessage(playerid, 0xEB000FFF, ":(");
		}
		return 1;
	}
	if(dialogid == DIALOG_y2)
   	    {
		if(response == 1)
		{
		//Angle[ 0 ]=inputtext[20];
		Pos2[ 1 ]=strval(inputtext);
		}
		else
		{
			SendClientMessage(playerid, 0xEB000FFF, ":(");
		}
		return 1;
	}
	if(dialogid == DIALOG_z2)
   	    {
		if(response == 1)
		{
		//Angle[ 0 ]=inputtext[20];
		Pos2[ 2 ]=strval(inputtext);
		}
		else
		{
			SendClientMessage(playerid, 0xEB000FFF, ":(");
		}
		return 1;
	}
	
	if(dialogid == DIALOG_move)
    {
		if(response == 1)
		{
		//Angle[ 0 ]=inputtext[20];
		qkac[o]=strval(inputtext);
		qkac[o] = MoveDynamicObject(model, Pos[0]+Pos2[0], Pos[1]+Pos2[1], Pos[2]+Pos2[2], speed, 000.0,000.0,000.0);
		}
		else
		{
			SendClientMessage(playerid, 0xEB000FFF, ":(");
		}
		return 1;
	}
Reply
#9

Everywhere I've seen with moving dynamic objects doesn't use the rotation values. So inside the DIALOG_move use:

pawn Код:
MoveDynamicObject(model, Pos[0]+Pos2[0], Pos[1]+Pos2[1], Pos[2]+Pos2[2], speed);
instead of:
pawn Код:
MoveDynamicObject(model, Pos[0]+Pos2[0], Pos[1]+Pos2[1], Pos[2]+Pos2[2], speed, 000.0,000.0,000.0);
and tell us your results
Reply
#10

I think you are all missing something very obvious...
pawn Код:
enum
{
    DIALOG_x,
    DIALOG_y,
    DIALOG_z,
    DIALOG_model,
    DIALOG_delete,
    DIALOG_x2,
    DIALOG_y2,
    DIALOG_z2,
    DIALOG_move
}
Why are these dialog ids in an enum for? They need to be given separate values that make them unique from each other.
Change this:
pawn Код:
enum
{
    DIALOG_x,
    DIALOG_y,
    DIALOG_z,
    DIALOG_model,
    DIALOG_delete,
    DIALOG_x2,
    DIALOG_y2,
    DIALOG_z2,
    DIALOG_move
}
to this:
pawn Код:
#define DIALOG_x 1
#define DIALOG_y 2
#define DIALOG_z 3
#define DIALOG_model 4
#define DIALOG_delete 5
#define DIALOG_x2 6
#define DIALOG_y2 7
#define DIALOG_z2 8
#define DIALOG_move 9
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)