SA-MP Forums Archive
Moving Object with rotation - 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: Moving Object with rotation (/showthread.php?tid=314532)



Moving Object with rotation - Scofield62 - 30.01.2012

I have a little problem with my automatic gates i mean, when i create a gate what lifting up and down it is works fine! But when i want to create a gate which i change only the rotation Values to move the gate moving is to fast, it is recently do it and not smoothly. Anybody can help me?

Sorry for my English.


Re: Moving Object with rotation - thimo - 30.01.2012

Could you explain it a bit more? :S


Re: Moving Object with rotation - Scofield62 - 30.01.2012

pawno (filterscript)
Код:
#include <a_samp>
forward CheckGate();
new Gate1;


public OnFilterScriptInit()
{
	SetTimer("CheckGate", 1000, true);
	CreateObject(966, 1328.74, -1385.46, 12.69,   0.00, 0.00, 0.00); // Gate1 talp
	Gate1 = CreateObject(968, 1328.74, -1385.45, 13.47, 1.92, -90.30, 0.00);
	print("\n--------------------------------------");
	print(" Gates! ");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public CheckGate()
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(IsPlayerInRangeOfPoint(i, 5.00, 1325.0199,-1387.8572,13.6263))
	        {
				MoveObject(Gate1, 1328.74, -1385.45, 15.98, 3);
			}
			else
			{
			    MoveObject(Gate1, 1328.74, -1385.45, 13.47, 3);
			}
		}
	}
}
Its WOrking well! But if i Change only the Rotation values the gate will be move suddenly at the position not smoothly :S

for example
Код:
#include <a_samp>
forward CheckGate();
new Gate1;


public OnFilterScriptInit()
{
	SetTimer("CheckGate", 1000, true);
	CreateObject(966, 1328.74, -1385.46, 12.69,   0.00, 0.00, 0.00); // Gate1 talp
	Gate1 = CreateObject(968, 1328.74, -1385.45, 13.47, 1.92, -90.30, 0.00);
	print("\n--------------------------------------");
	print(" Gates! ");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public CheckGate()
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(IsPlayerInRangeOfPoint(i, 5.00, 1325.0199,-1387.8572,13.6263))
	        {
				MoveObject(Gate1, 1328.74, -1385.45, 13.47, 3,0.00,-90.0,-4.0); // i edited only the [Y] and [Z] rotation value
			}
			else
			{
			    MoveObject(Gate1, 1328.74, -1385.45, 13.47, 3,0.00,0.00,0.00);
			}
		}
	}
}



Re: Moving Object with rotation - MasterJoker - 30.01.2012

Well create a new object (also new position with the rotation value!). change rotation makes your perfect gate opening bad.


Re: Moving Object with rotation - Scofield62 - 30.01.2012

I want to change only the rotation value . I don't understand what u are saying, can u paste the full code?


Re: Moving Object with rotation - milanosie - 30.01.2012

Rotation will be bugged unless you are using the latest version of the Streamer Plugin

Download the latest verstion


Re: Moving Object with rotation - Vince - 30.01.2012

Useless answer again, because he's not using a streamer. OT: I had the same problem with one of my barriers. I solved it by altering the x, y, z coordinates in the MoveObject statement with just a tiny bit (0.1 or something). For some reason it does indeed not work if only the rotation is changed.


Re: Moving Object with rotation - MP2 - 30.01.2012

See my tutorial on this: https://sampforum.blast.hk/showthread.php?tid=295590