SA-MP Forums Archive
Problem with MoveObject - 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: Problem with MoveObject (/showthread.php?tid=461811)



Problem with MoveObject - GabsReDeal - 03.09.2013

So I started scripting for a door to move whenever a player gets next to it, no errors or anything, it's just whenever I go close to them, nothing happens... And one more thing, if you could tell me how to do it for a single player it would highly be appreciated. Thanks a lot.

news
Код:
new g1;
new g2;
new g3;
forwards
Код:
forward point(playerid);
forward close();
public OnGameModeInit()
Код:
public OnGameModeInit()
{
	g1 = CreateObject(3037, 935.74127, 2403.97021, 12.20237,   0.00000, 0.00000, -90.00000);
 	g2 = CreateObject(3037, 958.76367, 2403.97021, 12.18013,   0.00000, 0.00000, -90.00000);
 	g3 = CreateObject(3037, 981.90692, 2403.97021, 12.24170,   0.00000, 0.00000, -90.00000);
}
public point(playerid)
Код:
public point(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 935.7413, 2403.9702, 12.2024))
	{
	MoveObject(g1,935.7413, 2403.9702, 15.6253, 2.50);
	}
	else
	{
	MoveObject(g1,935.7413, 2403.9702, 12.2024, 2.50);
	}
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 958.7637, 2403.9702, 12.1801))
	{
	MoveObject(g2,958.7637, 2403.9702, 15.6253, 2.50);
	}
	else
	{
	MoveObject(g2,958.7637, 2403.9702, 12.1801, 2.50);
	}
 	if(IsPlayerInRangeOfPoint(playerid, 7.0, 981.9069, 2403.9702, 12.2417))
	{
	MoveObject(g3,981.9069, 2403.9702, 15.6253, 2.50);
	}
	else
	{
	MoveObject(g3,981.9069, 2403.9702, 12.2417,2.50);
	}
	return 1;
}
public close()
Код:
public close()
{
	MoveObject(g1,935.7413,2403.9702,12.2024,5.00);
	MoveObject(g2,958.7637,2403.9702,12.1801,5.00);
	MoveObject(g3,1002.1666,2399.7578,12.2417,5.00);
	return 1;
}
Any help would be highly appreciated.