SA-MP Forums Archive
What's wrong with my object mover? - 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: What's wrong with my object mover? (/showthread.php?tid=410652)



What's wrong with my object mover?????? PLS HELP! - qkac1234 - 26.01.2013

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;
	}



Re: What's wrong with my object mover? - IgrexolonO - 26.01.2013

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


Re: What's wrong with my object mover? - daniboi229 - 26.01.2013

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


Re: What's wrong with my object mover? - qkac1234 - 26.01.2013

Sorry.... I changed it, but still got the problem.


Re: What's wrong with my object mover? - daniboi229 - 26.01.2013

which did you change? both?


Re: What's wrong with my object mover? - qkac1234 - 26.01.2013

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


Re: What's wrong with my object mover? - IgrexolonO - 26.01.2013

Show us how it looks now.


Re: What's wrong with my object mover? - qkac1234 - 26.01.2013

Код:
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;
	}



Re: What's wrong with my object mover? - daniboi229 - 26.01.2013

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


Re: What's wrong with my object mover? - Threshold - 26.01.2013

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